Replaced two Token::simpleMatch() calls to one Token::Match().

Suggested by hyd_danmar in ticket
http://apps.sourceforge.net/trac/cppcheck/ticket/323

No functional change.
This commit is contained in:
Slava Semushin 2009-05-22 22:03:42 +07:00
parent a2a6eebb01
commit 0f20ce738d
3 changed files with 3 additions and 4 deletions

View File

@ -120,7 +120,7 @@ void CheckFunctionUsage::parseTokens(const Tokenizer &tokenizer)
else if (tok2->str() == ")")
{
--parlevel;
if (parlevel == 0 && (Token::simpleMatch(tok2, ") {") || Token::simpleMatch(tok2, ") const")))
if (parlevel == 0 && (Token::Match(tok2, ") const|{")))
funcname = NULL;
if (parlevel <= 0)
break;

View File

@ -1206,7 +1206,7 @@ void CheckMemoryLeakClass::simplifycode(Token *tok, bool &all)
erase(tok2, tok2->tokAt(2));
tok2 = tok2->next();
bool first = true;
while (Token::simpleMatch(tok2, "case") || Token::simpleMatch(tok2, "default"))
while (Token::Match(tok2, "case|default"))
{
bool def = Token::simpleMatch(tok2, "default");
tok2->str(first ? "if" : "}");

View File

@ -1171,8 +1171,7 @@ void Tokenizer::simplifyTokenList()
tempToken = tempToken->tokAt(2);
continue;
}
else if (Token::simpleMatch(tempToken->next(), "++") ||
Token::simpleMatch(tempToken->next(), "--"))
else if (Token::Match(tempToken->next(), "++|--"))
{
// We have variable++ or variable--, there should be
// nothing after this