From b17f2eea1653cd351e2ce95c0c2fce3e7693d3b4 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Mon, 22 Sep 2014 15:54:17 +0400 Subject: [PATCH] Cache search result to avoid dual search --- lib/tokenize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 623b78a7e..95be85d43 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -7526,8 +7526,9 @@ public: void simplify(const std::map &enumValues) { for (Token *tok = start; tok; tok = tok->next()) { - if (enumValues.find(tok->str()) != enumValues.end()) { - const EnumValue &other = enumValues.find(tok->str())->second; + std::map::const_iterator it = enumValues.find(tok->str()); + if (it != enumValues.end()) { + const EnumValue &other = it->second; if (other.value != nullptr) tok->str(other.value->str()); else {