]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/log.c
The 8bim profile will be updated when the iptc profile is changed.
[imagemagick] / MagickCore / log.c
index c7b3051ec77735d4c26fd608e210c5613de918d2..8c6d859c22236059dd8d631d568e51886feff460 100644 (file)
@@ -63,6 +63,7 @@
 #include "MagickCore/utility-private.h"
 #include "MagickCore/version.h"
 #include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
 \f
 /*
   Define declarations.
@@ -198,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
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -253,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);
   }
@@ -612,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:
 %
@@ -741,6 +743,8 @@ MagickExport MagickBooleanType ListLogInfo(FILE *file,ExceptionInfo *exception)
           size_t
             mask;
 
+          if (LogHandlers[j].name == (const char *) NULL)
+            break;
           mask=1;
           mask<<=j;
           if ((log_info[i]->handler_mask & mask) != 0)
@@ -796,7 +800,8 @@ MagickPrivate MagickBooleanType LogComponentGenesis(void)
   ExceptionInfo
     *exception;
 
-  log_semaphore=AcquireSemaphoreInfo();
+  if (log_semaphore == (SemaphoreInfo *) NULL)
+    log_semaphore=AcquireSemaphoreInfo();
   exception=AcquireExceptionInfo();
   (void) GetLogInfo("*",exception);
   exception=DestroyExceptionInfo(exception);
@@ -1324,7 +1329,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)
@@ -1379,8 +1384,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:
 %
@@ -1393,8 +1398,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],
@@ -1414,16 +1419,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'; )
@@ -1484,10 +1479,11 @@ static MagickBooleanType LoadLogCache(const char *xml,const char *filename,
                     (void) CopyMagickString(path,token,MaxTextExtent);
                   else
                     (void) ConcatenateMagickString(path,token,MaxTextExtent);
-                  xml=FileToString(path,~0UL,exception);
+                  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);
                     }
                 }