Refactorization: Reordered conditions - simplematch is cheaper than findsimplematch
This commit is contained in:
parent
7060c7c87d
commit
2a5206a444
|
@ -2004,14 +2004,14 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens)
|
||||||
{
|
{
|
||||||
const Token *result;
|
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 ;")) {
|
if (Token::Match(tokens, "alloc ; if|if(var)|ifv break|continue|return ;")) {
|
||||||
return tokens->tokAt(3);
|
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) {
|
if ((result = Token::findmatch(tokens, "alloc ; if|if(var)|ifv return ;")) != nullptr) {
|
||||||
return result->tokAt(3);
|
return result->tokAt(3);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue