diff --git a/MagickCore/coder.c b/MagickCore/coder.c
index b5d29d8..abf84ac 100644
--- a/MagickCore/coder.c
+++ b/MagickCore/coder.c
@@ -320,8 +320,8 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadCoderCache(coder_cache,(const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadCoderCache(coder_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
@@ -641,8 +641,8 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% IsCoderTreeInstantiated() determines if the coder tree is instantiated.
-% If not, it instantiates the tree and returns it.
+% IsCoderTreeInstantiated() determines if the coder tree is instantiated. If
+% not, it instantiates the tree and returns it.
%
% The format of the IsCoderInstantiated method is:
%
@@ -661,7 +661,7 @@
ActivateSemaphoreInfo(&coder_semaphore);
LockSemaphoreInfo(coder_semaphore);
if (coder_cache == (SplayTreeInfo *) NULL)
- (void) AcquireCoderCache(MagickCoderFilename,exception);
+ coder_cache=AcquireCoderCache(MagickCoderFilename,exception);
UnlockSemaphoreInfo(coder_semaphore);
}
return(coder_cache != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
diff --git a/MagickCore/color.c b/MagickCore/color.c
index 672e568..3c21b09 100644
--- a/MagickCore/color.c
+++ b/MagickCore/color.c
@@ -796,7 +796,8 @@
*/
static MagickBooleanType
IsColorCacheInstantiated(ExceptionInfo *),
- LoadColorCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadColorCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -851,8 +852,8 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadColorCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadColorCache(color_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
@@ -1006,9 +1007,8 @@
*q;
assert(exception != (ExceptionInfo *) NULL);
- if (color_cache == (LinkedListInfo *) NULL)
- if (IfMagickFalse(IsColorCacheInstantiated(exception)))
- return((const ColorInfo *) NULL);
+ if (IfMagickFalse(IsColorCacheInstantiated(exception)))
+ return((const ColorInfo *) NULL);
/*
Strip names of whitespace.
*/
@@ -1905,8 +1905,9 @@
%
% The format of the LoadColorCache method is:
%
-% MagickBooleanType LoadColorCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
+% const char *xml,const char *filename,const size_t depth,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -1919,8 +1920,9 @@
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadColorCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
+ const char *xml,const char *filename,const size_t depth,
+ ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
@@ -1942,16 +1944,6 @@
"Loading color file \"%s\" ...",filename);
if (xml == (char *) NULL)
return(MagickFalse);
- if (color_cache == (LinkedListInfo *) NULL)
- {
- color_cache=NewLinkedList(0);
- if (color_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
status=MagickTrue;
color_info=(ColorInfo *) NULL;
token=AcquireString(xml);
@@ -2016,7 +2008,8 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadColorCache(xml,path,depth+1,exception);
+ status&=LoadColorCache(color_cache,xml,path,depth+1,
+ exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
diff --git a/MagickCore/configure.c b/MagickCore/configure.c
index 0ce4160..9f19151 100644
--- a/MagickCore/configure.c
+++ b/MagickCore/configure.c
@@ -118,7 +118,8 @@
*/
static MagickBooleanType
IsConfigureCacheInstantiated(ExceptionInfo *),
- LoadConfigureCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadConfigureCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -131,7 +132,7 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% AcquireConfigureCache() caches one or more configure configuration files which
+% AcquireConfigureCache() caches one or more configure configurations which
% provides a mapping between configure attributes and a configure name.
%
% The format of the AcquireConfigureCache method is:
@@ -173,8 +174,8 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadConfigureCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadConfigureCache(configure_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
@@ -1082,8 +1083,8 @@
(void) FormatLocaleFile(file,"\n");
}
(void) fflush(file);
- configure_info=(const ConfigureInfo **)
- RelinquishMagickMemory((void *) configure_info);
+ configure_info=(const ConfigureInfo **) RelinquishMagickMemory((void *)
+ configure_info);
return(MagickTrue);
}
@@ -1103,8 +1104,8 @@
%
% The format of the LoadConfigureCache method is:
%
-% MagickBooleanType LoadConfigureCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache,
+% const char *xml,const char *filename,const size_t depth,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -1117,8 +1118,9 @@
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadConfigureCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache,
+ const char *xml,const char *filename,const size_t depth,
+ ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
@@ -1138,16 +1140,6 @@
*/
(void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
"Loading configure file \"%s\" ...",filename);
- if (configure_cache == (LinkedListInfo *) NULL)
- {
- configure_cache=NewLinkedList(0);
- if (configure_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
status=MagickTrue;
configure_info=(ConfigureInfo *) NULL;
token=AcquireString((char *) xml);
@@ -1212,7 +1204,8 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadConfigureCache(xml,path,depth+1,exception);
+ status&=LoadConfigureCache(configure_cache,xml,path,
+ depth+1,exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
diff --git a/MagickCore/delegate.c b/MagickCore/delegate.c
index 160a842..0df9dd5 100644
--- a/MagickCore/delegate.c
+++ b/MagickCore/delegate.c
@@ -140,7 +140,8 @@
*/
static MagickBooleanType
IsDelegateCacheInstantiated(ExceptionInfo *),
- LoadDelegateCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadDelegateCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -193,15 +194,16 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadDelegateCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadDelegateCache(delegate_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
}
#endif
if (IfMagickTrue(IsLinkedListEmpty(delegate_cache)))
- status&=LoadDelegateCache(DelegateMap,"built-in",0,exception);
+ status&=LoadDelegateCache(delegate_cache,DelegateMap,"built-in",0,
+ exception);
return(delegate_cache);
}
@@ -432,9 +434,8 @@
*p;
assert(exception != (ExceptionInfo *) NULL);
- if (delegate_cache == (LinkedListInfo *) NULL)
- if( IfMagickFalse(IsDelegateCacheInstantiated(exception)) )
- return((const DelegateInfo *) NULL);
+ if (IfMagickFalse(IsDelegateCacheInstantiated(exception)))
+ return((const DelegateInfo *) NULL);
/*
Search for named delegate.
*/
@@ -1258,8 +1259,9 @@
%
% The format of the LoadDelegateCache method is:
%
-% MagickBooleanType LoadDelegateCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadDelegateCache(LinkedListInfo *delegate_cache,
+% const char *xml,const char *filename,const size_t depth,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -1272,8 +1274,9 @@
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadDelegateCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadDelegateCache(LinkedListInfo *delegate_cache,
+ const char *xml,const char *filename,const size_t depth,
+ ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
@@ -1295,16 +1298,6 @@
"Loading delegate configuration file \"%s\" ...",filename);
if (xml == (const char *) NULL)
return(MagickFalse);
- if (delegate_cache == (LinkedListInfo *) NULL)
- {
- delegate_cache=NewLinkedList(0);
- if (delegate_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
status=MagickTrue;
delegate_info=(DelegateInfo *) NULL;
token=AcquireString(xml);
@@ -1369,7 +1362,8 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadDelegateCache(xml,path,depth+1,exception);
+ status&=LoadDelegateCache(delegate_cache,xml,path,
+ depth+1,exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
diff --git a/MagickCore/locale.c b/MagickCore/locale.c
index 65557fd..02626ea 100644
--- a/MagickCore/locale.c
+++ b/MagickCore/locale.c
@@ -106,8 +106,8 @@
*/
static MagickBooleanType
IsLocaleTreeInstantiated(ExceptionInfo *),
- LoadLocaleCache(const char *,const char *,const char *,const size_t,
- ExceptionInfo *);
+ LoadLocaleCache(SplayTreeInfo *,const char *,const char *,const char *,
+ const size_t,ExceptionInfo *);
#if defined(MAGICKCORE_HAVE_STRTOD_L)
/*
@@ -212,8 +212,9 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadLocaleCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),locale,0,exception);
+ status&=LoadLocaleCache(locale_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),locale,0,
+ exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyLocaleOptions(options);
@@ -223,8 +224,9 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadLocaleCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),locale,0,exception);
+ status&=LoadLocaleCache(locale_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),locale,0,
+ exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyLocaleOptions(options);
@@ -232,7 +234,8 @@
}
#endif
if (GetNumberOfNodesInSplayTree(locale_cache) == 0)
- status&=LoadLocaleCache(LocaleMap,"built-in",locale,0,exception);
+ status&=LoadLocaleCache(locale_cache,LocaleMap,"built-in",locale,0,
+ exception);
return(locale_cache);
}
@@ -910,35 +913,38 @@
*/
static MagickBooleanType IsLocaleTreeInstantiated(ExceptionInfo *exception)
{
- if (locale_semaphore == (SemaphoreInfo *) NULL)
- ActivateSemaphoreInfo(&locale_semaphore);
- LockSemaphoreInfo(locale_semaphore);
if (locale_cache == (SplayTreeInfo *) NULL)
{
- char
- *locale;
+ if (locale_semaphore == (SemaphoreInfo *) NULL)
+ ActivateSemaphoreInfo(&locale_semaphore);
+ LockSemaphoreInfo(locale_semaphore);
+ if (locale_cache == (SplayTreeInfo *) NULL)
+ {
+ char
+ *locale;
- register const char
- *p;
+ register const char
+ *p;
- locale=(char *) NULL;
- p=setlocale(LC_CTYPE,(const char *) NULL);
- if (p != (const char *) NULL)
- locale=ConstantString(p);
- if (locale == (char *) NULL)
- locale=GetEnvironmentValue("LC_ALL");
- if (locale == (char *) NULL)
- locale=GetEnvironmentValue("LC_MESSAGES");
- if (locale == (char *) NULL)
- locale=GetEnvironmentValue("LC_CTYPE");
- if (locale == (char *) NULL)
- locale=GetEnvironmentValue("LANG");
- if (locale == (char *) NULL)
- locale=ConstantString("C");
- locale_cache=AcquireLocaleSplayTree(LocaleFilename,locale,exception);
- locale=DestroyString(locale);
+ locale=(char *) NULL;
+ p=setlocale(LC_CTYPE,(const char *) NULL);
+ if (p != (const char *) NULL)
+ locale=ConstantString(p);
+ if (locale == (char *) NULL)
+ locale=GetEnvironmentValue("LC_ALL");
+ if (locale == (char *) NULL)
+ locale=GetEnvironmentValue("LC_MESSAGES");
+ if (locale == (char *) NULL)
+ locale=GetEnvironmentValue("LC_CTYPE");
+ if (locale == (char *) NULL)
+ locale=GetEnvironmentValue("LANG");
+ if (locale == (char *) NULL)
+ locale=ConstantString("C");
+ locale_cache=AcquireLocaleSplayTree(LocaleFilename,locale,exception);
+ locale=DestroyString(locale);
+ }
+ UnlockSemaphoreInfo(locale_semaphore);
}
- UnlockSemaphoreInfo(locale_semaphore);
return(locale_cache != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
}
@@ -1090,8 +1096,9 @@
%
% The format of the LoadLocaleCache method is:
%
-% MagickBooleanType LoadLocaleCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadLocaleCache(SplayTreeInfo *locale_cache,
+% const char *xml,const char *filename,const size_t depth,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -1149,8 +1156,9 @@
return(y);
}
-static MagickBooleanType LoadLocaleCache(const char *xml,const char *filename,
- const char *locale,const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadLocaleCache(SplayTreeInfo *locale_cache,
+ const char *xml,const char *filename,const char *locale,const size_t depth,
+ ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
@@ -1180,13 +1188,6 @@
"Loading locale configure file \"%s\" ...",filename);
if (xml == (const char *) NULL)
return(MagickFalse);
- if (locale_cache == (SplayTreeInfo *) NULL)
- {
- locale_cache=NewSplayTree(CompareSplayTreeString,(void *(*)(void *)) NULL,
- DestroyLocaleNode);
- if (locale_cache == (SplayTreeInfo *) NULL)
- return(MagickFalse);
- }
status=MagickTrue;
locale_info=(LocaleInfo *) NULL;
*tag='\0';
@@ -1270,7 +1271,8 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadLocaleCache(xml,path,locale,depth+1,exception);
+ status&=LoadLocaleCache(locale_cache,xml,path,locale,
+ depth+1,exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
diff --git a/MagickCore/log.c b/MagickCore/log.c
index 457ff11..9a7739f 100644
--- a/MagickCore/log.c
+++ b/MagickCore/log.c
@@ -199,7 +199,8 @@
static MagickBooleanType
IsLogCacheInstantiated(ExceptionInfo *),
- LoadLogCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadLogCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -254,7 +255,7 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadLogCache((const char *) GetStringInfoDatum(option),
+ status&=LoadLogCache(log_cache,(const char *) GetStringInfoDatum(option),
GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
@@ -613,8 +614,8 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% IsLogCacheInstantiated() determines if the log list is instantiated. If not,
-% it instantiates the list and returns it.
+% IsLogCacheInstantiated() determines if the log list is instantiated. If
+% not, it instantiates the list and returns it.
%
% The format of the IsLogInstantiated method is:
%
@@ -1325,7 +1326,7 @@
"encoding=\"UTF-8\" standalone=\"yes\"?>\n");
(void) FormatLocaleFile(log_info->file,"<log>\n");
}
- (void) FormatLocaleFile(log_info->file," <event>%s</event>\n",text);
+ (void) FormatLocaleFile(log_info->file," <event>%s</event>\n",text);
(void) fflush(log_info->file);
}
if ((log_info->handler_mask & MethodHandler) != 0)
@@ -1380,8 +1381,8 @@
%
% The format of the LoadLogCache method is:
%
-% MagickBooleanType LoadLogCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadLogCache(LinkedListInfo *log_cache,const char *xml,
+% const char *filename,const size_t depth,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -1394,8 +1395,8 @@
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadLogCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadLogCache(LinkedListInfo *log_cache,const char *xml,
+ const char *filename,const size_t depth,ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
@@ -1415,16 +1416,6 @@
*/
if (xml == (const char *) NULL)
return(MagickFalse);
- if (log_cache == (LinkedListInfo *) NULL)
- {
- log_cache=NewLinkedList(0);
- if (log_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
status=MagickTrue;
token=AcquireString((const char *) xml);
for (q=(const char *) xml; *q != '\0'; )
@@ -1488,7 +1479,8 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status&=LoadLogCache(xml,path,depth+1,exception);
+ status&=LoadLogCache(log_cache,xml,path,depth+1,
+ exception);
xml=DestroyString(xml);
}
}
diff --git a/MagickCore/magic.c b/MagickCore/magic.c
index 39402b3..44db990 100644
--- a/MagickCore/magic.c
+++ b/MagickCore/magic.c
@@ -215,7 +215,8 @@
*/
static MagickBooleanType
IsMagicCacheInstantiated(ExceptionInfo *),
- LoadMagicCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadMagicCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -275,8 +276,8 @@
while (option != (const StringInfo *) NULL)
{
(void) CopyMagickString(path,GetStringInfoPath(option),MaxTextExtent);
- status&=LoadMagicCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadMagicCache(magic_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
@@ -738,8 +739,9 @@
%
% The format of the LoadMagicCache method is:
%
-% MagickBooleanType LoadMagicCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadMagicCache(LinkedListInfo *magic_cache,
+% const char *xml,const char *filename,const size_t depth,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -752,8 +754,9 @@
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadMagicCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadMagicCache(LinkedListInfo *magic_cache,
+ const char *xml,const char *filename,const size_t depth,
+ ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
@@ -775,16 +778,6 @@
"Loading magic configure file \"%s\" ...",filename);
if (xml == (char *) NULL)
return(MagickFalse);
- if (magic_cache == (LinkedListInfo *) NULL)
- {
- magic_cache=NewLinkedList(0);
- if (magic_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
status=MagickTrue;
magic_info=(MagicInfo *) NULL;
token=AcquireString(xml);
@@ -849,7 +842,8 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadMagicCache(xml,path,depth+1,exception);
+ status&=LoadMagicCache(magic_cache,xml,path,depth+1,
+ exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}
diff --git a/MagickCore/magick.c b/MagickCore/magick.c
index d06d9da..b5d6c58 100644
--- a/MagickCore/magick.c
+++ b/MagickCore/magick.c
@@ -1444,6 +1444,8 @@
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",magick_info->name);
if (magick_list == (SplayTreeInfo *) NULL)
return((MagickInfo *) NULL);
+ if (magick_info->thread_support == NoThreadSupport)
+ magick_info->semaphore=AcquireSemaphoreInfo();
status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
if (status == MagickFalse)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
diff --git a/MagickCore/mime.c b/MagickCore/mime.c
index 981ede4..ca0f642 100644
--- a/MagickCore/mime.c
+++ b/MagickCore/mime.c
@@ -125,7 +125,8 @@
*/
static MagickBooleanType
IsMimeCacheInstantiated(ExceptionInfo *),
- LoadMimeCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadMimeCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -138,8 +139,8 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% AcquireMimeCache() caches one or more magic configurations which provides a
-% mapping between magic attributes and a magic name.
+% AcquireMimeCache() caches one or more magic configurations which provides
+% a mapping between magic attributes and a magic name.
%
% The format of the AcquireMimeCache method is:
%
@@ -178,15 +179,15 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadMimeCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadMimeCache(mime_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
}
#endif
if (IsLinkedListEmpty(mime_cache) != MagickFalse)
- status&=LoadMimeCache(MimeMap,"built-in",0,exception);
+ status&=LoadMimeCache(mime_cache,MimeMap,"built-in",0,exception);
return(mime_cache);
}
@@ -774,8 +775,9 @@
%
% The format of the LoadMimeCache method is:
%
-% MagickBooleanType LoadMimeCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadMimeCache(LinkedListInfo *mime_cache,
+% const char *xml,const char *filename,const size_t depth,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -788,8 +790,9 @@
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadMimeCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadMimeCache(LinkedListInfo *mime_cache,
+ const char *xml,const char *filename,const size_t depth,
+ ExceptionInfo *exception)
{
const char
*attribute;
@@ -812,16 +815,6 @@
"Loading mime map \"%s\" ...",filename);
if (xml == (const char *) NULL)
return(MagickFalse);
- if (mime_cache == (LinkedListInfo *) NULL)
- {
- mime_cache=NewLinkedList(0);
- if (mime_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
mime_map=NewXMLTree(xml,exception);
if (mime_map == (XMLTreeInfo *) NULL)
return(MagickFalse);
@@ -855,7 +848,7 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadMimeCache(xml,path,depth+1,exception);
+ status&=LoadMimeCache(mime_cache,xml,path,depth+1,exception);
xml=DestroyString(xml);
}
}
diff --git a/MagickCore/policy.c b/MagickCore/policy.c
index 6db2320..4dfd099 100644
--- a/MagickCore/policy.c
+++ b/MagickCore/policy.c
@@ -131,7 +131,8 @@
*/
static MagickBooleanType
IsPolicyCacheInstantiated(ExceptionInfo *),
- LoadPolicyCache(const char *,const char *,const size_t,ExceptionInfo *);
+ LoadPolicyCache(LinkedListInfo *,const char *,const char *,const size_t,
+ ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -186,8 +187,8 @@
option=(const StringInfo *) GetNextValueInLinkedList(options);
while (option != (const StringInfo *) NULL)
{
- status&=LoadPolicyCache((const char *) GetStringInfoDatum(option),
- GetStringInfoPath(option),0,exception);
+ status&=LoadPolicyCache(policy_cache,(const char *)
+ GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
option=(const StringInfo *) GetNextValueInLinkedList(options);
}
options=DestroyConfigureOptions(options);
@@ -715,8 +716,9 @@
%
% The format of the LoadPolicyCache method is:
%
-% MagickBooleanType LoadPolicyCache(const char *xml,const char *filename,
-% const size_t depth,ExceptionInfo *exception)
+% MagickBooleanType LoadPolicyCache(LinkedListInfo *policy_cache,
+% const char *xml,const char *filename,const size_t depth,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -729,8 +731,9 @@
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType LoadPolicyCache(const char *xml,const char *filename,
- const size_t depth,ExceptionInfo *exception)
+static MagickBooleanType LoadPolicyCache(LinkedListInfo *policy_cache,
+ const char *xml,const char *filename,const size_t depth,
+ ExceptionInfo *exception)
{
char
keyword[MaxTextExtent],
@@ -752,16 +755,6 @@
"Loading policy file \"%s\" ...",filename);
if (xml == (char *) NULL)
return(MagickFalse);
- if (policy_cache == (LinkedListInfo *) NULL)
- {
- policy_cache=NewLinkedList(0);
- if (policy_cache == (LinkedListInfo *) NULL)
- {
- ThrowFileException(exception,ResourceLimitError,
- "MemoryAllocationFailed",filename);
- return(MagickFalse);
- }
- }
status=MagickTrue;
policy_info=(PolicyInfo *) NULL;
token=AcquireString(xml);
@@ -826,7 +819,8 @@
xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
- status=LoadPolicyCache(xml,path,depth+1,exception);
+ status&=LoadPolicyCache(policy_cache,xml,path,depth+1,
+ exception);
xml=(char *) RelinquishMagickMemory(xml);
}
}