From b0b08a3bb098928b5201410af8797c3600a7bdf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 24 Apr 2018 18:17:47 +0200 Subject: [PATCH] Refactoring: Use range for loop --- lib/checkbool.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/checkbool.cpp b/lib/checkbool.cpp index 2acf72787..3beef1c33 100644 --- a/lib/checkbool.cpp +++ b/lib/checkbool.cpp @@ -380,18 +380,18 @@ void CheckBool::pointerArithBool() { const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase(); - for (std::list::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { - if (scope->type != Scope::eIf && scope->type != Scope::eWhile && scope->type != Scope::eDo && scope->type != Scope::eFor) + for (const Scope &scope : symbolDatabase->scopeList) { + if (scope.type != Scope::eIf && scope.type != Scope::eWhile && scope.type != Scope::eDo && scope.type != Scope::eFor) continue; - const Token* tok = scope->classDef->next()->astOperand2(); - if (scope->type == Scope::eFor) { - tok = Token::findsimplematch(scope->classDef->tokAt(2), ";"); + const Token* tok = scope.classDef->next()->astOperand2(); + if (scope.type == Scope::eFor) { + tok = Token::findsimplematch(scope.classDef->tokAt(2), ";"); if (tok) tok = tok->astOperand2(); if (tok) tok = tok->astOperand1(); - } else if (scope->type == Scope::eDo) - tok = (scope->classEnd->tokAt(2)) ? scope->classEnd->tokAt(2)->astOperand2() : nullptr; + } else if (scope.type == Scope::eDo) + tok = (scope.classEnd->tokAt(2)) ? scope.classEnd->tokAt(2)->astOperand2() : nullptr; pointerArithBoolCond(tok); }