| 395 | } |
| 396 | |
| 397 | static bool ifvar(const Token *tok, nonneg int varid, const std::string &comp, const std::string &rhs) |
| 398 | { |
| 399 | if (!Token::simpleMatch(tok, "if (")) |
| 400 | return false; |
| 401 | const Token *condition = tok->next()->astOperand2(); |
| 402 | if (condition && condition->str() == "(" && Token::Match(condition->astOperand1(), "UNLIKELY|LIKELY")) |
| 403 | condition = condition->astOperand2(); |
| 404 | if (!condition || condition->str() == "&&") |
| 405 | return false; |
| 406 | |
| 407 | const Token *vartok = astIsVariableComparison(condition, comp, rhs); |
| 408 | return (vartok && vartok->varId() == varid); |
| 409 | } |
| 410 | |
| 411 | //--------------------------------------------------------------------------- |
| 412 | // Check for memory leaks due to improper realloc() usage. |
no test coverage detected