Token: try to improve speed of multicompare macro.

This commit is contained in:
Edoardo Prezioso 2012-12-01 23:58:01 +01:00
parent b0a3ef33ef
commit 45a16baaa0
1 changed files with 14 additions and 17 deletions

View File

@ -530,23 +530,20 @@ int Token::firstWordLen(const char *str)
return len; return len;
} }
#define multicompare(p,cond,ismulticomp) \ #define multicompare(p,cond,ismulticomp) \
{ \ { \
if ((p)[0] != '|') { \ if (!(cond)) { \
if (!(cond)) \ if (*(p) != '|') \
return false; \ return false; \
ismulticomp = false; \ ++(p); \
} else { \ ismulticomp = (*(p) && *(p) != ' '); \
if (cond) { \ continue; \
while (*(p) && *(p) != ' ') \ } \
++(p); \ if (*(p) == '|') { \
ismulticomp = false; \ while (*(p) && *(p) != ' ') \
} else { \ ++(p); \
++(p); \ } \
ismulticomp = (*(p) && *(p) != ' '); \ ismulticomp = false; \
continue; \
} \
} \
} }
bool Token::Match(const Token *tok, const char pattern[], unsigned int varid) bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)