Skip to content

Commit 922bb96

Browse files
CheckUninitVar: avoid redundant find() (#8321)
Co-authored-by: chrchr-github <noreply@github.com>
1 parent 1b9124e commit 922bb96

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/checkuninitvar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static void conditionAlwaysTrueOrFalse(const Token *tok, const std::map<nonneg i
304304
if (tok->isName() || tok->str() == ".") {
305305
while (tok && tok->str() == ".")
306306
tok = tok->astOperand2();
307-
const auto it = utils::as_const(variableValue).find(tok ? tok->varId() : ~0U);
307+
const auto it = tok ? variableValue.find(tok->varId()) : variableValue.end();
308308
if (it != variableValue.end()) {
309309
*alwaysTrue = (it->second != 0LL);
310310
*alwaysFalse = (it->second == 0LL);
@@ -330,7 +330,7 @@ static void conditionAlwaysTrueOrFalse(const Token *tok, const std::map<nonneg i
330330
while (vartok && vartok->str() == ".")
331331
vartok = vartok->astOperand2();
332332

333-
const auto it = utils::as_const(variableValue).find(vartok ? vartok->varId() : ~0U);
333+
const auto it = vartok ? variableValue.find(vartok->varId()) : variableValue.end();
334334
if (it == variableValue.end())
335335
return;
336336

0 commit comments

Comments
 (0)