From 3b2509c9cc4129ca4d2d9781872b05d40cb6f349 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Thu, 2 Jun 2022 07:16:09 +0200 Subject: [PATCH] Fixed failing self-check: style: Call to 'Token::previous()' followed by 'Token::tokAt()' can be simplified. [redundantNextPrevious] --- lib/checkfunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index 2ef3e258a..de0f0c409 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -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. if (varTok && Token::simpleMatch(varTok->previous(), "]")) { - const Token* countTok = varTok->previous()->tokAt(-1); + const Token* countTok = varTok->tokAt(-2); if (countTok && countTok->hasKnownIntValue()) count = countTok->getKnownIntValue(); }