Merge pull request #502 from Dmitry-Me/cacheAndReuseTokenPointer
Cache and reuse token pointer
This commit is contained in:
commit
a5b633378c
|
@ -926,9 +926,10 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
|
||||||
if (isWarningEnabled && num >= total_size && _settings->inconclusive) {
|
if (isWarningEnabled && num >= total_size && _settings->inconclusive) {
|
||||||
const Token *tok2 = tok->next()->link()->next();
|
const Token *tok2 = tok->next()->link()->next();
|
||||||
for (; tok2; tok2 = tok2->next()) {
|
for (; tok2; tok2 = tok2->next()) {
|
||||||
if (tok2->varId() == tok->tokAt(2)->varId()) {
|
const Token* tok3 = tok->tokAt(2);
|
||||||
if (!Token::Match(tok2, "%varid% [ %any% ] = 0 ;", tok->tokAt(2)->varId())) {
|
if (tok2->varId() == tok3->varId()) {
|
||||||
terminateStrncpyError(tok, tok->strAt(2));
|
if (!Token::Match(tok2, "%varid% [ %any% ] = 0 ;", tok3->varId())) {
|
||||||
|
terminateStrncpyError(tok, tok3->str());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue