static SplayTreeInfo
*coder_list = (SplayTreeInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_coder = MagickFalse;
\f
/*
Forward declarations.
LockSemaphoreInfo(coder_semaphore);
if (coder_list != (SplayTreeInfo *) NULL)
coder_list=DestroySplayTree(coder_list);
- instantiate_coder=MagickFalse;
UnlockSemaphoreInfo(coder_semaphore);
RelinquishSemaphoreInfo(&coder_semaphore);
}
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);
*/
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
static SemaphoreInfo
*color_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_color = MagickFalse;
\f
/*
Forward declarations.
LockSemaphoreInfo(color_semaphore);
if (color_list != (LinkedListInfo *) NULL)
color_list=DestroyLinkedList(color_list,DestroyColorElement);
- instantiate_color=MagickFalse;
UnlockSemaphoreInfo(color_semaphore);
RelinquishSemaphoreInfo(&color_semaphore);
}
*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));
/*
*/
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
static SemaphoreInfo
*configure_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_configure = MagickFalse;
\f
/*
Forward declarations.
if (configure_list != (LinkedListInfo *) NULL)
configure_list=DestroyLinkedList(configure_list,DestroyConfigureElement);
configure_list=(LinkedListInfo *) NULL;
- instantiate_configure=MagickFalse;
UnlockSemaphoreInfo(configure_semaphore);
RelinquishSemaphoreInfo(&configure_semaphore);
}
*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));
/*
*/
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
static SemaphoreInfo
*delegate_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_delegate = MagickFalse;
\f
/*
Forward declaractions.
LockSemaphoreInfo(delegate_semaphore);
if (delegate_list != (LinkedListInfo *) NULL)
delegate_list=DestroyLinkedList(delegate_list,DestroyDelegate);
- instantiate_delegate=MagickFalse;
UnlockSemaphoreInfo(delegate_semaphore);
RelinquishSemaphoreInfo(&delegate_semaphore);
}
*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));
/*
*/
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
static volatile locale_t
c_locale = (locale_t) NULL;
#endif
-
-static volatile MagickBooleanType
- instantiate_locale = MagickFalse;
\f
/*
Forward declarations.
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);
*/
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
#if defined(MAGICKCORE_HAVE_STRTOD_L)
DestroyCLocale();
#endif
- instantiate_locale=MagickFalse;
UnlockSemaphoreInfo(locale_semaphore);
RelinquishSemaphoreInfo(&locale_semaphore);
}
static SemaphoreInfo
*log_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_log = MagickFalse;
\f
/*
Forward declarations.
*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));
/*
*/
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
LockSemaphoreInfo(log_semaphore);
if (log_list != (LinkedListInfo *) NULL)
log_list=DestroyLinkedList(log_list,DestroyLogElement);
- instantiate_log=MagickFalse;
UnlockSemaphoreInfo(log_semaphore);
RelinquishSemaphoreInfo(&log_semaphore);
}
static SemaphoreInfo
*magic_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_magic = MagickFalse;
\f
/*
Forward declarations.
*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)
*/
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
LockSemaphoreInfo(magic_semaphore);
if (magic_list != (LinkedListInfo *) NULL)
magic_list=DestroyLinkedList(magic_list,DestroyMagicElement);
- instantiate_magic=MagickFalse;
UnlockSemaphoreInfo(magic_semaphore);
RelinquishSemaphoreInfo(&magic_semaphore);
}
*magick_list = (SplayTreeInfo *) NULL;
static volatile MagickBooleanType
- instantiate_magick = MagickFalse,
instantiate_magickcore = MagickFalse;
\f
/*
*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))
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
LockSemaphoreInfo(magick_semaphore);
if (magick_list != (SplayTreeInfo *) NULL)
magick_list=DestroySplayTree(magick_list);
- instantiate_magick=MagickFalse;
UnlockSemaphoreInfo(magick_semaphore);
RelinquishSemaphoreInfo(&magick_semaphore);
}
(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)
static SemaphoreInfo
*mime_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_mime = MagickFalse;
\f
/*
Forward declarations.
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)
*/
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
LockSemaphoreInfo(mime_semaphore);
if (mime_list != (LinkedListInfo *) NULL)
mime_list=DestroyLinkedList(mime_list,DestroyMimeElement);
- instantiate_mime=MagickFalse;
UnlockSemaphoreInfo(mime_semaphore);
RelinquishSemaphoreInfo(&mime_semaphore);
}
static SplayTreeInfo
*module_list = (SplayTreeInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_module = MagickFalse;
\f
/*
Forward declarations.
#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);
}
*/
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
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
static SemaphoreInfo
*policy_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_policy = MagickFalse;
\f
/*
Forward declarations.
*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));
/*
*/
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
LockSemaphoreInfo(policy_semaphore);
if (policy_list != (LinkedListInfo *) NULL)
policy_list=DestroyLinkedList(policy_list,DestroyPolicyElement);
- instantiate_policy=MagickFalse;
UnlockSemaphoreInfo(policy_semaphore);
RelinquishSemaphoreInfo(&policy_semaphore);
}
static SemaphoreInfo
*registry_semaphore = (SemaphoreInfo *) NULL;
-
-static volatile MagickBooleanType
- instantiate_registry = MagickFalse;
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
if (registry != (void *) NULL)
registry=DestroySplayTree(registry);
- instantiate_registry=MagickFalse;
UnlockSemaphoreInfo(registry_semaphore);
RelinquishSemaphoreInfo(®istry_semaphore);
}
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(®istry_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);
% %
% %
% %
+% 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 %
% %
% %
*semaphore_info;
/*
- Allocate semaphore.
+ Acquire semaphore.
*/
semaphore_info=(SemaphoreInfo *) AcquireSemaphoreMemory(1,
sizeof(*semaphore_info));
% %
% %
% %
-% 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 %
% %
% %
% %
% %
% %
-% 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 %
% %
% %
% %
static SemaphoreInfo
*type_semaphore = (SemaphoreInfo *) NULL;
-static volatile MagickBooleanType
- instantiate_type = MagickFalse;
-
static SplayTreeInfo
*type_list = (SplayTreeInfo *) NULL;
\f
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);
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
LockSemaphoreInfo(type_semaphore);
if (type_list != (SplayTreeInfo *) NULL)
type_list=DestroySplayTree(type_list);
- instantiate_type=MagickFalse;
UnlockSemaphoreInfo(type_semaphore);
RelinquishSemaphoreInfo(&type_semaphore);
}