Merge pull request #289 from Dmitry-Me/ReuseVariableAndReturnEarlier
Reuse variable value, return earlier.
This commit is contained in:
commit
76dcd271f6
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue