@@ -1052,11 +1052,11 @@ void CheckClass::checkMemset()
10521052 type = typeTok->type ()->classScope ;
10531053
10541054 if (type) {
1055- std::list <const Scope *> parsedTypes;
1055+ std::set <const Scope *> parsedTypes;
10561056 checkMemsetType (scope, tok, type, false , parsedTypes);
10571057 }
10581058 } else if (tok->variable () && tok->variable ()->typeScope () && Token::Match (tok, " %var% = calloc|malloc|realloc|g_malloc|g_try_malloc|g_realloc|g_try_realloc (" )) {
1059- std::list <const Scope *> parsedTypes;
1059+ std::set <const Scope *> parsedTypes;
10601060 checkMemsetType (scope, tok->tokAt (2 ), tok->variable ()->typeScope (), true , parsedTypes);
10611061
10621062 if (tok->variable ()->typeScope ()->numConstructors > 0 && printWarnings)
@@ -1066,12 +1066,12 @@ void CheckClass::checkMemset()
10661066 }
10671067}
10681068
1069- void CheckClass::checkMemsetType (const Scope *start, const Token *tok, const Scope *type, bool allocation, std::list <const Scope *> parsedTypes)
1069+ void CheckClass::checkMemsetType (const Scope *start, const Token *tok, const Scope *type, bool allocation, std::set <const Scope *> parsedTypes)
10701070{
10711071 // If type has been checked there is no need to check it again
1072- if (std::find ( parsedTypes.begin (), parsedTypes. end (), type) != parsedTypes.end ())
1072+ if (parsedTypes.find ( type) != parsedTypes.end ())
10731073 return ;
1074- parsedTypes.push_back (type);
1074+ parsedTypes.insert (type);
10751075
10761076 const bool printPortability = _settings->isEnabled (" portability" );
10771077
0 commit comments