From 0f20ce738d1ffdca6efd79e2ae2a7dd35b40a51c Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Fri, 22 May 2009 22:03:42 +0700 Subject: [PATCH] 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. --- src/checkfunctionusage.cpp | 2 +- src/checkmemoryleak.cpp | 2 +- src/tokenize.cpp | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/checkfunctionusage.cpp b/src/checkfunctionusage.cpp index 872b05b6b..c7102dc56 100644 --- a/src/checkfunctionusage.cpp +++ b/src/checkfunctionusage.cpp @@ -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; diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 8732fbf28..35a14a35c 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -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" : "}"); diff --git a/src/tokenize.cpp b/src/tokenize.cpp index 9705c18fe..6c00c5690 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -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