From 64bdf0398616f0ffb72e85b9bb21057a2d24de1c Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 15 Oct 2015 16:48:35 +0300 Subject: [PATCH] Remove repeated search, clearer code --- lib/tokenize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 9ffaa6940..f5e4617dc 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3133,11 +3133,12 @@ bool Tokenizer::simplifySizeof() // sizeof( a ) else if (Token::Match(tok->next(), "( %var% )")) { - if (sizeOfVar.find(tok->tokAt(2)->varId()) != sizeOfVar.end()) { + std::map::const_iterator sizeOfVarPos = sizeOfVar.find(tok->tokAt(2)->varId()); + if (sizeOfVarPos != sizeOfVar.end()) { tok->deleteNext(); tok->deleteThis(); tok->deleteNext(); - tok->str(MathLib::toString(sizeOfVar[tok->varId()])); + tok->str(MathLib::toString(sizeOfVarPos->second)); ret = true; } else { // don't try to replace size of variable if variable has