Merge pull request #713 from Dmitry-Me/eliminateRepeatedLookup2

Eliminate repeated lookup
This commit is contained in:
amai2012 2015-12-03 10:18:08 +01:00
commit f624f6fc25
1 changed files with 3 additions and 2 deletions

View File

@ -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<std::string, std::string>::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)] = "";