From b18d864b3f06e9272582b7736230d934d715d542 Mon Sep 17 00:00:00 2001 From: dirk Date: Sun, 17 Jul 2016 19:32:43 +0200 Subject: [PATCH] Added missing checks for MAGICKCORE_ZERO_CONFIGURATION_SUPPORT. --- MagickCore/coder.c | 54 +++++++++++++++++++------------------ MagickCore/color.c | 53 +++++++++++++++++++------------------ MagickCore/configure.c | 46 ++++++++++++++++++-------------- MagickCore/log.c | 46 ++++++++++++++++++-------------- MagickCore/magic.c | 60 ++++++++++++++++++++++-------------------- MagickCore/opencl.c | 2 ++ MagickCore/policy.c | 50 +++++++++++++++++++---------------- MagickCore/threshold.c | 32 ++++++++++++---------- 8 files changed, 187 insertions(+), 156 deletions(-) diff --git a/MagickCore/coder.c b/MagickCore/coder.c index d8907f051..bb2a3d2b2 100644 --- a/MagickCore/coder.c +++ b/MagickCore/coder.c @@ -322,12 +322,6 @@ static void *DestroyCoderNode(void *coder_info) static SplayTreeInfo *AcquireCoderCache(const char *filename, ExceptionInfo *exception) { - const StringInfo - *option; - - LinkedListInfo - *options; - MagickStatusType status; @@ -335,25 +329,35 @@ static SplayTreeInfo *AcquireCoderCache(const char *filename, i; SplayTreeInfo - *coder_cache; + *cache; /* Load external coder map. */ - coder_cache=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory, + cache=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory, DestroyCoderNode); - if (coder_cache == (SplayTreeInfo *) NULL) + if (cache == (SplayTreeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); status=MagickTrue; - options=GetConfigureOptions(filename,exception); - option=(const StringInfo *) GetNextValueInLinkedList(options); - while (option != (const StringInfo *) NULL) +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) { - status&=LoadCoderCache(coder_cache,(const char *) - GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + const StringInfo + *option; + + LinkedListInfo + *options; + + options=GetConfigureOptions(filename,exception); option=(const StringInfo *) GetNextValueInLinkedList(options); + while (option != (const StringInfo *) NULL) + { + status&=LoadCoderCache(cache,(const char *) GetStringInfoDatum(option), + GetStringInfoPath(option),0,exception); + option=(const StringInfo *) GetNextValueInLinkedList(options); + } + options=DestroyConfigureOptions(options); } - options=DestroyConfigureOptions(options); +#endif /* Load built-in coder map. */ @@ -379,13 +383,13 @@ static SplayTreeInfo *AcquireCoderCache(const char *filename, coder_info->name=(char *) p->name; coder_info->exempt=MagickTrue; coder_info->signature=MagickCoreSignature; - status&=AddValueToSplayTree(coder_cache,ConstantString(coder_info->magick), + status&=AddValueToSplayTree(cache,ConstantString(coder_info->magick), coder_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",coder_info->name); } - return(coder_cache); + return(cache); } /* @@ -788,9 +792,8 @@ MagickExport MagickBooleanType ListCoderInfo(FILE *file, % % The format of the LoadCoderCache coder is: % -% MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache, -% const char *xml,const char *filename,const size_t depth, -% ExceptionInfo *exception) +% MagickBooleanType LoadCoderCache(SplayTreeInfo *cache,const char *xml, +% const char *filename,const size_t depth,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -803,9 +806,8 @@ MagickExport MagickBooleanType ListCoderInfo(FILE *file, % o exception: return any errors or warnings in this structure. % */ -static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache, - const char *xml,const char *filename,const size_t depth, - ExceptionInfo *exception) +static MagickBooleanType LoadCoderCache(SplayTreeInfo *cache,const char *xml, + const char *filename,const size_t depth,ExceptionInfo *exception) { char keyword[MagickPathExtent], @@ -895,7 +897,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache, file_xml=FileToXML(path,~0UL); if (file_xml != (char *) NULL) { - status&=LoadCoderCache(coder_cache,file_xml,path,depth+1, + status&=LoadCoderCache(cache,file_xml,path,depth+1, exception); file_xml=DestroyString(file_xml); } @@ -922,8 +924,8 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache, continue; if (LocaleCompare(keyword,"/>") == 0) { - status=AddValueToSplayTree(coder_cache,ConstantString( - coder_info->magick),coder_info); + status=AddValueToSplayTree(cache,ConstantString(coder_info->magick), + coder_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'", diff --git a/MagickCore/color.c b/MagickCore/color.c index 4c5ec1379..c036f2d79 100644 --- a/MagickCore/color.c +++ b/MagickCore/color.c @@ -828,12 +828,8 @@ static MagickBooleanType static LinkedListInfo *AcquireColorCache(const char *filename, ExceptionInfo *exception) { - const StringInfo - *option; - LinkedListInfo - *color_cache, - *options; + *cache; MagickStatusType status; @@ -844,19 +840,29 @@ static LinkedListInfo *AcquireColorCache(const char *filename, /* Load external color map. */ - color_cache=NewLinkedList(0); - if (color_cache == (LinkedListInfo *) NULL) + cache=NewLinkedList(0); + if (cache == (LinkedListInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); status=MagickTrue; - options=GetConfigureOptions(filename,exception); - option=(const StringInfo *) GetNextValueInLinkedList(options); - while (option != (const StringInfo *) NULL) +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) { - status&=LoadColorCache(color_cache,(const char *) - GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + const StringInfo + *option; + + LinkedListInfo + *options; + + options=GetConfigureOptions(filename,exception); option=(const StringInfo *) GetNextValueInLinkedList(options); + while (option != (const StringInfo *) NULL) + { + status&=LoadColorCache(cache,(const char *) GetStringInfoDatum(option), + GetStringInfoPath(option),0,exception); + option=(const StringInfo *) GetNextValueInLinkedList(options); + } + options=DestroyConfigureOptions(options); } - options=DestroyConfigureOptions(options); +#endif /* Load built-in color map. */ @@ -887,15 +893,14 @@ static LinkedListInfo *AcquireColorCache(const char *filename, color_info->compliance=(ComplianceType) p->compliance; color_info->exempt=MagickTrue; color_info->signature=MagickCoreSignature; - status&=AppendValueToLinkedList(color_cache,color_info); + status&=AppendValueToLinkedList(cache,color_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",color_info->name); } - return(color_cache); + return(cache); } - - + /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @@ -1976,9 +1981,8 @@ MagickExport MagickBooleanType ListColorInfo(FILE *file, % % The format of the LoadColorCache method is: % -% MagickBooleanType LoadColorCache(LinkedListInfo *color_cache, -% const char *xml,const char *filename,const size_t depth, -% ExceptionInfo *exception) +% MagickBooleanType LoadColorCache(LinkedListInfo *cache,const char *xml, +% const char *filename,const size_t depth,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -1991,9 +1995,8 @@ MagickExport MagickBooleanType ListColorInfo(FILE *file, % o exception: return any errors or warnings in this structure. % */ -static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache, - const char *xml,const char *filename,const size_t depth, - ExceptionInfo *exception) +static MagickBooleanType LoadColorCache(LinkedListInfo *cache,const char *xml, + const char *filename,const size_t depth,ExceptionInfo *exception) { char keyword[MagickPathExtent], @@ -2083,7 +2086,7 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache, file_xml=FileToXML(path,~0UL); if (file_xml != (char *) NULL) { - status&=LoadColorCache(color_cache,file_xml,path,depth+1, + status&=LoadColorCache(cache,file_xml,path,depth+1, exception); file_xml=DestroyString(file_xml); } @@ -2110,7 +2113,7 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache, continue; if (LocaleCompare(keyword,"/>") == 0) { - status=AppendValueToLinkedList(color_cache,color_info); + status=AppendValueToLinkedList(cache,color_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'", diff --git a/MagickCore/configure.c b/MagickCore/configure.c index 081283b32..d1cae8831 100644 --- a/MagickCore/configure.c +++ b/MagickCore/configure.c @@ -150,12 +150,8 @@ static MagickBooleanType static LinkedListInfo *AcquireConfigureCache(const char *filename, ExceptionInfo *exception) { - const StringInfo - *option; - LinkedListInfo - *configure_cache, - *options; + *cache; MagickStatusType status; @@ -166,19 +162,29 @@ static LinkedListInfo *AcquireConfigureCache(const char *filename, /* Load external configure map. */ - configure_cache=NewLinkedList(0); - if (configure_cache == (LinkedListInfo *) NULL) + cache=NewLinkedList(0); + if (cache == (LinkedListInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); status=MagickTrue; - options=GetConfigureOptions(filename,exception); - option=(const StringInfo *) GetNextValueInLinkedList(options); - while (option != (const StringInfo *) NULL) +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) { - status&=LoadConfigureCache(configure_cache,(const char *) - GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + const StringInfo + *option; + + LinkedListInfo + *options; + + options=GetConfigureOptions(filename,exception); option=(const StringInfo *) GetNextValueInLinkedList(options); + while (option != (const StringInfo *) NULL) + { + status&=LoadConfigureCache(cache,(const char *) + GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + option=(const StringInfo *) GetNextValueInLinkedList(options); + } + options=DestroyConfigureOptions(options); } - options=DestroyConfigureOptions(options); +#endif /* Load built-in configure map. */ @@ -205,13 +211,13 @@ static LinkedListInfo *AcquireConfigureCache(const char *filename, configure_info->value=(char *) p->value; configure_info->exempt=MagickTrue; configure_info->signature=MagickCoreSignature; - status&=AppendValueToLinkedList(configure_cache,configure_info); + status&=AppendValueToLinkedList(cache,configure_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'", configure_info->name); } - return(configure_cache); + return(cache); } /* @@ -1121,7 +1127,7 @@ MagickExport MagickBooleanType ListConfigureInfo(FILE *file, % % The format of the LoadConfigureCache method is: % -% MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache, +% MagickBooleanType LoadConfigureCache(LinkedListInfo *cache, % const char *xml,const char *filename,const size_t depth, % ExceptionInfo *exception) % @@ -1136,7 +1142,7 @@ MagickExport MagickBooleanType ListConfigureInfo(FILE *file, % o exception: return any errors or warnings in this structure. % */ -static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache, +static MagickBooleanType LoadConfigureCache(LinkedListInfo *cache, const char *xml,const char *filename,const size_t depth, ExceptionInfo *exception) { @@ -1226,8 +1232,8 @@ static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache, file_xml=FileToXML(path,~0UL); if (file_xml != (char *) NULL) { - status&=LoadConfigureCache(configure_cache,file_xml,path, - depth+1,exception); + status&=LoadConfigureCache(cache,file_xml,path,depth+1, + exception); file_xml=DestroyString(file_xml); } } @@ -1254,7 +1260,7 @@ static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache, continue; if (LocaleCompare(keyword,"/>") == 0) { - status=AppendValueToLinkedList(configure_cache,configure_info); + status=AppendValueToLinkedList(cache,configure_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'", diff --git a/MagickCore/log.c b/MagickCore/log.c index cd858e9d2..56b88ca80 100644 --- a/MagickCore/log.c +++ b/MagickCore/log.c @@ -255,12 +255,8 @@ static MagickBooleanType static LinkedListInfo *AcquireLogCache(const char *filename, ExceptionInfo *exception) { - const StringInfo - *option; - LinkedListInfo - *log_cache, - *options; + *cache; MagickStatusType status; @@ -271,19 +267,29 @@ static LinkedListInfo *AcquireLogCache(const char *filename, /* Load external log map. */ - log_cache=NewLinkedList(0); - if (log_cache == (LinkedListInfo *) NULL) + cache=NewLinkedList(0); + if (cache == (LinkedListInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); status=MagickTrue; - options=GetConfigureOptions(filename,exception); - option=(const StringInfo *) GetNextValueInLinkedList(options); - while (option != (const StringInfo *) NULL) +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) { - status&=LoadLogCache(log_cache,(const char *) GetStringInfoDatum(option), - GetStringInfoPath(option),0,exception); + const StringInfo + *option; + + LinkedListInfo + *options; + + options=GetConfigureOptions(filename,exception); option=(const StringInfo *) GetNextValueInLinkedList(options); + while (option != (const StringInfo *) NULL) + { + status&=LoadLogCache(cache,(const char *) GetStringInfoDatum(option), + GetStringInfoPath(option),0,exception); + option=(const StringInfo *) GetNextValueInLinkedList(options); + } + options=DestroyConfigureOptions(options); } - options=DestroyConfigureOptions(options); +#endif /* Load built-in log map. */ @@ -311,12 +317,12 @@ static LinkedListInfo *AcquireLogCache(const char *filename, log_info->filename=ConstantString(p->filename); log_info->format=ConstantString(p->format); log_info->signature=MagickCoreSignature; - status&=AppendValueToLinkedList(log_cache,log_info); + status&=AppendValueToLinkedList(cache,log_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",log_info->name); } - return(log_cache); + return(cache); } /* @@ -1406,7 +1412,7 @@ MagickBooleanType LogMagickEvent(const LogEventType type,const char *module, % % The format of the LoadLogCache method is: % -% MagickBooleanType LoadLogCache(LinkedListInfo *log_cache,const char *xml, +% MagickBooleanType LoadLogCache(LinkedListInfo *cache,const char *xml, % const char *filename,const size_t depth,ExceptionInfo *exception) % % A description of each parameter follows: @@ -1420,7 +1426,7 @@ MagickBooleanType LogMagickEvent(const LogEventType type,const char *module, % o exception: return any errors or warnings in this structure. % */ -static MagickBooleanType LoadLogCache(LinkedListInfo *log_cache,const char *xml, +static MagickBooleanType LoadLogCache(LinkedListInfo *cache,const char *xml, const char *filename,const size_t depth,ExceptionInfo *exception) { char @@ -1508,7 +1514,7 @@ static MagickBooleanType LoadLogCache(LinkedListInfo *log_cache,const char *xml, file_xml=FileToXML(path,~0UL); if (file_xml != (char *) NULL) { - status&=LoadLogCache(log_cache,file_xml,path,depth+1, + status&=LoadLogCache(cache,file_xml,path,depth+1, exception); file_xml=DestroyString(file_xml); } @@ -1535,7 +1541,7 @@ static MagickBooleanType LoadLogCache(LinkedListInfo *log_cache,const char *xml, continue; if (LocaleCompare(keyword,"") == 0) { - status=AppendValueToLinkedList(log_cache,log_info); + status=AppendValueToLinkedList(cache,log_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",filename); @@ -1627,7 +1633,7 @@ static MagickBooleanType LoadLogCache(LinkedListInfo *log_cache,const char *xml, } } token=DestroyString(token); - if (log_cache == (LinkedListInfo *) NULL) + if (cache == (LinkedListInfo *) NULL) return(MagickFalse); return(status != 0 ? MagickTrue : MagickFalse); } diff --git a/MagickCore/magic.c b/MagickCore/magic.c index a9767220a..331bba9da 100644 --- a/MagickCore/magic.c +++ b/MagickCore/magic.c @@ -261,15 +261,8 @@ static int CompareMagickInfoSize(const void *a,const void *b) static LinkedListInfo *AcquireMagicCache(const char *filename, ExceptionInfo *exception) { - char - path[MagickPathExtent]; - - const StringInfo - *option; - LinkedListInfo - *magic_cache, - *options; + *cache; MagickStatusType status; @@ -280,21 +273,34 @@ static LinkedListInfo *AcquireMagicCache(const char *filename, /* Load external magic map. */ - magic_cache=NewLinkedList(0); - if (magic_cache == (LinkedListInfo *) NULL) + cache=NewLinkedList(0); + if (cache == (LinkedListInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); status=MagickTrue; - *path='\0'; - options=GetConfigureOptions(filename,exception); - option=(const StringInfo *) GetNextValueInLinkedList(options); - while (option != (const StringInfo *) NULL) +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) { - (void) CopyMagickString(path,GetStringInfoPath(option),MagickPathExtent); - status&=LoadMagicCache(magic_cache,(const char *) - GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + char + path[MagickPathExtent]; + + const StringInfo + *option; + + LinkedListInfo + *options; + + *path='\0'; + options=GetConfigureOptions(filename,exception); option=(const StringInfo *) GetNextValueInLinkedList(options); + while (option != (const StringInfo *) NULL) + { + (void) CopyMagickString(path,GetStringInfoPath(option),MagickPathExtent); + status&=LoadMagicCache(cache,(const char *) + GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + option=(const StringInfo *) GetNextValueInLinkedList(options); + } + options=DestroyConfigureOptions(options); } - options=DestroyConfigureOptions(options); +#endif /* Load built-in magic map. */ @@ -323,13 +329,13 @@ static LinkedListInfo *AcquireMagicCache(const char *filename, magic_info->length=p->length; magic_info->exempt=MagickTrue; magic_info->signature=MagickCoreSignature; - status&=InsertValueInSortedLinkedList(magic_cache,CompareMagickInfoSize, + status&=InsertValueInSortedLinkedList(cache,CompareMagickInfoSize, NULL,magic_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",magic_info->name); } - return(magic_cache); + return(cache); } /* @@ -808,9 +814,8 @@ MagickExport MagickBooleanType ListMagicInfo(FILE *file, % % The format of the LoadMagicCache method is: % -% MagickBooleanType LoadMagicCache(LinkedListInfo *magic_cache, -% const char *xml,const char *filename,const size_t depth, -% ExceptionInfo *exception) +% MagickBooleanType LoadMagicCache(LinkedListInfo *cache,const char *xml, +% const char *filename,const size_t depth,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -823,9 +828,8 @@ MagickExport MagickBooleanType ListMagicInfo(FILE *file, % o exception: return any errors or warnings in this structure. % */ -static MagickBooleanType LoadMagicCache(LinkedListInfo *magic_cache, - const char *xml,const char *filename,const size_t depth, - ExceptionInfo *exception) +static MagickBooleanType LoadMagicCache(LinkedListInfo *cache,const char *xml, + const char *filename,const size_t depth,ExceptionInfo *exception) { char keyword[MagickPathExtent], @@ -915,7 +919,7 @@ static MagickBooleanType LoadMagicCache(LinkedListInfo *magic_cache, file_xml=FileToXML(path,~0UL); if (xml != (char *) NULL) { - status&=LoadMagicCache(magic_cache,file_xml,path,depth+1, + status&=LoadMagicCache(cache,file_xml,path,depth+1, exception); file_xml=DestroyString(file_xml); } @@ -942,7 +946,7 @@ static MagickBooleanType LoadMagicCache(LinkedListInfo *magic_cache, continue; if (LocaleCompare(keyword,"/>") == 0) { - status=InsertValueInSortedLinkedList(magic_cache,CompareMagickInfoSize, + status=InsertValueInSortedLinkedList(cache,CompareMagickInfoSize, NULL,magic_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/MagickCore/opencl.c b/MagickCore/opencl.c index a68e76735..790ad7c2c 100644 --- a/MagickCore/opencl.c +++ b/MagickCore/opencl.c @@ -908,7 +908,9 @@ static MagickBooleanType LoadOpenCLBenchmarks(MagickCLEnv clEnv, We don't run the benchmark when we can not write out a device profile. The first GPU device will be used. */ +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) if (CanWriteProfileToFile(filename) == MagickFalse) +#endif { for (i = 0; i < clEnv->number_devices; i++) clEnv->devices[i]->score=1.0; diff --git a/MagickCore/policy.c b/MagickCore/policy.c index f2ced8b93..bd551ce9d 100644 --- a/MagickCore/policy.c +++ b/MagickCore/policy.c @@ -163,12 +163,8 @@ static MagickBooleanType static LinkedListInfo *AcquirePolicyCache(const char *filename, ExceptionInfo *exception) { - const StringInfo - *option; - LinkedListInfo - *options, - *policy_cache; + *cache; MagickStatusType status; @@ -179,19 +175,29 @@ static LinkedListInfo *AcquirePolicyCache(const char *filename, /* Load external policy map. */ - policy_cache=NewLinkedList(0); - if (policy_cache == (LinkedListInfo *) NULL) + cache=NewLinkedList(0); + if (cache == (LinkedListInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); status=MagickTrue; - options=GetConfigureOptions(filename,exception); - option=(const StringInfo *) GetNextValueInLinkedList(options); - while (option != (const StringInfo *) NULL) +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) { - status&=LoadPolicyCache(policy_cache,(const char *) - GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + const StringInfo + *option; + + LinkedListInfo + *options; + + options=GetConfigureOptions(filename,exception); option=(const StringInfo *) GetNextValueInLinkedList(options); + while (option != (const StringInfo *) NULL) + { + status&=LoadPolicyCache(cache,(const char *) + GetStringInfoDatum(option),GetStringInfoPath(option),0,exception); + option=(const StringInfo *) GetNextValueInLinkedList(options); + } + options=DestroyConfigureOptions(options); } - options=DestroyConfigureOptions(options); +#endif /* Load built-in policy map. */ @@ -220,12 +226,12 @@ static LinkedListInfo *AcquirePolicyCache(const char *filename, policy_info->value=(char *) p->value; policy_info->exempt=MagickTrue; policy_info->signature=MagickCoreSignature; - status&=AppendValueToLinkedList(policy_cache,policy_info); + status&=AppendValueToLinkedList(cache,policy_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",policy_info->name); } - return(policy_cache); + return(cache); } /* @@ -717,9 +723,8 @@ MagickExport MagickBooleanType ListPolicyInfo(FILE *file, % % The format of the LoadPolicyCache method is: % -% MagickBooleanType LoadPolicyCache(LinkedListInfo *policy_cache, -% const char *xml,const char *filename,const size_t depth, -% ExceptionInfo *exception) +% MagickBooleanType LoadPolicyCache(LinkedListInfo *cache,const char *xml, +% const char *filename,const size_t depth,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -732,9 +737,8 @@ MagickExport MagickBooleanType ListPolicyInfo(FILE *file, % o exception: return any errors or warnings in this structure. % */ -static MagickBooleanType LoadPolicyCache(LinkedListInfo *policy_cache, - const char *xml,const char *filename,const size_t depth, - ExceptionInfo *exception) +static MagickBooleanType LoadPolicyCache(LinkedListInfo *cache,const char *xml, + const char *filename,const size_t depth,ExceptionInfo *exception) { char keyword[MagickPathExtent], @@ -824,7 +828,7 @@ static MagickBooleanType LoadPolicyCache(LinkedListInfo *policy_cache, file_xml=FileToXML(path,~0UL); if (file_xml != (char *) NULL) { - status&=LoadPolicyCache(policy_cache,file_xml,path, + status&=LoadPolicyCache(cache,file_xml,path, depth+1,exception); file_xml=DestroyString(file_xml); } @@ -851,7 +855,7 @@ static MagickBooleanType LoadPolicyCache(LinkedListInfo *policy_cache, continue; if (LocaleCompare(keyword,"/>") == 0) { - status=AppendValueToLinkedList(policy_cache,policy_info); + status=AppendValueToLinkedList(cache,policy_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'", diff --git a/MagickCore/threshold.c b/MagickCore/threshold.c index a6b191b51..200b25f8d 100644 --- a/MagickCore/threshold.c +++ b/MagickCore/threshold.c @@ -854,29 +854,33 @@ MagickExport ThresholdMap *DestroyThresholdMap(ThresholdMap *map) MagickExport ThresholdMap *GetThresholdMap(const char *map_id, ExceptionInfo *exception) { - const StringInfo - *option; - - LinkedListInfo - *options; - ThresholdMap *map; map=GetThresholdMapFile(MinimalThresholdMap,"built-in",map_id,exception); if (map != (ThresholdMap *) NULL) return(map); - options=GetConfigureOptions(ThresholdsFilename,exception); - option=(const StringInfo *) GetNextValueInLinkedList(options); - while (option != (const StringInfo *) NULL) +#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) { - map=GetThresholdMapFile((const char *) GetStringInfoDatum(option), - GetStringInfoPath(option),map_id,exception); - if (map != (ThresholdMap *) NULL) - break; + const StringInfo + *option; + + LinkedListInfo + *options; + + options=GetConfigureOptions(ThresholdsFilename,exception); option=(const StringInfo *) GetNextValueInLinkedList(options); + while (option != (const StringInfo *) NULL) + { + map=GetThresholdMapFile((const char *) GetStringInfoDatum(option), + GetStringInfoPath(option),map_id,exception); + if (map != (ThresholdMap *) NULL) + break; + option=(const StringInfo *) GetNextValueInLinkedList(options); + } + options=DestroyConfigureOptions(options); } - options=DestroyConfigureOptions(options); +#endif return(map); } -- 2.40.0