Combined consecutive Token::simpleMatch() calls

This commit is contained in:
orbitcowboy 2022-06-02 07:27:19 +02:00
parent 3b2509c9cc
commit 7275350f3e
1 changed files with 3 additions and 3 deletions

View File

@ -144,12 +144,12 @@ 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->tokAt(-2);
const Token* const countTok = varTok->tokAt(-2);
if (countTok && countTok->hasKnownIntValue())
count = countTok->getKnownIntValue();
}
if (Token::simpleMatch(varTok, "=") && Token::simpleMatch(varTok->next(), "{")) {
varTok = varTok->next();
if (Token::simpleMatch(varTok, "= {")) {
varTok = varTok->tokAt(1);
auto actualCharCount = 0;
while (varTok && !Token::simpleMatch(varTok->next(), "}")) {
if (!Token::simpleMatch(varTok->next(), ","))