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)
return false;
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;
if (tok->str() == "||")
return alwaysTrue(tok->astOperand1()) || alwaysTrue(tok->astOperand2());
if (tok->str() == "true")
return true;
return (tok->isComparisonOp() &&
tok->values().size() == 1U &&
tok->values().front().isKnown() &&
tok->values().front().intvalue != 0);
return false;
}
bool CheckMemoryLeakInFunction::test_white_list(const std::string &funcname, const Settings *settings, bool cpp)