From be49abf4601cdef57c9f99c6f82c40b1aed0bc52 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 3 Dec 2015 11:03:18 +0300 Subject: [PATCH] Eliminate repeated lookup --- lib/preprocessor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 7857364b0..29e408146 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1840,8 +1840,9 @@ std::string Preprocessor::getcode(const std::string &filedata, const std::string cfgmap[line.substr(8)] = ""; else if (line[pos] == ' ') { std::string value(line.substr(pos + 1)); - if (cfgmap.find(value) != cfgmap.end()) - value = cfgmap[value]; + std::map::const_iterator cfgpos = cfgmap.find(value); + if (cfgpos != cfgmap.end()) + value = cfgpos->second; cfgmap[line.substr(8, pos - 8)] = value; } else cfgmap[line.substr(8, pos - 8)] = "";