Refactor lib/checkuninitvar.cpp
This commit is contained in:
parent
15b5b7ebf4
commit
d2160f00b2
|
@ -57,7 +57,6 @@ static const struct CWE CWE825(825U);
|
|||
void CheckUninitVar::check()
|
||||
{
|
||||
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||
std::list<Scope>::const_iterator scope;
|
||||
|
||||
std::set<std::string> 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<Scope>::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<Scope>::const_iterator scope;
|
||||
|
||||
// check every executable scope
|
||||
for (scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) {
|
||||
for (std::list<Scope>::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<Scope>::const_iterator scope;
|
||||
|
||||
// check every executable scope
|
||||
for (scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) {
|
||||
for (std::list<Scope>::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) {
|
||||
if (!scope->isExecutable())
|
||||
continue;
|
||||
// Dead pointers..
|
||||
|
|
Loading…
Reference in New Issue