]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 15 Mar 2014 17:38:05 +0000 (17:38 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 15 Mar 2014 17:38:05 +0000 (17:38 +0000)
14 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/module.c
MagickCore/policy.c
MagickCore/registry.c
MagickCore/semaphore.c
MagickCore/type.c

index 7eafc13e167981c8366485a11ac2ea6da2420de3..6736d8105121331509bf9c7dc6a97d5afc83914c 100644 (file)
@@ -235,9 +235,6 @@ static SemaphoreInfo
 
 static SplayTreeInfo
   *coder_list = (SplayTreeInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_coder = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -295,7 +292,6 @@ MagickPrivate void CoderComponentTerminus(void)
   LockSemaphoreInfo(coder_semaphore);
   if (coder_list != (SplayTreeInfo *) NULL)
     coder_list=DestroySplayTree(coder_list);
-  instantiate_coder=MagickFalse;
   UnlockSemaphoreInfo(coder_semaphore);
   RelinquishSemaphoreInfo(&coder_semaphore);
 }
@@ -329,13 +325,9 @@ MagickExport const CoderInfo *GetCoderInfo(const char *name,
   ExceptionInfo *exception)
 {
   assert(exception != (ExceptionInfo *) NULL);
-  if ((coder_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_coder == MagickFalse))
+  if (coder_list == (SplayTreeInfo *) NULL)
     if (InitializeCoderList(exception) == MagickFalse)
       return((const CoderInfo *) NULL);
-  if ((coder_list == (SplayTreeInfo *) NULL) ||
-      (GetNumberOfNodesInSplayTree(coder_list) == 0))
-    return((const CoderInfo *) NULL);
   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
     {
       ResetSplayTreeIterator(coder_list);
@@ -539,20 +531,12 @@ MagickExport char **GetCoderList(const char *pattern,
 */
 static MagickBooleanType InitializeCoderList(ExceptionInfo *exception)
 {
-  if ((coder_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_coder == MagickFalse))
-    {
-      if (coder_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&coder_semaphore);
-      LockSemaphoreInfo(coder_semaphore);
-      if ((coder_list == (SplayTreeInfo *) NULL) ||
-          (instantiate_coder == MagickFalse))
-        {
-          (void) LoadCoderLists(MagickCoderFilename,exception);
-          instantiate_coder=MagickTrue;
-        }
-      UnlockSemaphoreInfo(coder_semaphore);
-    }
+  if (coder_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&coder_semaphore);
+  LockSemaphoreInfo(coder_semaphore);
+  if (coder_list == (SplayTreeInfo *) NULL)
+    (void) LoadCoderLists(MagickCoderFilename,exception);
+  UnlockSemaphoreInfo(coder_semaphore);
   return(coder_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
index 0c5f2c6acc697c2954caa77b3326281d2ff642e5..80eb10ac4e48010a2a3a1d2935806813e2e6a6eb 100644 (file)
@@ -789,9 +789,6 @@ static LinkedListInfo
 
 static SemaphoreInfo
   *color_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_color = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -867,7 +864,6 @@ MagickPrivate void ColorComponentTerminus(void)
   LockSemaphoreInfo(color_semaphore);
   if (color_list != (LinkedListInfo *) NULL)
     color_list=DestroyLinkedList(color_list,DestroyColorElement);
-  instantiate_color=MagickFalse;
   UnlockSemaphoreInfo(color_semaphore);
   RelinquishSemaphoreInfo(&color_semaphore);
 }
@@ -913,13 +909,9 @@ MagickExport const ColorInfo *GetColorCompliance(const char *name,
     *q;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((color_list == (LinkedListInfo *) NULL) ||
-       IfMagickFalse(instantiate_color))
+  if (color_list == (LinkedListInfo *) NULL)
     if (IfMagickFalse(InitializeColorList(exception)))
       return((const ColorInfo *) NULL);
-  if ((color_list == (LinkedListInfo *) NULL) ||
-      IfMagickTrue(IsLinkedListEmpty(color_list)))
-    return((const ColorInfo *) NULL);
   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
     return((const ColorInfo *) GetValueFromLinkedList(color_list,0));
   /*
@@ -1515,20 +1507,12 @@ MagickExport void GetColorTuple(const PixelInfo *pixel,
 */
 static MagickBooleanType InitializeColorList(ExceptionInfo *exception)
 {
-  if ((color_list == (LinkedListInfo *) NULL) ||
-      IfMagickFalse(instantiate_color))
-    {
-      if (color_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&color_semaphore);
-      LockSemaphoreInfo(color_semaphore);
-      if ((color_list == (LinkedListInfo *) NULL) ||
-          IfMagickFalse(instantiate_color))
-        {
-          (void) LoadColorLists(ColorFilename,exception);
-          instantiate_color=MagickTrue;
-        }
-      UnlockSemaphoreInfo(color_semaphore);
-    }
+  if (color_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&color_semaphore);
+  LockSemaphoreInfo(color_semaphore);
+  if (color_list == (LinkedListInfo *) NULL)
+    (void) LoadColorLists(ColorFilename,exception);
+  UnlockSemaphoreInfo(color_semaphore);
   return(color_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
index 6e974965526f508bfe64a38fafe405737aaf6303..0a74ab5299ca2fafd25373200b22add526bfdebe 100644 (file)
@@ -111,9 +111,6 @@ static LinkedListInfo
 
 static SemaphoreInfo
   *configure_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_configure = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -192,7 +189,6 @@ MagickPrivate void ConfigureComponentTerminus(void)
   if (configure_list != (LinkedListInfo *) NULL)
     configure_list=DestroyLinkedList(configure_list,DestroyConfigureElement);
   configure_list=(LinkedListInfo *) NULL;
-  instantiate_configure=MagickFalse;
   UnlockSemaphoreInfo(configure_semaphore);
   RelinquishSemaphoreInfo(&configure_semaphore);
 }
@@ -269,13 +265,9 @@ MagickExport const ConfigureInfo *GetConfigureInfo(const char *name,
     *p;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((configure_list == (LinkedListInfo *) NULL) ||
-      (instantiate_configure == MagickFalse))
+  if (configure_list == (LinkedListInfo *) NULL)
     if (InitializeConfigureList(exception) == MagickFalse)
       return((const ConfigureInfo *) NULL);
-  if ((configure_list == (LinkedListInfo *) NULL) ||
-      (IsLinkedListEmpty(configure_list) != MagickFalse))
-    return((const ConfigureInfo *) NULL);
   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
     return((const ConfigureInfo *) GetValueFromLinkedList(configure_list,0));
   /*
@@ -902,20 +894,12 @@ MagickExport const char *GetConfigureValue(const ConfigureInfo *configure_info)
 */
 static MagickBooleanType InitializeConfigureList(ExceptionInfo *exception)
 {
-  if ((configure_list == (LinkedListInfo *) NULL) ||
-      (instantiate_configure == MagickFalse))
-    {
-      if (configure_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&configure_semaphore);
-      LockSemaphoreInfo(configure_semaphore);
-      if ((configure_list == (LinkedListInfo *) NULL) ||
-          (instantiate_configure == MagickFalse))
-        {
-          (void) LoadConfigureLists(ConfigureFilename,exception);
-          instantiate_configure=MagickTrue;
-        }
-      UnlockSemaphoreInfo(configure_semaphore);
-    }
+  if (configure_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&configure_semaphore);
+  LockSemaphoreInfo(configure_semaphore);
+  if (configure_list == (LinkedListInfo *) NULL)
+    (void) LoadConfigureLists(ConfigureFilename,exception);
+  UnlockSemaphoreInfo(configure_semaphore);
   return(configure_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
index 890468be8810070db698067327cd56d182be6f57..14067c90046fefcc7e0eb5f3d245274c69b2efe1 100644 (file)
@@ -133,9 +133,6 @@ static LinkedListInfo
 
 static SemaphoreInfo
   *delegate_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_delegate = MagickFalse;
 \f
 /*
   Forward declaractions.
@@ -212,7 +209,6 @@ MagickPrivate void DelegateComponentTerminus(void)
   LockSemaphoreInfo(delegate_semaphore);
   if (delegate_list != (LinkedListInfo *) NULL)
     delegate_list=DestroyLinkedList(delegate_list,DestroyDelegate);
-  instantiate_delegate=MagickFalse;
   UnlockSemaphoreInfo(delegate_semaphore);
   RelinquishSemaphoreInfo(&delegate_semaphore);
 }
@@ -370,13 +366,9 @@ MagickExport const DelegateInfo *GetDelegateInfo(const char *decode,
     *p;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((delegate_list == (LinkedListInfo *) NULL) ||
-      (IfMagickFalse(instantiate_delegate)))
+  if (delegate_list == (LinkedListInfo *) NULL)
     if( IfMagickFalse(InitializeDelegateList(exception)) )
       return((const DelegateInfo *) NULL);
-  if ((delegate_list == (LinkedListInfo *) NULL) ||
-      (IfMagickTrue(IsLinkedListEmpty(delegate_list))))
-    return((const DelegateInfo *) NULL);
   if ((LocaleCompare(decode,"*") == 0) && (LocaleCompare(encode,"*") == 0))
     return((const DelegateInfo *) GetValueFromLinkedList(delegate_list,0));
   /*
@@ -710,20 +702,12 @@ MagickExport MagickBooleanType GetDelegateThreadSupport(
 */
 static MagickBooleanType InitializeDelegateList(ExceptionInfo *exception)
 {
-  if ((delegate_list == (LinkedListInfo *) NULL) ||
-      IfMagickFalse(instantiate_delegate))
-    {
-      if (delegate_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&delegate_semaphore);
-      LockSemaphoreInfo(delegate_semaphore);
-      if ((delegate_list == (LinkedListInfo *) NULL) ||
-          IfMagickFalse(instantiate_delegate))
-        {
-          (void) LoadDelegateLists(DelegateFilename,exception);
-          instantiate_delegate=MagickTrue;
-        }
-      UnlockSemaphoreInfo(delegate_semaphore);
-    }
+  if (delegate_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&delegate_semaphore);
+  LockSemaphoreInfo(delegate_semaphore);
+  if (delegate_list == (LinkedListInfo *) NULL)
+    (void) LoadDelegateLists(DelegateFilename,exception);
+  UnlockSemaphoreInfo(delegate_semaphore);
   return(IsMagickNotNULL(delegate_list));
 }
 \f
index 0f688b09b249591ef9e5106a46c8837bdf7651fd..ba70de648ed9b09ea35149674c09ad4420494c95 100644 (file)
@@ -99,9 +99,6 @@ static SplayTreeInfo
 static volatile locale_t
   c_locale = (locale_t) NULL;
 #endif
-
-static volatile MagickBooleanType
-  instantiate_locale = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -424,13 +421,9 @@ MagickExport const LocaleInfo *GetLocaleInfo_(const char *tag,
   ExceptionInfo *exception)
 {
   assert(exception != (ExceptionInfo *) NULL);
-  if ((locale_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_locale == MagickFalse))
+  if (locale_list == (SplayTreeInfo *) NULL)
     if (InitializeLocaleList(exception) == MagickFalse)
       return((const LocaleInfo *) NULL);
-  if ((locale_list == (SplayTreeInfo *) NULL) ||
-      (GetNumberOfNodesInSplayTree(locale_list) == 0))
-    return((const LocaleInfo *) NULL);
   if ((tag == (const char *) NULL) || (LocaleCompare(tag,"*") == 0))
     {
       ResetSplayTreeIterator(locale_list);
@@ -813,41 +806,35 @@ MagickExport const char *GetLocaleValue(const LocaleInfo *locale_info)
 */
 static MagickBooleanType InitializeLocaleList(ExceptionInfo *exception)
 {
-  if ((locale_list == (SplayTreeInfo *) NULL) &&
-      (instantiate_locale == MagickFalse))
+  if (locale_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&locale_semaphore);
+  LockSemaphoreInfo(locale_semaphore);
+  if (locale_list == (SplayTreeInfo *) NULL)
     {
-      if (locale_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&locale_semaphore);
-      LockSemaphoreInfo(locale_semaphore);
-      if ((locale_list == (SplayTreeInfo *) NULL) ||
-          (instantiate_locale == MagickFalse))
-        {
-          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");
-          (void) LoadLocaleLists(LocaleFilename,locale,exception);
-          locale=DestroyString(locale);
-          instantiate_locale=MagickTrue;
-        }
-      UnlockSemaphoreInfo(locale_semaphore);
+      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");
+      (void) LoadLocaleLists(LocaleFilename,locale,exception);
+      locale=DestroyString(locale);
     }
+  UnlockSemaphoreInfo(locale_semaphore);
   return(locale_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1431,7 +1418,6 @@ MagickPrivate void LocaleComponentTerminus(void)
 #if defined(MAGICKCORE_HAVE_STRTOD_L)
   DestroyCLocale();
 #endif
-  instantiate_locale=MagickFalse;
   UnlockSemaphoreInfo(locale_semaphore);
   RelinquishSemaphoreInfo(&locale_semaphore);
 }
index 022461645d659bdd29e3eb29ac6abd4e7d9efae5..c2f19cd2f80d5459441ed44f4ded091d07354de7 100644 (file)
@@ -185,9 +185,6 @@ static LinkedListInfo
 
 static SemaphoreInfo
   *log_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_log = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -274,12 +271,9 @@ static LogInfo *GetLogInfo(const char *name,ExceptionInfo *exception)
     *p;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((log_list == (LinkedListInfo *) NULL) || (instantiate_log == MagickFalse))
+  if (log_list == (LinkedListInfo *) NULL)
     if (InitializeLogList(exception) == MagickFalse)
       return((LogInfo *) NULL);
-  if ((log_list == (LinkedListInfo *) NULL) ||
-      (IsLinkedListEmpty(log_list) != MagickFalse))
-    return((LogInfo *) NULL);
   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
     return((LogInfo *) GetValueFromLinkedList(log_list,0));
   /*
@@ -535,20 +529,12 @@ MagickExport const char *GetLogName(void)
 */
 static MagickBooleanType InitializeLogList(ExceptionInfo *exception)
 {
-  if ((log_list == (LinkedListInfo *) NULL) &&
-      (instantiate_log == MagickFalse))
-    {
-      if (log_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&log_semaphore);
-      LockSemaphoreInfo(log_semaphore);
-      if ((log_list == (LinkedListInfo *) NULL) ||
-          (instantiate_log == MagickFalse))
-        {
-          (void) LoadLogLists(LogFilename,exception);
-          instantiate_log=MagickTrue;
-        }
-      UnlockSemaphoreInfo(log_semaphore);
-    }
+  if (log_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&log_semaphore);
+  LockSemaphoreInfo(log_semaphore);
+  if (log_list == (LinkedListInfo *) NULL)
+    (void) LoadLogLists(LogFilename,exception);
+  UnlockSemaphoreInfo(log_semaphore);
   return(log_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -765,7 +751,6 @@ MagickPrivate void LogComponentTerminus(void)
   LockSemaphoreInfo(log_semaphore);
   if (log_list != (LinkedListInfo *) NULL)
     log_list=DestroyLinkedList(log_list,DestroyLogElement);
-  instantiate_log=MagickFalse;
   UnlockSemaphoreInfo(log_semaphore);
   RelinquishSemaphoreInfo(&log_semaphore);
 }
index 94846719466af49175a4cd7958a96f3e219fe972..242a4085fd830574474c8f47dffc44bc27de77d7 100644 (file)
@@ -208,9 +208,6 @@ static LinkedListInfo
 
 static SemaphoreInfo
   *magic_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_magic = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -255,13 +252,9 @@ MagickExport const MagicInfo *GetMagicInfo(const unsigned char *magic,
     *p;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((magic_list == (LinkedListInfo *) NULL) ||
-      (instantiate_magic == MagickFalse))
+  if (magic_list == (LinkedListInfo *) NULL)
     if (InitializeMagicList(exception) == MagickFalse)
       return((const MagicInfo *) NULL);
-  if ((magic_list == (LinkedListInfo *) NULL) ||
-      (IsLinkedListEmpty(magic_list) != MagickFalse))
-    return((const MagicInfo *) NULL);
   if (magic == (const unsigned char *) NULL)
     return((const MagicInfo *) GetValueFromLinkedList(magic_list,0));
   if (length == 0)
@@ -529,20 +522,12 @@ MagickExport const char *GetMagicName(const MagicInfo *magic_info)
 */
 static MagickBooleanType InitializeMagicList(ExceptionInfo *exception)
 {
-  if ((magic_list == (LinkedListInfo *) NULL) ||
-      (instantiate_magic == MagickFalse))
-    {
-      if (magic_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&magic_semaphore);
-      LockSemaphoreInfo(magic_semaphore);
-      if ((magic_list == (LinkedListInfo *) NULL) ||
-          (instantiate_magic == MagickFalse))
-        {
-          (void) LoadMagicLists(MagicFilename,exception);
-          instantiate_magic=MagickTrue;
-        }
-      UnlockSemaphoreInfo(magic_semaphore);
-    }
+  if (magic_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&magic_semaphore);
+  LockSemaphoreInfo(magic_semaphore);
+  if (magic_list == (LinkedListInfo *) NULL)
+    (void) LoadMagicLists(MagicFilename,exception);
+  UnlockSemaphoreInfo(magic_semaphore);
   return(magic_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1075,7 +1060,6 @@ MagickPrivate void MagicComponentTerminus(void)
   LockSemaphoreInfo(magic_semaphore);
   if (magic_list != (LinkedListInfo *) NULL)
     magic_list=DestroyLinkedList(magic_list,DestroyMagicElement);
-  instantiate_magic=MagickFalse;
   UnlockSemaphoreInfo(magic_semaphore);
   RelinquishSemaphoreInfo(&magic_semaphore);
 }
index 11c79c23d6bfbed643acec31022d52c429f27f8c..e59d6e92fedbad123c5d77d3f16b0a09b1f4f713 100644 (file)
@@ -121,7 +121,6 @@ static SplayTreeInfo
   *magick_list = (SplayTreeInfo *) NULL;
 
 static volatile MagickBooleanType
-  instantiate_magick = MagickFalse,
   instantiate_magickcore = MagickFalse;
 \f
 /*
@@ -413,8 +412,7 @@ MagickExport const MagickInfo *GetMagickInfo(const char *name,
     *p;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((magick_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_magick == MagickFalse))
+  if (magick_list == (SplayTreeInfo *) NULL)
     if (InitializeMagickList(exception) == MagickFalse)
       return((const MagickInfo *) NULL);
   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
@@ -840,48 +838,39 @@ static void *DestroyMagickNode(void *magick_info)
 static MagickBooleanType InitializeMagickList(ExceptionInfo *exception)
 {
   (void) exception;
-  if ((magick_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_magick == MagickFalse))
+  if (magick_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&magick_semaphore);
+  LockSemaphoreInfo(magick_semaphore);
+  if (magick_list == (SplayTreeInfo *) NULL)
     {
-      if (magick_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&magick_semaphore);
-      LockSemaphoreInfo(magick_semaphore);
-      if ((magick_list == (SplayTreeInfo *) NULL) ||
-          (instantiate_magick == MagickFalse))
-        {
-          MagickBooleanType
-            status;
+      MagickBooleanType
+        status;
 
-          MagickInfo
-            *magick_info;
+      MagickInfo
+        *magick_info;
 
-          magick_list=NewSplayTree(CompareSplayTreeString,
-            (void *(*)(void *)) NULL,DestroyMagickNode);
-          if (magick_list == (SplayTreeInfo *) NULL)
-            ThrowFatalException(ResourceLimitFatalError,
-              "MemoryAllocationFailed");
-          magick_info=SetMagickInfo("ephemeral");
-          magick_info->stealth=MagickTrue;
-          status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
-          if (status == MagickFalse)
-            ThrowFatalException(ResourceLimitFatalError,
-              "MemoryAllocationFailed");
-          magick_info=SetMagickInfo("clipmask");
-          magick_info->stealth=MagickTrue;
-          status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
-          if (status == MagickFalse)
-            ThrowFatalException(ResourceLimitFatalError,
-              "MemoryAllocationFailed");
+      magick_list=NewSplayTree(CompareSplayTreeString,(void *(*)(void *)) NULL,
+        DestroyMagickNode);
+      if (magick_list == (SplayTreeInfo *) NULL)
+        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+      magick_info=SetMagickInfo("ephemeral");
+      magick_info->stealth=MagickTrue;
+      status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
+      if (status == MagickFalse)
+        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+      magick_info=SetMagickInfo("clipmask");
+      magick_info->stealth=MagickTrue;
+      status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
+      if (status == MagickFalse)
+        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
 #if defined(MAGICKCORE_MODULES_SUPPORT)
-          (void) GetModuleInfo((char *) NULL,exception);
+      (void) GetModuleInfo((char *) NULL,exception);
 #endif
 #if !defined(MAGICKCORE_BUILD_MODULES)
-          RegisterStaticModules();
+      RegisterStaticModules();
 #endif
-          instantiate_magick=MagickTrue;
-        }
-      UnlockSemaphoreInfo(magick_semaphore);
     }
+  UnlockSemaphoreInfo(magick_semaphore);
   return(magick_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1104,7 +1093,6 @@ MagickPrivate void MagickComponentTerminus(void)
   LockSemaphoreInfo(magick_semaphore);
   if (magick_list != (SplayTreeInfo *) NULL)
     magick_list=DestroySplayTree(magick_list);
-  instantiate_magick=MagickFalse;
   UnlockSemaphoreInfo(magick_semaphore);
   RelinquishSemaphoreInfo(&magick_semaphore);
 }
@@ -1175,7 +1163,6 @@ static void MagickSignalHandler(int signal_number)
   (void) signal(signal_number,SIG_IGN);
 #endif
   AsynchronousResourceComponentTerminus();
-  instantiate_magick=MagickFalse;
   (void) SetMagickSignalHandler(signal_number,signal_handlers[signal_number]);
 #if defined(SIGQUIT)
   if (signal_number == SIGQUIT)
index d29a467587352f92eb1e6f6ee97be84e4be1f6ce..7784020419f9feda2c907cb6459f706041bcc6d9 100644 (file)
@@ -119,9 +119,6 @@ static LinkedListInfo
 
 static SemaphoreInfo
   *mime_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_mime = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -187,13 +184,9 @@ MagickExport const MimeInfo *GetMimeInfo(const char *filename,
     value;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((mime_list == (LinkedListInfo *) NULL) ||
-      (instantiate_mime == MagickFalse))
+  if (mime_list == (LinkedListInfo *) NULL)
     if (InitializeMimeList(exception) == MagickFalse)
       return((const MimeInfo *) NULL);
-  if ((mime_list == (LinkedListInfo *) NULL) ||
-      (IsLinkedListEmpty(mime_list) != MagickFalse))
-    return((const MimeInfo *) NULL);
   if ((magic == (const unsigned char *) NULL) || (length == 0))
     return((const MimeInfo *) GetValueFromLinkedList(mime_list,0));
   if (length == 0)
@@ -604,20 +597,12 @@ MagickExport const char *GetMimeType(const MimeInfo *mime_info)
 */
 static MagickBooleanType InitializeMimeList(ExceptionInfo *exception)
 {
-  if ((mime_list == (LinkedListInfo *) NULL) ||
-      (instantiate_mime == MagickFalse))
-    {
-      if (mime_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&mime_semaphore);
-      LockSemaphoreInfo(mime_semaphore);
-      if ((mime_list == (LinkedListInfo *) NULL) ||
-          (instantiate_mime == MagickFalse))
-        {
-          (void) LoadMimeLists(MimeFilename,exception);
-          instantiate_mime=MagickTrue;
-        }
-      UnlockSemaphoreInfo(mime_semaphore);
-    }
+  if (mime_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&mime_semaphore);
+  LockSemaphoreInfo(mime_semaphore);
+  if (mime_list == (LinkedListInfo *) NULL)
+    (void) LoadMimeLists(MimeFilename,exception);
+  UnlockSemaphoreInfo(mime_semaphore);
   return(mime_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1106,7 +1091,6 @@ MagickPrivate void MimeComponentTerminus(void)
   LockSemaphoreInfo(mime_semaphore);
   if (mime_list != (LinkedListInfo *) NULL)
     mime_list=DestroyLinkedList(mime_list,DestroyMimeElement);
-  instantiate_mime=MagickFalse;
   UnlockSemaphoreInfo(mime_semaphore);
   RelinquishSemaphoreInfo(&mime_semaphore);
 }
index bbad260337065b878aaaba1842a89398774bb4ec..c4364b21e008d9fb28ab2c41ac0550b27725d327 100644 (file)
@@ -93,9 +93,6 @@ static SemaphoreInfo
 
 static SplayTreeInfo
   *module_list = (SplayTreeInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_module = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -184,13 +181,6 @@ MagickExport void DestroyModuleList(void)
 #if defined(MAGICKCORE_MODULES_SUPPORT)
   if (module_list != (SplayTreeInfo *) NULL)
     module_list=DestroySplayTree(module_list);
-  if (instantiate_module != MagickFalse)
-    {
-#if !defined(MAGICKCORE_JP2_DELEGATE)
-      (void) lt_dlexit();  /* Jasper has an errant atexit() handler */
-#endif
-      instantiate_module=MagickFalse;
-    }
 #endif
   UnlockSemaphoreInfo(module_semaphore);
 }
@@ -225,13 +215,9 @@ MagickExport void DestroyModuleList(void)
 */
 MagickExport ModuleInfo *GetModuleInfo(const char *tag,ExceptionInfo *exception)
 {
-  if ((module_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_module == MagickFalse))
+  if (module_list == (SplayTreeInfo *) NULL)
     if (InitializeModuleList(exception) == MagickFalse)
       return((ModuleInfo *) NULL);
-  if ((module_list == (SplayTreeInfo *) NULL) ||
-      (GetNumberOfNodesInSplayTree(module_list) == 0))
-    return((ModuleInfo *) NULL);
   if ((tag == (const char *) NULL) || (LocaleCompare(tag,"*") == 0))
     {
       ModuleInfo
@@ -865,39 +851,30 @@ static void *DestroyModuleNode(void *module_info)
 static MagickBooleanType InitializeModuleList(
   ExceptionInfo *magick_unused(exception))
 {
-  if ((module_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_module == MagickFalse))
+  if (module_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&module_semaphore);
+  LockSemaphoreInfo(module_semaphore);
+  if (module_list == (SplayTreeInfo *) NULL)
     {
-      if (module_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&module_semaphore);
-      LockSemaphoreInfo(module_semaphore);
-      if ((module_list == (SplayTreeInfo *) NULL) ||
-          (instantiate_module == MagickFalse))
-        {
-          MagickBooleanType
-            status;
-
-          ModuleInfo
-            *module_info;
-
-          module_list=NewSplayTree(CompareSplayTreeString,
-            (void *(*)(void *)) NULL,DestroyModuleNode);
-          if (module_list == (SplayTreeInfo *) NULL)
-            ThrowFatalException(ResourceLimitFatalError,
-              "MemoryAllocationFailed");
-          module_info=AcquireModuleInfo((const char *) NULL,"[boot-strap]");
-          module_info->stealth=MagickTrue;
-          status=AddValueToSplayTree(module_list,module_info->tag,module_info);
-          if (status == MagickFalse)
-            ThrowFatalException(ResourceLimitFatalError,
-              "MemoryAllocationFailed");
-          if (lt_dlinit() != 0)
-            ThrowFatalException(ModuleFatalError,
-              "UnableToInitializeModuleLoader");
-          instantiate_module=MagickTrue;
-        }
-      UnlockSemaphoreInfo(module_semaphore);
+      MagickBooleanType
+        status;
+
+      ModuleInfo
+        *module_info;
+
+      module_list=NewSplayTree(CompareSplayTreeString,
+        (void *(*)(void *)) NULL,DestroyModuleNode);
+      if (module_list == (SplayTreeInfo *) NULL)
+        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+      module_info=AcquireModuleInfo((const char *) NULL,"[boot-strap]");
+      module_info->stealth=MagickTrue;
+      status=AddValueToSplayTree(module_list,module_info->tag,module_info);
+      if (status == MagickFalse)
+        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+      if (lt_dlinit() != 0)
+        ThrowFatalException(ModuleFatalError,"UnableToInitializeModuleLoader");
     }
+  UnlockSemaphoreInfo(module_semaphore);
   return(module_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
index f4efc4b6e1ed9a4c5ce083f93de73112be92caa3..e05907701e50b321cc557a32803d903c16299bb6 100644 (file)
@@ -124,9 +124,6 @@ static LinkedListInfo
 
 static SemaphoreInfo
   *policy_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_policy = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -172,13 +169,9 @@ static PolicyInfo *GetPolicyInfo(const char *name,ExceptionInfo *exception)
     *q;
 
   assert(exception != (ExceptionInfo *) NULL);
-  if ((policy_list == (LinkedListInfo *) NULL) ||
-      (instantiate_policy == MagickFalse))
+  if (policy_list == (LinkedListInfo *) NULL)
     if (InitializePolicyList(exception) == MagickFalse)
       return((PolicyInfo *) NULL);
-  if ((policy_list == (LinkedListInfo *) NULL) ||
-      (IsLinkedListEmpty(policy_list) != MagickFalse))
-    return((PolicyInfo *) NULL);
   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
     return((PolicyInfo *) GetValueFromLinkedList(policy_list,0));
   /*
@@ -425,20 +418,12 @@ MagickExport char *GetPolicyValue(const char *name)
 */
 static MagickBooleanType InitializePolicyList(ExceptionInfo *exception)
 {
-  if ((policy_list == (LinkedListInfo *) NULL) ||
-      (instantiate_policy == MagickFalse))
-    {
-      if (policy_semaphore == (SemaphoreInfo *) NULL)
-        ActivateSemaphoreInfo(&policy_semaphore);
-      LockSemaphoreInfo(policy_semaphore);
-      if ((policy_list == (LinkedListInfo *) NULL) ||
-          (instantiate_policy == MagickFalse))
-        {
-          (void) LoadPolicyLists(PolicyFilename,exception);
-          instantiate_policy=MagickTrue;
-        }
-      UnlockSemaphoreInfo(policy_semaphore);
-    }
+  if (policy_semaphore == (SemaphoreInfo *) NULL)
+    ActivateSemaphoreInfo(&policy_semaphore);
+  LockSemaphoreInfo(policy_semaphore);
+  if (policy_list == (LinkedListInfo *) NULL)
+    (void) LoadPolicyLists(PolicyFilename,exception);
+  UnlockSemaphoreInfo(policy_semaphore);
   return(policy_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1020,7 +1005,6 @@ MagickPrivate void PolicyComponentTerminus(void)
   LockSemaphoreInfo(policy_semaphore);
   if (policy_list != (LinkedListInfo *) NULL)
     policy_list=DestroyLinkedList(policy_list,DestroyPolicyElement);
-  instantiate_policy=MagickFalse;
   UnlockSemaphoreInfo(policy_semaphore);
   RelinquishSemaphoreInfo(&policy_semaphore);
 }
index d5343c54de729325823fcbd0335a845f2ec89534..fc228f14d6fb0a9a92bc501bece02d2ab4673f42 100644 (file)
@@ -75,9 +75,6 @@ static SplayTreeInfo
 
 static SemaphoreInfo
   *registry_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
-  instantiate_registry = MagickFalse;
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -331,7 +328,6 @@ MagickPrivate void RegistryComponentTerminus(void)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   if (registry != (void *) NULL)
     registry=DestroySplayTree(registry);
-  instantiate_registry=MagickFalse;
   UnlockSemaphoreInfo(registry_semaphore);
   RelinquishSemaphoreInfo(&registry_semaphore);
 }
@@ -524,19 +520,14 @@ MagickExport MagickBooleanType SetImageRegistry(const RegistryType type,
   registry_info->type=type;
   registry_info->value=clone_value;
   registry_info->signature=MagickSignature;
-  if ((registry == (SplayTreeInfo *) NULL) &&
-      (instantiate_registry == MagickFalse))
+  if (registry == (SplayTreeInfo *) NULL)
     {
       if (registry_semaphore == (SemaphoreInfo *) NULL)
         ActivateSemaphoreInfo(&registry_semaphore);
       LockSemaphoreInfo(registry_semaphore);
-      if ((registry == (SplayTreeInfo *) NULL) &&
-          (instantiate_registry == MagickFalse))
-        {
-          registry=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
-            DestroyRegistryNode);
-          instantiate_registry=MagickTrue;
-        }
+      if (registry == (SplayTreeInfo *) NULL)
+        registry=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
+          DestroyRegistryNode);
       UnlockSemaphoreInfo(registry_semaphore);
     }
   status=AddValueToSplayTree(registry,ConstantString(key),registry_info);
index f46bf67564b1acaa5a7556191f9e7a6f2c32e5d2..7ed1e0f1cd495075c8a4e542758b6b18ad0f7f7f 100644 (file)
@@ -75,6 +75,42 @@ struct SemaphoreInfo
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   A c t i v a t e S e m a p h o r e I n f o                                 %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  ActivateSemaphoreInfo() activates a semaphore under protection of a mutex
+%  to ensure only one thread allocates the semaphore.
+%
+%  The format of the ActivateSemaphoreInfo method is:
+%
+%      void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
+%
+%  A description of each parameter follows:
+%
+%    o semaphore_info: Specifies a pointer to an SemaphoreInfo structure.
+%
+*/
+MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
+{
+  assert(semaphore_info != (SemaphoreInfo **) NULL);
+  if (*semaphore_info == (SemaphoreInfo *) NULL)
+    {
+      InitializeMagickMutex();
+      LockMagickMutex();
+      if (*semaphore_info == (SemaphoreInfo *) NULL)
+        *semaphore_info=AcquireSemaphoreInfo();
+      UnlockMagickMutex();
+    }
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   A c q u i r e S e m a p h o r e I n f o                                   %
 %                                                                             %
 %                                                                             %
@@ -158,7 +194,7 @@ MagickExport SemaphoreInfo *AcquireSemaphoreInfo(void)
     *semaphore_info;
 
   /*
-    Allocate semaphore.
+    Acquire semaphore.
   */
   semaphore_info=(SemaphoreInfo *) AcquireSemaphoreMemory(1,
     sizeof(*semaphore_info));
@@ -236,42 +272,6 @@ MagickExport SemaphoreInfo *AcquireSemaphoreInfo(void)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   A c t i v a t e S e m a p h o r e I n f o                                 %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  ActivateSemaphoreInfo() activates a semaphore under protection of a mutex
-%  to ensure only one thread allocates the semaphore.
-%
-%  The format of the ActivateSemaphoreInfo method is:
-%
-%      void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
-%
-%  A description of each parameter follows:
-%
-%    o semaphore_info: Specifies a pointer to an SemaphoreInfo structure.
-%
-*/
-MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
-{
-  assert(semaphore_info != (SemaphoreInfo **) NULL);
-  if (*semaphore_info == (SemaphoreInfo *) NULL)
-    {
-      InitializeMagickMutex();
-      LockMagickMutex();
-      if (*semaphore_info == (SemaphoreInfo *) NULL)
-        *semaphore_info=AcquireSemaphoreInfo();
-      UnlockMagickMutex();
-    }
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
 %   L o c k S e m a p h o r e I n f o                                         %
 %                                                                             %
 %                                                                             %
@@ -328,7 +328,7 @@ MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   R e l i n q u i s h S  e m a p h o r e I n f o                            %
+%   R e l i n q u i s h S e m a p h o r e I n f o                             %
 %                                                                             %
 %                                                                             %
 %                                                                             %
index 8b0881236501153c7879768a185d0392fd0397e4..cffd6738c2a5f99590219dc6297ab7ff86207d63 100644 (file)
@@ -117,9 +117,6 @@ static const char
 static SemaphoreInfo
   *type_semaphore = (SemaphoreInfo *) NULL;
 
-static volatile MagickBooleanType
-  instantiate_type = MagickFalse;
-
 static SplayTreeInfo
   *type_list = (SplayTreeInfo *) NULL;
 \f
@@ -159,13 +156,9 @@ MagickExport const TypeInfo *GetTypeInfo(const char *name,
   ExceptionInfo *exception)
 {
   assert(exception != (ExceptionInfo *) NULL);
-  if ((type_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_type == MagickFalse))
+  if (type_list == (SplayTreeInfo *) NULL)
     if (InitializeTypeList(exception) == MagickFalse)
       return((const TypeInfo *) NULL);
-  if ((type_list == (SplayTreeInfo *) NULL) ||
-      (GetNumberOfNodesInSplayTree(type_list) == 0))
-    return((const TypeInfo *) NULL);
   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
     {
       ResetSplayTreeIterator(type_list);
@@ -782,26 +775,20 @@ MagickExport MagickBooleanType LoadFontConfigFonts(SplayTreeInfo *type_list,
 
 static MagickBooleanType InitializeTypeList(ExceptionInfo *exception)
 {
-  if ((type_list == (SplayTreeInfo *) NULL) ||
-      (instantiate_type == MagickFalse))
+  if (type_semaphore == (SemaphoreInfo *) NULL)
+  ActivateSemaphoreInfo(&type_semaphore);
+  LockSemaphoreInfo(type_semaphore);
+  if (type_list == (SplayTreeInfo *) NULL)
     {
-      if (type_semaphore == (SemaphoreInfo *) NULL)
-                   ActivateSemaphoreInfo(&type_semaphore);
-      LockSemaphoreInfo(type_semaphore);
-      if ((type_list == (SplayTreeInfo *) NULL) ||
-          (instantiate_type == MagickFalse))
-        {
-          (void) LoadTypeLists(MagickTypeFilename,exception);
+      (void) LoadTypeLists(MagickTypeFilename,exception);
 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
-          (void) NTLoadTypeLists(type_list,exception);
+      (void) NTLoadTypeLists(type_list,exception);
 #endif
 #if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
-          (void) LoadFontConfigFonts(type_list,exception);
+      (void) LoadFontConfigFonts(type_list,exception);
 #endif
-          instantiate_type=MagickTrue;
-        }
-      UnlockSemaphoreInfo(type_semaphore);
     }
+  UnlockSemaphoreInfo(type_semaphore);
   return(type_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1390,7 +1377,6 @@ MagickPrivate void TypeComponentTerminus(void)
   LockSemaphoreInfo(type_semaphore);
   if (type_list != (SplayTreeInfo *) NULL)
     type_list=DestroySplayTree(type_list);
-  instantiate_type=MagickFalse;
   UnlockSemaphoreInfo(type_semaphore);
   RelinquishSemaphoreInfo(&type_semaphore);
 }