]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 18 Mar 2014 12:10:55 +0000 (12:10 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 18 Mar 2014 12:10:55 +0000 (12:10 +0000)
13 files changed:
MagickCore/coder.c
MagickCore/color.c
MagickCore/configure.c
MagickCore/delegate.c
MagickCore/locale.c
MagickCore/log.c
MagickCore/magic.c
MagickCore/magick.c
MagickCore/mime.c
MagickCore/policy.c
coders/jp2.c
coders/jpeg.c
coders/tiff.c

index b5d29d88d8c4fd6a12897c4c555126092323ea9a..abf84acf6300e0a6178ce6fa32530442da481ff7 100644 (file)
@@ -320,8 +320,8 @@ static SplayTreeInfo *AcquireCoderCache(const char *filename,
   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 @@ MagickExport char **GetCoderList(const char *pattern,
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  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 @@ static MagickBooleanType IsCoderTreeInstantiated(ExceptionInfo *exception)
         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);
index 672e5686324cf8e1eb8d876ab3cc25d32635f5f0..3c21b09b14d3e8bb479031aeb784274da25c3470 100644 (file)
@@ -796,7 +796,8 @@ static SemaphoreInfo
 */
 static MagickBooleanType
   IsColorCacheInstantiated(ExceptionInfo *),
-  LoadColorCache(const char *,const char *,const size_t,ExceptionInfo *);
+  LoadColorCache(LinkedListInfo *,const char *,const char *,const size_t,
+    ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -851,8 +852,8 @@ static LinkedListInfo *AcquireColorCache(const char *filename,
   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 @@ MagickExport const ColorInfo *GetColorCompliance(const char *name,
     *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 @@ MagickExport MagickBooleanType ListColorInfo(FILE *file,
 %
 %  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 @@ MagickExport MagickBooleanType ListColorInfo(FILE *file,
 %    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 @@ static MagickBooleanType LoadColorCache(const char *xml,const char *filename,
     "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 @@ static MagickBooleanType LoadColorCache(const char *xml,const char *filename,
                   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);
                     }
                 }
index 0ce41603e012a2665aaf44b96b97659e50b60c04..9f1915132d16368c98174a620412dbb2604815fb 100644 (file)
@@ -118,7 +118,8 @@ static SemaphoreInfo
 */
 static MagickBooleanType
   IsConfigureCacheInstantiated(ExceptionInfo *),
-  LoadConfigureCache(const char *,const char *,const size_t,ExceptionInfo *);
+  LoadConfigureCache(LinkedListInfo *,const char *,const char *,const size_t,
+    ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -131,7 +132,7 @@ static MagickBooleanType
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  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 @@ static LinkedListInfo *AcquireConfigureCache(const char *filename,
   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 @@ MagickExport MagickBooleanType ListConfigureInfo(FILE *file,
     (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);
 }
 \f
@@ -1103,8 +1104,8 @@ MagickExport MagickBooleanType ListConfigureInfo(FILE *file,
 %
 %  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 @@ MagickExport MagickBooleanType ListConfigureInfo(FILE *file,
 %    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 @@ static MagickBooleanType LoadConfigureCache(const char *xml,const char *filename
   */
   (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 @@ static MagickBooleanType LoadConfigureCache(const char *xml,const char *filename
                   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);
                     }
                 }
index 160a842de9a15474971a4f3a7a085c6499142b3d..0df9dd579cb8e1907f37e112b0edf9b929062fc0 100644 (file)
@@ -140,7 +140,8 @@ static SemaphoreInfo
 */
 static MagickBooleanType
   IsDelegateCacheInstantiated(ExceptionInfo *),
-  LoadDelegateCache(const char *,const char *,const size_t,ExceptionInfo *);
+  LoadDelegateCache(LinkedListInfo *,const char *,const char *,const size_t,
+    ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -193,15 +194,16 @@ static LinkedListInfo *AcquireDelegateCache(const char *filename,
     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);
 }
 \f
@@ -432,9 +434,8 @@ MagickExport const DelegateInfo *GetDelegateInfo(const char *decode,
     *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 @@ MagickExport MagickBooleanType ListDelegateInfo(FILE *file,
 %
 %  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 @@ MagickExport MagickBooleanType ListDelegateInfo(FILE *file,
 %    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 @@ static MagickBooleanType LoadDelegateCache(const char *xml,const char *filename,
     "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 @@ static MagickBooleanType LoadDelegateCache(const char *xml,const char *filename,
                   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);
                     }
                 }
index 65557fdc55c65d22922bf2514710a5e524a92768..02626ea6f35680592b06090e9491abe9276fe3f0 100644 (file)
@@ -106,8 +106,8 @@ static volatile locale_t
 */
 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 *);
 \f
 #if defined(MAGICKCORE_HAVE_STRTOD_L)
 /*
@@ -212,8 +212,9 @@ static SplayTreeInfo *AcquireLocaleSplayTree(const char *filename,
     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 @@ static SplayTreeInfo *AcquireLocaleSplayTree(const char *filename,
         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 @@ static SplayTreeInfo *AcquireLocaleSplayTree(const char *filename,
   }
 #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);
 }
 \f
@@ -910,35 +913,38 @@ MagickExport const char *GetLocaleValue(const LocaleInfo *locale_info)
 */
 static MagickBooleanType IsLocaleTreeInstantiated(ExceptionInfo *exception)
 {
-  if (locale_semaphore == (SemaphoreInfo *) NULL)
-    ActivateSemaphoreInfo(&locale_semaphore);
-  LockSemaphoreInfo(locale_semaphore);
   if (locale_cache == (SplayTreeInfo *) NULL)
     {
-      char
-        *locale;
-
-      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);
+      if (locale_semaphore == (SemaphoreInfo *) NULL)
+        ActivateSemaphoreInfo(&locale_semaphore);
+      LockSemaphoreInfo(locale_semaphore);
+      if (locale_cache == (SplayTreeInfo *) NULL)
+        {
+          char
+            *locale;
+
+          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);
+        }
+      UnlockSemaphoreInfo(locale_semaphore);
     }
-  UnlockSemaphoreInfo(locale_semaphore);
   return(locale_cache != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1090,8 +1096,9 @@ MagickExport MagickBooleanType ListLocaleInfo(FILE *file,
 %
 %  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 @@ static inline size_t MagickMin(const size_t x,const size_t y)
   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 @@ static MagickBooleanType LoadLocaleCache(const char *xml,const char *filename,
     "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 @@ static MagickBooleanType LoadLocaleCache(const char *xml,const char *filename,
                   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);
                     }
                 }
index 457ff115dc31c7335e283db9591c85f19167f0f3..9a7739f60962fe09f2a629fc16ccfd11493491ca 100644 (file)
@@ -199,7 +199,8 @@ static LogInfo
 
 static MagickBooleanType
   IsLogCacheInstantiated(ExceptionInfo *),
-  LoadLogCache(const char *,const char *,const size_t,ExceptionInfo *);
+  LoadLogCache(LinkedListInfo *,const char *,const char *,const size_t,
+    ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -254,7 +255,7 @@ static LinkedListInfo *AcquireLogCache(const char *filename,
   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 @@ MagickExport const char *GetLogName(void)
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  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 @@ MagickBooleanType LogMagickEventList(const LogEventType type,const char *module,
               "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 @@ MagickBooleanType LogMagickEvent(const LogEventType type,const char *module,
 %
 %  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 @@ MagickBooleanType LogMagickEvent(const LogEventType type,const char *module,
 %    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 @@ static MagickBooleanType LoadLogCache(const char *xml,const char *filename,
   */
   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 @@ static MagickBooleanType LoadLogCache(const char *xml,const char *filename,
                   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);
                     }
                 }
index 39402b3764f07d7c147f7ed59b47bd044fef03be..44db99092c7002180f56229b8726e7a68b07fbd7 100644 (file)
@@ -215,7 +215,8 @@ static SemaphoreInfo
 */
 static MagickBooleanType
   IsMagicCacheInstantiated(ExceptionInfo *),
-  LoadMagicCache(const char *,const char *,const size_t,ExceptionInfo *);
+  LoadMagicCache(LinkedListInfo *,const char *,const char *,const size_t,
+    ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -275,8 +276,8 @@ static LinkedListInfo *AcquireMagicCache(const char *filename,
   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 @@ MagickExport MagickBooleanType ListMagicInfo(FILE *file,
 %
 %  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 @@ MagickExport MagickBooleanType ListMagicInfo(FILE *file,
 %    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 @@ static MagickBooleanType LoadMagicCache(const char *xml,const char *filename,
     "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 @@ static MagickBooleanType LoadMagicCache(const char *xml,const char *filename,
                   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);
                     }
                 }
index d06d9daaa4b218c970ad0d307af1e1f4293bbfd6..b5d6c58d09868b667d4f21c3b6d2627ff8fb2a9b 100644 (file)
@@ -1444,6 +1444,8 @@ MagickExport MagickInfo *RegisterMagickInfo(MagickInfo *magick_info)
   (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");
index 981ede4c68f3760e4e9025311133e700f0eae7e0..ca0f6425c6bbf98eb50c04e2f1ccca78fb10d0cd 100644 (file)
@@ -125,7 +125,8 @@ static SemaphoreInfo
 */
 static MagickBooleanType
   IsMimeCacheInstantiated(ExceptionInfo *),
-  LoadMimeCache(const char *,const char *,const size_t,ExceptionInfo *);
+  LoadMimeCache(LinkedListInfo *,const char *,const char *,const size_t,
+    ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -138,8 +139,8 @@ static MagickBooleanType
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  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
+%  mapping between magic attributes and a magic name.
 %
 %  The format of the AcquireMimeCache method is:
 %
@@ -178,15 +179,15 @@ MagickExport LinkedListInfo *AcquireMimeCache(const char *filename,
     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);
 }
 \f
@@ -774,8 +775,9 @@ MagickExport MagickBooleanType ListMimeInfo(FILE *file,ExceptionInfo *exception)
 %
 %  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 @@ MagickExport MagickBooleanType ListMimeInfo(FILE *file,ExceptionInfo *exception)
 %    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 @@ static MagickBooleanType LoadMimeCache(const char *xml,const char *filename,
     "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 @@ static MagickBooleanType LoadMimeCache(const char *xml,const char *filename,
             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);
               }
           }
index 6db2320823f2ce00e10d5b257a727e2f5fac93bb..4dfd099fc938367330f4e40e28b541a2027f71f1 100644 (file)
@@ -131,7 +131,8 @@ static SemaphoreInfo
 */
 static MagickBooleanType
   IsPolicyCacheInstantiated(ExceptionInfo *),
-  LoadPolicyCache(const char *,const char *,const size_t,ExceptionInfo *);
+  LoadPolicyCache(LinkedListInfo *,const char *,const char *,const size_t,
+    ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -186,8 +187,8 @@ static LinkedListInfo *AcquirePolicyCache(const char *filename,
   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 @@ MagickExport MagickBooleanType ListPolicyInfo(FILE *file,
 %
 %  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 @@ MagickExport MagickBooleanType ListPolicyInfo(FILE *file,
 %    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 @@ static MagickBooleanType LoadPolicyCache(const char *xml,const char *filename,
     "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 @@ static MagickBooleanType LoadPolicyCache(const char *xml,const char *filename,
                   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);
                     }
                 }
index 4fbdf60b3a653ebebf655232218f6e00b3647ed2..effdd9e2a7a9910179e00b514dcb361c7a1fb12d 100644 (file)
@@ -536,7 +536,6 @@ ModuleExport size_t RegisterJP2Image(void)
   entry->adjoin=MagickFalse;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJP2Image;
   entry->encoder=(EncodeImageHandler *) WriteJP2Image;
@@ -552,7 +551,6 @@ ModuleExport size_t RegisterJP2Image(void)
   entry->adjoin=MagickFalse;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJP2Image;
   entry->encoder=(EncodeImageHandler *) WriteJP2Image;
@@ -568,7 +566,6 @@ ModuleExport size_t RegisterJP2Image(void)
   entry->adjoin=MagickFalse;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJP2Image;
   entry->encoder=(EncodeImageHandler *) WriteJP2Image;
@@ -584,7 +581,6 @@ ModuleExport size_t RegisterJP2Image(void)
   entry->adjoin=MagickFalse;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJP2Image;
   entry->encoder=(EncodeImageHandler *) WriteJP2Image;
@@ -600,7 +596,6 @@ ModuleExport size_t RegisterJP2Image(void)
   entry->adjoin=MagickFalse;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJP2Image;
   entry->encoder=(EncodeImageHandler *) WriteJP2Image;
index 4387d6e419c0d49c56561d83a9c901570c3fad70..bbf3a838106f734aeaee5f6c5ac33c563e7c23a7 100644 (file)
@@ -1506,7 +1506,6 @@ ModuleExport size_t RegisterJPEGImage(void)
 #endif
   entry=SetMagickInfo("JPEG");
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_JPEG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJPEGImage;
   entry->encoder=(EncodeImageHandler *) WriteJPEGImage;
@@ -1521,7 +1520,6 @@ ModuleExport size_t RegisterJPEGImage(void)
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("JPG");
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_JPEG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJPEGImage;
   entry->encoder=(EncodeImageHandler *) WriteJPEGImage;
@@ -1535,7 +1533,6 @@ ModuleExport size_t RegisterJPEGImage(void)
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("PJPEG");
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
 #if defined(MAGICKCORE_JPEG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJPEGImage;
   entry->encoder=(EncodeImageHandler *) WriteJPEGImage;
index 4270ea07c9a8a69f6117529ba7d88940448f5af3..d2e4f563c873ccb7917f9066bd42e9143069d9b1 100644 (file)
@@ -1983,7 +1983,6 @@ ModuleExport size_t RegisterTIFFImage(void)
   entry->format_type=ImplicitFormatType;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
   entry->description=ConstantString("Raw CCITT Group4");
   entry->mime_type=ConstantString("image/tiff");
   entry->module=ConstantString("TIFF");
@@ -1996,7 +1995,6 @@ ModuleExport size_t RegisterTIFFImage(void)
   entry->endian_support=MagickTrue;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
   entry->description=ConstantString("Pyramid encoded TIFF");
   entry->mime_type=ConstantString("image/tiff");
   entry->module=ConstantString("TIFF");
@@ -2010,7 +2008,6 @@ ModuleExport size_t RegisterTIFFImage(void)
   entry->seekable_stream=MagickTrue;
   entry->stealth=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
   entry->description=ConstantString(TIFFDescription);
   if (*version != '\0')
     entry->version=ConstantString(version);
@@ -2026,7 +2023,6 @@ ModuleExport size_t RegisterTIFFImage(void)
   entry->endian_support=MagickTrue;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
   entry->description=ConstantString(TIFFDescription);
   if (*version != '\0')
     entry->version=ConstantString(version);
@@ -2042,7 +2038,6 @@ ModuleExport size_t RegisterTIFFImage(void)
   entry->endian_support=MagickTrue;
   entry->seekable_stream=MagickTrue;
   entry->thread_support=NoThreadSupport;
-  entry->semaphore=AcquireSemaphoreInfo();
   entry->description=ConstantString("Tagged Image File Format (64-bit)");
   if (*version != '\0')
     entry->version=ConstantString(version);