Merge pull request #289 from Dmitry-Me/ReuseVariableAndReturnEarlier

Reuse variable value, return earlier.
This commit is contained in:
PKEuS 2014-04-24 10:53:42 +02:00
commit 76dcd271f6
1 changed files with 4 additions and 3 deletions

View File

@ -818,8 +818,6 @@ void CheckBufferOverrun::checkFunctionCall(const Token *tok, const ArrayInfo &ar
void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &arrayInfo, bool &bailout) void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &arrayInfo, bool &bailout)
{ {
bailout = false; bailout = false;
const Token *tok2 = tok->tokAt(2);
const MathLib::bigint size = arrayInfo.num(0);
// Check if there is a break in the body.. // Check if there is a break in the body..
{ {
@ -829,6 +827,9 @@ void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &ar
return; return;
} }
const Token *tok2 = tok->tokAt(2);
const MathLib::bigint size = arrayInfo.num(0);
std::string counter_name; std::string counter_name;
unsigned int counter_varid = 0; unsigned int counter_varid = 0;
std::string counter_init_value; std::string counter_init_value;
@ -951,7 +952,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
return; return;
} }
const MathLib::bigint total_size = arrayInfo.element_size() * arrayInfo.num(0); const MathLib::bigint total_size = arrayInfo.element_size() * size;
const unsigned int declarationId = arrayInfo.declarationId(); const unsigned int declarationId = arrayInfo.declarationId();
std::string varnames; std::string varnames;