Refactoring: use range for loops

This commit is contained in:
Daniel Marjamäki 2018-07-14 09:54:52 +02:00
parent bb36adb432
commit eeda082a2f
1 changed files with 2 additions and 5 deletions

View File

@ -155,9 +155,7 @@ void CheckLeakAutoVar::check()
const std::set<unsigned int> notzero; const std::set<unsigned int> notzero;
// Check function scopes // Check function scopes
const std::size_t functions = symbolDatabase->functionScopes.size(); for (const Scope * scope : symbolDatabase->functionScopes) {
for (std::size_t i = 0; i < functions; ++i) {
const Scope * scope = symbolDatabase->functionScopes[i];
if (scope->hasInlineOrLambdaFunction()) if (scope->hasInlineOrLambdaFunction())
continue; continue;
@ -416,8 +414,7 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken,
continue; continue;
} else if (tok3->str() == "(" && Token::Match(tok3->previous(), "%name%")) { } else if (tok3->str() == "(" && Token::Match(tok3->previous(), "%name%")) {
const std::vector<const Token *> params = getArguments(tok3->previous()); const std::vector<const Token *> params = getArguments(tok3->previous());
for (unsigned int i = 0; i < params.size(); ++i) { for (const Token *par : params) {
const Token *par = params[i];
if (!par->isComparisonOp()) if (!par->isComparisonOp())
continue; continue;
const Token *vartok = nullptr; const Token *vartok = nullptr;