TOKEN::Match minor optimization

This commit is contained in:
Nicolas Le Cam 2008-12-08 22:49:11 +00:00
parent 440203bd5c
commit 19ef4f8b15
1 changed files with 3 additions and 2 deletions

View File

@ -169,6 +169,7 @@ bool TOKEN::Match(const TOKEN *tok, const char pattern[], const char *varname1[]
if (str[0] == 0) if (str[0] == 0)
return true; return true;
bool useVar1;
// Any symbolname.. // Any symbolname..
if (strcmp(str,"%var%")==0 || strcmp(str,"%type%")==0) if (strcmp(str,"%var%")==0 || strcmp(str,"%type%")==0)
{ {
@ -183,9 +184,9 @@ bool TOKEN::Match(const TOKEN *tok, const char pattern[], const char *varname1[]
} }
// Variable name.. // Variable name..
else if (strcmp(str,"%var1%")==0 || strcmp(str,"%var2%")==0) else if ((useVar1 = (strcmp(str,"%var1%")==0)) || strcmp(str,"%var2%")==0)
{ {
const char **varname = (strcmp(str,"%var1%")==0) ? varname1 : varname2; const char **varname = useVar1 ? varname1 : varname2;
if ( ! varname ) if ( ! varname )
return false; return false;