From 2a5206a4449a7088293e5ed4ef8ea090334b734d Mon Sep 17 00:00:00 2001 From: Philipp Kloke Date: Sun, 18 Oct 2015 20:35:33 +0200 Subject: [PATCH] Refactorization: Reordered conditions - simplematch is cheaper than findsimplematch --- lib/checkmemoryleak.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 4c8bf37ae..13ba90dc9 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -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); }