Break loop early

This commit is contained in:
Dmitry-Me 2017-09-12 07:48:06 +03:00
parent 4126fab1d5
commit a4c20b3606
1 changed files with 4 additions and 1 deletions

View File

@ -1250,7 +1250,10 @@ static void valueFlowAST(Token *tok, unsigned int varid, const ValueFlow::Value
const std::list<ValueFlow::Value> &values = tok->astOperand1()->values(); const std::list<ValueFlow::Value> &values = tok->astOperand1()->values();
bool nonzero = false; bool nonzero = false;
for (std::list<ValueFlow::Value>::const_iterator it = values.begin(); it != values.end(); ++it) { for (std::list<ValueFlow::Value>::const_iterator it = values.begin(); it != values.end(); ++it) {
nonzero |= (it->intvalue != 0); if (it->intvalue != 0) {
nonzero = true;
break;
}
} }
if (!nonzero) if (!nonzero)
return; return;