Refactoring: Use range for loop

This commit is contained in:
Daniel Marjamäki 2018-04-20 22:10:29 +02:00
parent 46bb63ceaf
commit 3fdb2da0d1
1 changed files with 2 additions and 5 deletions

View File

@ -49,9 +49,7 @@ void Check64BitPortability::pointerassignment()
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase(); const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
// Check return values // Check return values
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->function == nullptr || !scope->function->hasBody()) // We only look for functions with a body if (scope->function == nullptr || !scope->function->hasBody()) // We only look for functions with a body
continue; continue;
@ -89,8 +87,7 @@ void Check64BitPortability::pointerassignment()
} }
// Check assignments // Check assignments
for (std::size_t i = 0; i < functions; ++i) { for (const Scope * scope : symbolDatabase->functionScopes) {
const Scope * scope = symbolDatabase->functionScopes[i];
for (const Token *tok = scope->classStart; tok && tok != scope->classEnd; tok = tok->next()) { for (const Token *tok = scope->classStart; tok && tok != scope->classEnd; tok = tok->next()) {
if (tok->str() != "=") if (tok->str() != "=")
continue; continue;