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

@ -532,21 +532,18 @@ int Token::firstWordLen(const char *str)
#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; \
} else { \
if (cond) { \
while (*(p) && *(p) != ' ') \
++(p); \
ismulticomp = false; \
} else { \
++(p); \ ++(p); \
ismulticomp = (*(p) && *(p) != ' '); \ ismulticomp = (*(p) && *(p) != ' '); \
continue; \ continue; \
} \ } \
if (*(p) == '|') { \
while (*(p) && *(p) != ' ') \
++(p); \
} \ } \
ismulticomp = false; \
} }
bool Token::Match(const Token *tok, const char pattern[], unsigned int varid) bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)