Break loop early, simplify check

This commit is contained in:
Dmitry-Me 2017-12-20 03:55:43 +03:00
parent 6ae32ed98c
commit f4ddf43cba
1 changed files with 3 additions and 5 deletions

View File

@ -526,12 +526,10 @@ void CheckOther::checkRedundantAssignment()
bool bailout = false; bool bailout = false;
for (const Token *tok3 = tok2->link(); tok3 != tok2; tok3 = tok3->previous()) { for (const Token *tok3 = tok2->link(); tok3 != tok2; tok3 = tok3->previous()) {
if (tok3->varId()) { if (tok3->varId()) {
if (!tok3->variable()) const Variable *var = tok3->variable();
if (!var || !var->isConst() || var->isReference() || var->isPointer()) {
bailout = true; bailout = true;
else { break;
const Variable *var = tok3->variable();
if (!var->isConst() || var->isReference() || var->isPointer())
bailout = true;
} }
} }
} }