Merge pull request #446 from Dmitry-Me/eliminateDualSearch

Cache search result to avoid dual search
This commit is contained in:
amai2012 2014-09-22 20:48:36 +02:00
commit 47a3548bea
1 changed files with 3 additions and 2 deletions

View File

@ -7526,8 +7526,9 @@ public:
void simplify(const std::map<std::string, EnumValue> &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<std::string, EnumValue>::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 {