Optimization: 6,2 s -> 5,6 s
This commit is contained in:
parent
0970dcd70f
commit
3a2fd91783
|
@ -481,6 +481,8 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list<const Token *>
|
|||
}
|
||||
|
||||
// if else switch
|
||||
if (tok->str() == "if")
|
||||
{
|
||||
if (Token::simpleMatch(tok, std::string("if ( " + varnameStr + " )").c_str()) ||
|
||||
Token::simpleMatch(tok, std::string("if ( " + varnameStr + " != 0 )").c_str()) ||
|
||||
Token::simpleMatch(tok, std::string("if ( 0 != " + varnameStr + " )").c_str()))
|
||||
|
@ -491,11 +493,11 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list<const Token *>
|
|||
while (tok->str() != ")")
|
||||
tok = tok->next();
|
||||
}
|
||||
else if (Token::Match(tok, "if (") && notvar(tok->tokAt(2), varnames))
|
||||
else if (Token::simpleMatch(tok, "if (") && notvar(tok->tokAt(2), varnames))
|
||||
{
|
||||
addtoken("if(!var)");
|
||||
}
|
||||
else if (Token::Match(tok, "if"))
|
||||
else
|
||||
{
|
||||
// Check if the condition depends on var somehow..
|
||||
bool dep = false;
|
||||
|
@ -527,7 +529,9 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list<const Token *>
|
|||
}
|
||||
addtoken((dep ? "ifv" : "if"));
|
||||
}
|
||||
else if ((tok->str() == "else") || (tok->str() == "switch"))
|
||||
}
|
||||
|
||||
if ((tok->str() == "else") || (tok->str() == "switch"))
|
||||
{
|
||||
addtoken(tok->aaaa());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue