Reorder checks, remove duplicate check

This commit is contained in:
Dmitry-Me 2017-12-20 13:16:59 +03:00
parent f4ddf43cba
commit 82825ab721
1 changed files with 3 additions and 6 deletions

View File

@ -490,17 +490,14 @@ static bool alwaysTrue(const Token *tok)
if (!tok) if (!tok)
return false; return false;
if (tok->values().size() == 1U && if (tok->values().size() == 1U &&
tok->values().front().intvalue != 0 && tok->values().front().isKnown() &&
tok->values().front().isKnown()) tok->values().front().intvalue != 0)
return true; return true;
if (tok->str() == "||") if (tok->str() == "||")
return alwaysTrue(tok->astOperand1()) || alwaysTrue(tok->astOperand2()); return alwaysTrue(tok->astOperand1()) || alwaysTrue(tok->astOperand2());
if (tok->str() == "true") if (tok->str() == "true")
return true; return true;
return (tok->isComparisonOp() && return false;
tok->values().size() == 1U &&
tok->values().front().isKnown() &&
tok->values().front().intvalue != 0);
} }
bool CheckMemoryLeakInFunction::test_white_list(const std::string &funcname, const Settings *settings, bool cpp) bool CheckMemoryLeakInFunction::test_white_list(const std::string &funcname, const Settings *settings, bool cpp)