From d2160f00b2513a415e83b69239dd178af5497fe6 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Fri, 6 Apr 2018 08:04:06 +0200 Subject: [PATCH] Refactor lib/checkuninitvar.cpp --- lib/checkuninitvar.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index a34b4fa04..fc25e6de6 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -57,7 +57,6 @@ static const struct CWE CWE825(825U); void CheckUninitVar::check() { const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase(); - std::list::const_iterator scope; std::set arrayTypeDefs; for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { @@ -66,7 +65,7 @@ void CheckUninitVar::check() } // check every executable scope - for (scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { + for (std::list::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { if (scope->isExecutable()) { checkScope(&*scope, arrayTypeDefs); } @@ -1226,10 +1225,9 @@ void CheckUninitVar::uninitStructMemberError(const Token *tok, const std::string void CheckUninitVar::valueFlowUninit() { const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase(); - std::list::const_iterator scope; // check every executable scope - for (scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { + for (std::list::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { if (!scope->isExecutable()) continue; for (const Token* tok = scope->classStart; tok != scope->classEnd; tok = tok->next()) { @@ -1252,10 +1250,9 @@ void CheckUninitVar::valueFlowUninit() void CheckUninitVar::deadPointer() { const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase(); - std::list::const_iterator scope; // check every executable scope - for (scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { + for (std::list::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { if (!scope->isExecutable()) continue; // Dead pointers..