From c829dff2b9bafd6bae02357b765df87fce979f38 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 17 Jul 2014 10:44:19 +0400 Subject: [PATCH] Use temp variable to omit recomputing the same value. --- lib/checkautovariables.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index acfcb47f3..a6791315b 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -108,7 +108,8 @@ static bool variableIsUsedInScope(const Token* start, unsigned int varId, const for (const Token *tok = start; tok && tok != scope->classEnd; tok = tok->next()) { if (tok->varId() == varId) return true; - if (tok->scope()->type == Scope::eFor || tok->scope()->type == Scope::eDo || tok->scope()->type == Scope::eWhile) // In case of loops, better checking would be necessary + const Scope::ScopeType scopeType = tok->scope()->type; + if (scopeType == Scope::eFor || scopeType == Scope::eDo || scopeType == Scope::eWhile) // In case of loops, better checking would be necessary return true; if (Token::simpleMatch(tok, "asm (")) return true;