Fixed failing self-check: style: Call to 'Token::previous()' followed by 'Token::tokAt()' can be simplified. [redundantNextPrevious]
This commit is contained in:
parent
886b5d1039
commit
3b2509c9cc
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue