From b3ace258ab73668c2663b4163941e6df827686f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 26 Nov 2016 17:08:36 +0100 Subject: [PATCH] there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already. --- lib/checkio.cpp | 2 +- lib/checkuninitvar.cpp | 2 +- lib/checkunusedvar.cpp | 2 +- lib/symboldatabase.cpp | 2 +- lib/templatesimplifier.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/checkio.cpp b/lib/checkio.cpp index 77c015134..e57bbbcad 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -1723,7 +1723,7 @@ bool CheckIO::ArgumentInfo::isArrayOrPointer() const return variableInfo->isArrayOrPointer(); } else { const Token *tok = typeToken; - while (tok && Token::Match(tok, "const|struct")) + while (Token::Match(tok, "const|struct")) tok = tok->next(); if (tok && tok->strAt(1) == "*") return true; diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index d659dce62..a3a460813 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -985,7 +985,7 @@ bool CheckUninitVar::isVariableUsage(const Token *vartok, bool pointer, Alloc al if (_tokenizer->isCPP() && Token::Match(vartok->next(), "<<|>>")) { // Is this calculation done in rhs? const Token *tok = vartok; - while (tok && Token::Match(tok, "%name%|.|::")) + while (Token::Match(tok, "%name%|.|::")) tok = tok->previous(); if (Token::Match(tok, "[;{}]")) return false; diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index a6b007725..a62fbfdab 100644 --- a/lib/checkunusedvar.cpp +++ b/lib/checkunusedvar.cpp @@ -449,7 +449,7 @@ static const Token* doAssignment(Variables &variables, const Token *tok, bool de tok = tok->next(); if (Token::Match(tok, "(| &| %name%") || - (tok && Token::Match(tok->next(), "< const| struct|union| %type% *| > ( &| %name%"))) { + (Token::Match(tok->next(), "< const| struct|union| %type% *| > ( &| %name%"))) { bool addressOf = false; if (Token::Match(tok, "%var% .")) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 27171595f..e13239c00 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -240,7 +240,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti tok = tok->tokAt(3); // skip over qualification - while (tok && Token::Match(tok, "%type% ::")) + while (Token::Match(tok, "%type% ::")) tok = tok->tokAt(2); } diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 56ddff8d7..13fa698f0 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -245,7 +245,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok) } // Skip '=', '?', ':' - if (tok && Token::Match(tok, "=|?|:")) + if (Token::Match(tok, "=|?|:")) tok = tok->next(); if (!tok) return 0;