Reuse variable value, return earlier.

This commit is contained in:
Dmitry-Me 2014-04-24 12:24:40 +04:00
parent 9406f3428a
commit a7c7b00407
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)
{
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<std::str
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();
std::string varnames;