diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 29cf6d099..bd69a3f43 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2539,23 +2539,12 @@ static void setVarIdStructMembers(Token **tok1, if (TemplateSimplifier::templateParameters(tok->next()) > 0) break; - std::map >::iterator structIterator; - structIterator = structMembers->find(struct_varid); - if (structIterator == structMembers->end()) { - std::map members; - members[tok->str()] = ++ (*_varId); - (*structMembers)[struct_varid] = members; + std::map& members = (*structMembers)[struct_varid]; + if (members.empty() || members.find(tok->str()) == members.end()) { + members[tok->str()] = ++(*_varId); tok->varId(*_varId); } else { - std::map &members = structIterator->second; - std::map::const_iterator memberIterator; - memberIterator = members.find(tok->str()); - if (memberIterator == members.end()) { - members[tok->str()] = ++(*_varId); - tok->varId(*_varId); - } else { - tok->varId(memberIterator->second); - } + tok->varId(members[tok->str()]); } } if (tok)