Fixed failing self-check: style: Call to 'Token::previous()' followed by 'Token::tokAt()' can be simplified. [redundantNextPrevious]

This commit is contained in:
orbitcowboy 2022-06-02 07:16:09 +02:00
parent 886b5d1039
commit 3b2509c9cc
1 changed files with 1 additions and 1 deletions

View File

@ -144,7 +144,7 @@ void CheckFunctions::invalidFunctionUsage()
auto count = -1; // Find out explicitly set count, e.g.: char buf[3] = {...}. Variable 'count' is set to 3 then. auto count = -1; // Find out explicitly set count, e.g.: char buf[3] = {...}. Variable 'count' is set to 3 then.
if (varTok && Token::simpleMatch(varTok->previous(), "]")) if (varTok && Token::simpleMatch(varTok->previous(), "]"))
{ {
const Token* countTok = varTok->previous()->tokAt(-1); const Token* countTok = varTok->tokAt(-2);
if (countTok && countTok->hasKnownIntValue()) if (countTok && countTok->hasKnownIntValue())
count = countTok->getKnownIntValue(); count = countTok->getKnownIntValue();
} }