From 8f8ba65a295cf797c5068445359281e39bb245f0 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Wed, 18 Mar 2015 11:52:09 +0300 Subject: [PATCH] Eliminate repeated lookup --- lib/tokenize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d61ea782d..7754d3847 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2409,11 +2409,12 @@ static void setVarIdStructMembers(Token **tok1, break; std::map& members = (*structMembers)[struct_varid]; - if (members.empty() || members.find(tok->str()) == members.end()) { + const std::map::iterator it = members.find(tok->str()); + if (it == members.end()) { members[tok->str()] = ++(*_varId); tok->varId(*_varId); } else { - tok->varId(members[tok->str()]); + tok->varId(it->second); } } // tok can't be null