From eeda082a2f20975b625b79a5463fe9fe5183d63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 14 Jul 2018 09:54:52 +0200 Subject: [PATCH] Refactoring: use range for loops --- lib/checkleakautovar.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/checkleakautovar.cpp b/lib/checkleakautovar.cpp index 842f9cded..79e00d41e 100644 --- a/lib/checkleakautovar.cpp +++ b/lib/checkleakautovar.cpp @@ -155,9 +155,7 @@ void CheckLeakAutoVar::check() const std::set notzero; // Check function scopes - const std::size_t functions = symbolDatabase->functionScopes.size(); - for (std::size_t i = 0; i < functions; ++i) { - const Scope * scope = symbolDatabase->functionScopes[i]; + for (const Scope * scope : symbolDatabase->functionScopes) { if (scope->hasInlineOrLambdaFunction()) continue; @@ -416,8 +414,7 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken, continue; } else if (tok3->str() == "(" && Token::Match(tok3->previous(), "%name%")) { const std::vector params = getArguments(tok3->previous()); - for (unsigned int i = 0; i < params.size(); ++i) { - const Token *par = params[i]; + for (const Token *par : params) { if (!par->isComparisonOp()) continue; const Token *vartok = nullptr;