]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <mikayla-grace@urban-warrior.org>
Tue, 19 Mar 2019 00:26:56 +0000 (20:26 -0400)
committerCristy <mikayla-grace@urban-warrior.org>
Tue, 19 Mar 2019 00:26:56 +0000 (20:26 -0400)
MagickCore/cache.c
MagickCore/exception-private.h
MagickCore/exception.c
MagickCore/magick.c

index 64db93696b748c2f0724e8234dabe48b0dc08cb6..fc67bb46a7449c13dd70af7547ca66a51bafd97d 100644 (file)
@@ -137,7 +137,7 @@ static Quantum
     const size_t,ExceptionInfo *),
   *SetPixelCacheNexusPixels(const CacheInfo *,const MapMode,const ssize_t,
     const ssize_t,const size_t,const size_t,const MagickBooleanType,
-    NexusInfo *,ExceptionInfo *) magick_hot_spot;
+    NexusInfo *magick_restrict,ExceptionInfo *) magick_hot_spot;
 
 #if defined(MAGICKCORE_OPENCL_SUPPORT)
 static void
@@ -4916,7 +4916,7 @@ MagickPrivate void SetPixelCacheMethods(Cache cache,CacheMethods *cache_methods)
 %      Quantum SetPixelCacheNexusPixels(const CacheInfo *cache_info,
 %        const MapMode mode,const ssize_t x,const ssize_t y,const size_t width,
 %        const size_t height,const MagickBooleanType buffered,
-%        NexusInfo *nexus_info,ExceptionInfo *exception)
+%        NexusInfo *magick_restrict nexus_info,ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -4936,7 +4936,7 @@ MagickPrivate void SetPixelCacheMethods(Cache cache,CacheMethods *cache_methods)
 
 static inline MagickBooleanType AcquireCacheNexusPixels(
   const CacheInfo *magick_restrict cache_info,const MagickSizeType length,
-  NexusInfo *nexus_info,ExceptionInfo *exception)
+  NexusInfo *magick_restrict nexus_info,ExceptionInfo *exception)
 {
   if (length != (MagickSizeType) ((size_t) length))
     {
index e6b32314e8e67f1a0dd302d1e1a46cb8c5627b40..12e99d480f580ad4f11aa7df62a48c8fe6711c0d 100644 (file)
@@ -92,6 +92,12 @@ extern "C" {
 extern MagickPrivate void
   InitializeExceptionInfo(ExceptionInfo *);
 
+extern MagickPrivate MagickBooleanType
+  ExceptionComponentGenesis(void);
+
+extern MagickPrivate void
+  ExceptionComponentTerminus(void);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
index e7d4d5a92cd8148f4443047a7cd9de870184fa60..414233ce39641dc2c719d7cd5c3c528acba56728 100644 (file)
@@ -50,6 +50,7 @@
 #include "MagickCore/magick.h"
 #include "MagickCore/memory_.h"
 #include "MagickCore/memory-private.h"
+#include "MagickCore/semaphore.h"
 #include "MagickCore/string_.h"
 #include "MagickCore/utility.h"
 #include "MagickCore/utility-private.h"
@@ -87,6 +88,12 @@ static FatalErrorHandler
 static WarningHandler
   warning_handler = DefaultWarningHandler;
 \f
+/*
+  Static declarations.
+*/
+static SemaphoreInfo
+  *exception_semaphore = (SemaphoreInfo *) NULL;
+\f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                             %
@@ -445,6 +452,58 @@ MagickExport ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception)
 %                                                                             %
 %                                                                             %
 %                                                                             %
++   E x e c e p t i o n C o m p o n e n t G e n e s i s                       %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  ExceptionComponentGenesis() instantiates the exception component.
+%
+%  The format of the ExceptionComponentGenesis method is:
+%
+%      MagickBooleanType ExceptionComponentGenesis(void)
+%
+*/
+MagickPrivate MagickBooleanType ExceptionComponentGenesis(void)
+{
+  if (exception_semaphore == (SemaphoreInfo *) NULL)
+    exception_semaphore=AcquireSemaphoreInfo();
+  return(MagickTrue);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
++   E x c e p t i o n C o m p o n e n t T e r m i n u s                       %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  ExceptionComponentTerminus() destroys the exception component.
+%
+%  The format of the ExceptionComponentTerminus method is:
+%
+%      void ExceptionComponentTerminus(void)
+%
+*/
+MagickPrivate void ExceptionComponentTerminus(void)
+{
+  if (exception_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&exception_semaphore);
+  LockSemaphoreInfo(exception_semaphore);
+  UnlockSemaphoreInfo(exception_semaphore);
+  RelinquishSemaphoreInfo(&exception_semaphore);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   G e t E x c e p t i o n M e s s a g e                                     %
 %                                                                             %
 %                                                                             %
@@ -816,8 +875,12 @@ MagickExport ErrorHandler SetErrorHandler(ErrorHandler handler)
   ErrorHandler
     previous_handler;
 
+  if (exception_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&exception_semaphore);
+  LockSemaphoreInfo(exception_semaphore);
   previous_handler=error_handler;
   error_handler=handler;
+  UnlockSemaphoreInfo(exception_semaphore);
   return(previous_handler);
 }
 \f
@@ -849,8 +912,12 @@ MagickExport FatalErrorHandler SetFatalErrorHandler(FatalErrorHandler handler)
   FatalErrorHandler
     previous_handler;
 
+  if (exception_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&exception_semaphore);
+  LockSemaphoreInfo(exception_semaphore);
   previous_handler=fatal_error_handler;
   fatal_error_handler=handler;
+  UnlockSemaphoreInfo(exception_semaphore);
   return(previous_handler);
 }
 \f
@@ -882,8 +949,12 @@ MagickExport WarningHandler SetWarningHandler(WarningHandler handler)
   WarningHandler
     previous_handler;
 
+  if (exception_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&exception_semaphore);
+  LockSemaphoreInfo(exception_semaphore);
   previous_handler=warning_handler;
   warning_handler=handler;
+  UnlockSemaphoreInfo(exception_semaphore);
   return(previous_handler);
 }
 \f
index 9951a95892fbf1aefe69bcc075ac02c25026e65a..ce7bb9b9f0ea3551afd16b0529c69f073480d681 100644 (file)
@@ -1435,6 +1435,7 @@ MagickExport void MagickCoreGenesis(const char *path,
       return;
     }
   (void) SemaphoreComponentGenesis();
+  (void) ExceptionComponentGenesis();
   (void) LogComponentGenesis();
   (void) LocaleComponentGenesis();
   (void) RandomComponentGenesis();
@@ -1601,6 +1602,7 @@ MagickExport void MagickCoreTerminus(void)
   RandomComponentTerminus();
   LocaleComponentTerminus();
   LogComponentTerminus();
+  ExceptionComponentTerminus();
   instantiate_magickcore=MagickFalse;
   UnlockMagickMutex();
   SemaphoreComponentTerminus();