From dec4561ce369ffd7f51ad14da3a830b8d71f8beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 31 Dec 2008 17:32:18 +0000 Subject: [PATCH] memory leak: removed 'if(true)' and 'if(false)' as these are handled in the tokenizer instead --- checkmemoryleak.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/checkmemoryleak.cpp b/checkmemoryleak.cpp index 56fb6086e..d110c41eb 100644 --- a/checkmemoryleak.cpp +++ b/checkmemoryleak.cpp @@ -467,14 +467,6 @@ TOKEN *CheckMemoryLeakClass::getcode(const TOKEN *tok, std::list { addtoken("if(!var)"); } - else if ( TOKEN::Match(tok, "if ( true )") ) - { - addtoken("if(true)"); - } - else if ( TOKEN::Match(tok, "if ( false )") ) - { - addtoken("if(false)"); - } else if ( TOKEN::Match(tok, "if") ) { // Check if the condition depends on var somehow.. @@ -821,7 +813,7 @@ void CheckMemoryLeakClass::simplifycode(TOKEN *tok) } // Reduce "if* ;" that is not followed by an else.. - if (TOKEN::Match(tok2->next(), "if(var)|if(!var)|if(true)|if(false)|ifv ; !!else") ) + if (TOKEN::Match(tok2->next(), "if(var)|if(!var)|ifv ; !!else") ) { erase(tok2, tok2->tokAt(2)); done = false; @@ -884,13 +876,6 @@ void CheckMemoryLeakClass::simplifycode(TOKEN *tok) done = false; } - // Reduce "if(true) X ;" => "X ;" - if (TOKEN::Match(tok2->next(), "if(true) %var% ; !!else") ) - { - erase( tok2, tok2->tokAt(2) ); - done = false; - } - // Replace "loop { X ; break ; }" with "X ;" if ( TOKEN::Match(tok2->next(), "loop { %var% ; break ; }") ) {