/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % + I n i t i a l i z e L o c a l e L i s t % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % InitializeLocaleList() initializes the locale list. % % The format of the InitializeLocaleList method is: % % MagickBooleanType InitializeLocaleList(ExceptionInfo *exception) % % A description of each parameter follows. % % o exception: Return any errors or warnings in this structure. % */ static MagickBooleanType InitializeLocaleList(ExceptionInfo *exception) { if ((locale_list == (SplayTreeInfo *) NULL) && (instantiate_locale == MagickFalse)) { AcquireSemaphoreInfo(&locale_semaphore); if ((locale_list == (SplayTreeInfo *) NULL) && (instantiate_locale == MagickFalse)) { char *locale; locale=setlocale(LC_CTYPE,0); if ((locale == (char *) NULL) || (*locale == '\0')) locale=getenv("LC_ALL"); if ((locale == (char *) NULL) || (*locale == '\0')) locale=getenv("LC_MESSAGES"); if ((locale == (char *) NULL) || (*locale == '\0')) locale=getenv("LC_CTYPE"); if ((locale == (char *) NULL) || (*locale == '\0')) locale=getenv("LANG"); if ((locale == (char *) NULL) || (*locale == '\0')) locale="C"; (void) LoadLocaleLists(LocaleFilename,locale,exception); instantiate_locale=MagickTrue; } RelinquishSemaphoreInfo(locale_semaphore); } return((MagickBooleanType) (locale_list != (SplayTreeInfo *) NULL)); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % + I n i t i a l i z e L o c a l e L i s t % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % InitializeLocaleList() initializes the locale list. % % The format of the InitializeLocaleList method is: % % MagickBooleanType InitializeLocaleList(ExceptionInfo *exception) % % A description of each parameter follows. % % o exception: return any errors or warnings in this structure. % */ static MagickBooleanType InitializeLocaleList(ExceptionInfo *exception) { if ((locale_list == (SplayTreeInfo *) NULL) && (instantiate_locale == MagickFalse)) { if (locale_semaphore == (SemaphoreInfo *) NULL) AcquireSemaphoreInfo(&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); } return(locale_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); }