From a7c7b00407b2e624ad75af2c7fc050ad958d1ac2 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 24 Apr 2014 12:24:40 +0400 Subject: [PATCH] Reuse variable value, return earlier. --- lib/checkbufferoverrun.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 48a527bad..cd9c71df4 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -818,8 +818,6 @@ void CheckBufferOverrun::checkFunctionCall(const Token *tok, const ArrayInfo &ar void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &arrayInfo, bool &bailout) { bailout = false; - const Token *tok2 = tok->tokAt(2); - const MathLib::bigint size = arrayInfo.num(0); // Check if there is a break in the body.. { @@ -829,6 +827,9 @@ void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &ar return; } + const Token *tok2 = tok->tokAt(2); + const MathLib::bigint size = arrayInfo.num(0); + std::string counter_name; unsigned int counter_varid = 0; std::string counter_init_value; @@ -951,7 +952,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector