From: cristy Date: Fri, 12 Sep 2014 15:24:39 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2020 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6284185c4d11889c2ed299ecefd1cc15d73cc720;p=imagemagick --- diff --git a/MagickCore/magick.c b/MagickCore/magick.c index 35cafd0e3..9fca3aa66 100644 --- a/MagickCore/magick.c +++ b/MagickCore/magick.c @@ -1341,7 +1341,6 @@ MagickExport void MagickCoreGenesis(const char *path, #if defined(MAGICKCORE_X11_DELEGATE) (void) XComponentGenesis(); #endif - (void) CommandComponentGenesis(); (void) RegistryComponentGenesis(); instantiate_magickcore=MagickTrue; UnlockMagickMutex(); @@ -1375,7 +1374,6 @@ MagickExport void MagickCoreTerminus(void) return; } RegistryComponentTerminus(); - CommandComponentTerminus(); #if defined(MAGICKCORE_X11_DELEGATE) XComponentTerminus(); #endif diff --git a/MagickCore/option-private.h b/MagickCore/option-private.h index 4dc40566b..dc5141c03 100644 --- a/MagickCore/option-private.h +++ b/MagickCore/option-private.h @@ -22,12 +22,6 @@ extern "C" { #endif -extern MagickPrivate MagickBooleanType - CommandComponentGenesis(void); - -extern MagickPrivate void - CommandComponentTerminus(void); - #if defined(__cplusplus) || defined(c_plusplus) } #endif diff --git a/MagickCore/option.c b/MagickCore/option.c index 0ce53be9d..9229092c5 100644 --- a/MagickCore/option.c +++ b/MagickCore/option.c @@ -182,6 +182,9 @@ static const OptionInfo }, CommandOptions[] = { + /* + Must be ordered lexigraphically. + */ { "(", 0L, NoImageOperatorFlag, MagickTrue }, { ")", 0L, NoImageOperatorFlag, MagickTrue }, { "{", 0L, NoImageOperatorFlag, MagickTrue }, @@ -714,14 +717,14 @@ static const OptionInfo { "-tile", 1L, DrawInfoOptionFlag | NeverInterpretArgsFlag, MagickFalse }, { "+tile-offset", 0L, ImageInfoOptionFlag, MagickFalse }, { "-tile-offset", 1L, ImageInfoOptionFlag, MagickFalse }, - { "+tint", 1L, SimpleOperatorFlag, MagickFalse }, { "-tint", 1L, SimpleOperatorFlag, MagickFalse }, + { "+tint", 1L, SimpleOperatorFlag, MagickFalse }, { "+title", 0L, NonMagickOptionFlag, MagickFalse }, { "-title", 1L, NonMagickOptionFlag, MagickFalse }, { "+transform", 0L, DeprecateOptionFlag, MagickTrue }, { "-transform", 0L, ReplacedOptionFlag | SimpleOperatorFlag, MagickTrue }, - { "+transparent", 1L, SimpleOperatorFlag, MagickFalse }, { "-transparent", 1L, SimpleOperatorFlag, MagickFalse }, + { "+transparent", 1L, SimpleOperatorFlag, MagickFalse }, { "+transparent-color", 0L, ImageInfoOptionFlag, MagickFalse }, { "-transparent-color", 1L, ImageInfoOptionFlag, MagickFalse }, { "+transpose", 0L, DeprecateOptionFlag, MagickTrue }, @@ -736,8 +739,8 @@ static const OptionInfo { "-type", 1L, ImageInfoOptionFlag | SimpleOperatorFlag, MagickFalse }, { "+undercolor", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, { "-undercolor", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse }, - { "+unique", 0L, SimpleOperatorFlag, MagickFalse }, { "-unique", 0L, SimpleOperatorFlag, MagickFalse }, + { "+unique", 0L, SimpleOperatorFlag, MagickFalse }, { "+unique-colors", 0L, DeprecateOptionFlag, MagickTrue }, { "-unique-colors", 0L, SimpleOperatorFlag, MagickFalse }, { "+units", 0L, ImageInfoOptionFlag, MagickFalse }, @@ -748,8 +751,8 @@ static const OptionInfo { "-update", 1L, NonMagickOptionFlag, MagickFalse }, { "+use-pixmap", 0L, NonMagickOptionFlag, MagickFalse }, { "-use-pixmap", 1L, NonMagickOptionFlag, MagickFalse }, - { "+verbose", 0L, ImageInfoOptionFlag, MagickFalse }, { "-verbose", 0L, ImageInfoOptionFlag, MagickFalse }, + { "+verbose", 0L, ImageInfoOptionFlag, MagickFalse }, { "+version", 0L, DeprecateOptionFlag, MagickTrue }, { "-version", 0L, NoImageOperatorFlag, MagickFalse }, { "+view", 0L, ImageInfoOptionFlag, MagickFalse }, @@ -774,8 +777,8 @@ static const OptionInfo { "-window", 1L, NonMagickOptionFlag, MagickFalse }, { "+window-group", 0L, NonMagickOptionFlag, MagickFalse }, { "-window-group", 1L, NonMagickOptionFlag, MagickFalse }, - { "+write", 1L, NoImageOperatorFlag | NeverInterpretArgsFlag | FireOptionFlag, MagickFalse }, { "-write", 1L, NoImageOperatorFlag | NeverInterpretArgsFlag | FireOptionFlag, MagickFalse }, + { "+write", 1L, NoImageOperatorFlag | NeverInterpretArgsFlag | FireOptionFlag, MagickFalse }, { (char *) NULL, 0L, UndefinedOptionFlag, MagickFalse } }, ComposeOptions[] = @@ -1719,12 +1722,6 @@ static const OptionInfo { "White", WhiteVirtualPixelMethod, UndefinedOptionFlag, MagickFalse }, { (char *) NULL, UndefinedVirtualPixelMethod, UndefinedOptionFlag, MagickFalse } }; - -static SemaphoreInfo - *command_semaphore = (SemaphoreInfo *) NULL; - -static SplayTreeInfo - *command_cache = (SplayTreeInfo *) NULL; /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1776,60 +1773,6 @@ MagickExport MagickBooleanType CloneImageOptions(ImageInfo *image_info, % % % % % % -+ C o m m a n d C o m p o n e n t G e n e s i s % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% CommandComponentGenesis() instantiates the command component. -% -% The format of the CommandComponentGenesis method is: -% -% MagickBooleanType CommandComponentGenesis(void) -% -*/ -MagickPrivate MagickBooleanType CommandComponentGenesis(void) -{ - if (command_semaphore == (SemaphoreInfo *) NULL) - command_semaphore=AcquireSemaphoreInfo(); - return(MagickTrue); -} - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % -+ C o m m a n d C o m p o n e n t T e r m i n u s % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% CommandComponentTerminus() destroys the command component. -% -% The format of the CommandComponentTerminus method is: -% -% CommandComponentTerminus(void) -% -*/ -MagickPrivate void CommandComponentTerminus(void) -{ - if (command_semaphore == (SemaphoreInfo *) NULL) - ActivateSemaphoreInfo(&command_semaphore); - LockSemaphoreInfo(command_semaphore); - if (command_cache != (SplayTreeInfo *) NULL) - command_cache=DestroySplayTree(command_cache); - UnlockSemaphoreInfo(command_semaphore); - RelinquishSemaphoreInfo(&command_semaphore); -} - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % % D e f i n e I m a g e O p t i o n % % % % % @@ -2141,15 +2084,10 @@ MagickExport ssize_t GetCommandOptionFlags(const CommandOption option, *q++=(*p++); } *q='\0'; - if (option == MagickCommandOptions) - command_info=GetCommandOptionInfo(token); - else - { - for (i=0; option_info[i].mnemonic != (char *) NULL; i++) - if (LocaleCompare(token,option_info[i].mnemonic) == 0) - break; - command_info=option_info+i; - } + for (i=0; option_info[i].mnemonic != (char *) NULL; i++) + if (LocaleCompare(token,option_info[i].mnemonic) == 0) + break; + command_info=option_info+i; if ((command_info->mnemonic == (const char *) NULL) && ((strchr(token+1,'-') != (char *) NULL) || (strchr(token+1,'_') != (char *) NULL))) @@ -2158,15 +2096,10 @@ MagickExport ssize_t GetCommandOptionFlags(const CommandOption option, (void) CopyMagickString(q,q+1,MaxTextExtent-strlen(q)); while ((q=strchr(token+1,'_')) != (char *) NULL) (void) CopyMagickString(q,q+1,MaxTextExtent-strlen(q)); - if (option == MagickCommandOptions) - command_info=GetCommandOptionInfo(token); - else - { - for (i=0; option_info[i].mnemonic != (char *) NULL; i++) - if (LocaleCompare(token,option_info[i].mnemonic) == 0) - break; - command_info=option_info+i; - } + for (i=0; option_info[i].mnemonic != (char *) NULL; i++) + if (LocaleCompare(token,option_info[i].mnemonic) == 0) + break; + command_info=option_info+i; } if (command_info->mnemonic == (const char *) NULL) return(-1); @@ -2206,35 +2139,13 @@ MagickExport ssize_t GetCommandOptionFlags(const CommandOption option, */ MagickExport const OptionInfo *GetCommandOptionInfo(const char *option) { - register const OptionInfo - *p; - - if (command_cache == (SplayTreeInfo *) NULL) - { - if (command_semaphore == (SemaphoreInfo *) NULL) - ActivateSemaphoreInfo(&command_semaphore); - LockSemaphoreInfo(command_semaphore); - if (command_cache == (SplayTreeInfo *) NULL) - { - register ssize_t - i; + register ssize_t + i; - /* - Load the command option splay-tree. - */ - command_cache=NewSplayTree(CompareSplayTreeString,NULL,NULL); - for (i=0; CommandOptions[i].mnemonic != (const char *) NULL; i++) - (void) AddValueToSplayTree(command_cache,CommandOptions[i].mnemonic, - CommandOptions+i); - (void) AddValueToSplayTree(command_cache,CommandOptions[i].mnemonic, - CommandOptions+i); - } - UnlockSemaphoreInfo(command_semaphore); - } - p=(const OptionInfo *) GetValueFromSplayTree(command_cache,option); - if (p != NULL) - return(p); - return((const OptionInfo *) GetValueFromSplayTree(command_cache,NULL)); + for (i=0; CommandOptions[i].mnemonic != (char *) NULL; i++) + if (LocaleCompare(option,CommandOptions[i].mnemonic) == 0) + break; + return(CommandOptions+i); } /* @@ -2718,15 +2629,10 @@ MagickExport ssize_t ParseCommandOption(const CommandOption option, *q++=(*p++); } *q='\0'; - if (option == MagickCommandOptions) - command_info=GetCommandOptionInfo(token); - else - { - for (i=0; option_info[i].mnemonic != (char *) NULL; i++) - if (LocaleCompare(token,option_info[i].mnemonic) == 0) - break; - command_info=option_info+i; - } + for (i=0; option_info[i].mnemonic != (char *) NULL; i++) + if (LocaleCompare(token,option_info[i].mnemonic) == 0) + break; + command_info=option_info+i; if ((command_info->mnemonic == (const char *) NULL) && ((strchr(token+1,'-') != (char *) NULL) || (strchr(token+1,'_') != (char *) NULL))) @@ -2735,15 +2641,10 @@ MagickExport ssize_t ParseCommandOption(const CommandOption option, (void) CopyMagickString(q,q+1,MaxTextExtent-strlen(q)); while ((q=strchr(token+1,'_')) != (char *) NULL) (void) CopyMagickString(q,q+1,MaxTextExtent-strlen(q)); - if (option == MagickCommandOptions) - command_info=GetCommandOptionInfo(token); - else - { - for (i=0; option_info[i].mnemonic != (char *) NULL; i++) - if (LocaleCompare(token,option_info[i].mnemonic) == 0) - break; - command_info=option_info+i; - } + for (i=0; option_info[i].mnemonic != (char *) NULL; i++) + if (LocaleCompare(token,option_info[i].mnemonic) == 0) + break; + command_info=option_info+i; } if (command_info->mnemonic == (const char *) NULL) return(-1);