Skip to content

Commit

Permalink
allow SI units with --with-cache configure option
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Feb 4, 2023
1 parent 3ad2466 commit c987faa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
8 changes: 4 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ Optional Packages:
prefix MagickCore API methods
--with-quantum-depth=DEPTH
number of bits in a pixel quantum (default 16)
--with-cache=THRESHOLD set pixel cache threshold in MB (default available
--with-cache=THRESHOLD set pixel cache memory threshold (default available
memory)
--with-frozenpaths freeze delegate paths
--without-magick-plus-plus
Expand Down Expand Up @@ -5121,7 +5121,7 @@ MAGICK_PATCHLEVEL_VERSION=76

MAGICK_VERSION=6.9.12-76

MAGICK_GIT_REVISION=21a178482:20230201
MAGICK_GIT_REVISION=3ad246697:20230203


# Substitute library versioning
Expand Down Expand Up @@ -5155,7 +5155,7 @@ PACKAGE_LIB_VERSION=0x69C

PACKAGE_LIB_VERSION_NUMBER=6,9,12,76

PACKAGE_RELEASE_DATE=2023-02-01
PACKAGE_RELEASE_DATE=2023-02-03


# Ensure that make can run correctly
Expand Down Expand Up @@ -23440,7 +23440,7 @@ fi

if test "$with_cache" != ''; then

printf "%s\n" "#define PixelCacheThreshold $with_cache" >>confdefs.h
printf "%s\n" "#define PixelCacheThreshold \"$with_cache\"" >>confdefs.h

DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-cache=$with_cache "
fi
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -795,12 +795,12 @@ AC_SUBST([MAGICK_ABI_SUFFIX])
# Set pixel cache threshold
AC_ARG_WITH([cache],
[AS_HELP_STRING([--with-cache=THRESHOLD],
[set pixel cache threshold in MB (default available memory)])],
[set pixel cache memory threshold (default available memory)])],
[with_cache=$withval],
[with_cache=''])

if test "$with_cache" != ''; then
AC_DEFINE_UNQUOTED([PixelCacheThreshold],[$with_cache],[Pixel cache threshold in MB (defaults to available memory)])
AC_DEFINE_UNQUOTED([PixelCacheThreshold],["$with_cache"],[Pixel cache memory threshold (defaults to available memory)])
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-cache=$with_cache "
fi

Expand Down
4 changes: 2 additions & 2 deletions magick/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,9 +1389,9 @@ MagickExport MagickBooleanType ResourceComponentGenesis(void)
if ((pagesize <= 0) || (pages <= 0))
memory=2048UL*1024UL*1024UL;
#if defined(MAGICKCORE_PixelCacheThreshold)
memory=MAGICKCORE_PixelCacheThreshold;
memory=StringToMagickSizeType(MAGICKCORE_PixelCacheThreshold,100.0);
#endif
(void) SetMagickResourceLimit(AreaResource,2*memory);
(void) SetMagickResourceLimit(AreaResource,4*memory);
limit=GetEnvironmentValue("MAGICK_AREA_LIMIT");
if (limit != (char *) NULL)
{
Expand Down
9 changes: 2 additions & 7 deletions magick/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -1106,10 +1106,6 @@ MagickExport StringInfo *FileToStringInfo(const char *filename,
MagickExport ssize_t FormatMagickSize(const MagickSizeType size,
const MagickBooleanType bi,char *format)
{
char
p[MaxTextExtent],
q[MaxTextExtent];

const char
**units;

Expand Down Expand Up @@ -1145,10 +1141,9 @@ MagickExport ssize_t FormatMagickSize(const MagickSizeType size,
#else
length=(double) size;
#endif
(void) FormatLocaleString(p,MaxTextExtent,"%.*g",GetMagickPrecision(),
(void) FormatLocaleString(format,MaxTextExtent,"%.*g",GetMagickPrecision(),
length);
(void) FormatLocaleString(q,MaxTextExtent,"%.20g",length);
if (strtod(p,(char **) NULL) == strtod(q,(char **) NULL))
if (strstr(format,"e+") == (char *) NULL)
{
count=FormatLocaleString(format,MaxTextExtent,"%.20g%sB",length,units[0]);
return(count);
Expand Down

0 comments on commit c987faa

Please sign in to comment.