From 120e8c0674cc11bd54d91eaa77001b74f45a405a Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Mon, 18 Aug 2014 14:00:25 +0400 Subject: [PATCH] Make loop termination more explicit. --- lib/tokenize.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d98c653a1..4f261e1a7 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2589,9 +2589,11 @@ void Tokenizer::setVarId() const Token *tok3 = tok2->next(); if (!tok3->isStandardType() && tok3->str() != "void" && !Token::Match(tok3, "struct|union|class %type%") && tok3->str() != "." && !Token::Match(tok2->link()->previous(), "[&*]")) { bool isDecl = true; - for (; tok3 && isDecl; tok3 = tok3->nextArgument()) { - if (tok3->strAt(-1) == "&" || tok3->strAt(-1) == "*" || (notstart.find(tok3->str()) == notstart.end() && setVarIdParseDeclaration(&tok3, variableId, executableScope.top(), isCPP()))) + for (; tok3; tok3 = tok3->nextArgument()) { + if (tok3->strAt(-1) == "&" || tok3->strAt(-1) == "*" || (notstart.find(tok3->str()) == notstart.end() && setVarIdParseDeclaration(&tok3, variableId, executableScope.top(), isCPP()))) { isDecl = false; + break; + } } if (isDecl) { variableId[tok2->previous()->str()] = ++_varId;