Fix bug in class Token that causes recently added modulo-check to fail.

This commit is contained in:
PKEuS 2012-04-26 16:39:16 +02:00
parent 92737578ac
commit dee5568853
1 changed files with 4 additions and 4 deletions

View File

@ -500,7 +500,7 @@ bool Token::firstWordEquals(const char *str, const char *word)
{ {
for (;;) { for (;;) {
if (*str != *word) { if (*str != *word) {
return !(*str == ' ' && *word == 0); return (*str == ' ' && *word == 0);
} else if (*str == 0) } else if (*str == 0)
break; break;
@ -508,7 +508,7 @@ bool Token::firstWordEquals(const char *str, const char *word)
++word; ++word;
} }
return false; return true;
} }
const char *Token::chrInFirstWord(const char *str, char c) const char *Token::chrInFirstWord(const char *str, char c)
@ -764,11 +764,11 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
// Parse "not" options. Token can be anything except the given one // Parse "not" options. Token can be anything except the given one
else if (p[1] == '!' && p[0] == '!' && p[2] != '\0') { else if (p[1] == '!' && p[0] == '!' && p[2] != '\0') {
if (!firstWordEquals(&(p[2]), tok->str().c_str())) if (firstWordEquals(&(p[2]), tok->str().c_str()))
return false; return false;
} }
else if (firstWordEquals(p, tok->_str.c_str())) { else if (!firstWordEquals(p, tok->_str.c_str())) {
return false; return false;
} }