Refactorization: Reordered conditions - simplematch is cheaper than findsimplematch

This commit is contained in:
Philipp Kloke 2015-10-18 20:35:33 +02:00
parent 7060c7c87d
commit 2a5206a444
1 changed files with 4 additions and 4 deletions

View File

@ -2004,14 +2004,14 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens)
{
const Token *result;
if ((result = Token::findsimplematch(tokens, "loop alloc ;")) != nullptr) {
return result;
}
if (Token::Match(tokens, "alloc ; if|if(var)|ifv break|continue|return ;")) {
return tokens->tokAt(3);
}
if ((result = Token::findsimplematch(tokens, "loop alloc ;")) != nullptr) {
return result;
}
if ((result = Token::findmatch(tokens, "alloc ; if|if(var)|ifv return ;")) != nullptr) {
return result->tokAt(3);
}