Merge pull request #437 from Dmitry-Me/reorderChecksUnwrapCode

Reorder checks, unwrap code
This commit is contained in:
PKEuS 2014-09-16 10:53:42 +02:00
commit 67c9356455
1 changed files with 2 additions and 2 deletions

View File

@ -1233,7 +1233,7 @@ static bool valueFlowForLoop1(const Token *tok, unsigned int * const varid, Math
tok = tok->tokAt(2); tok = tok->tokAt(2);
if (!Token::Match(tok,"%type%| %var% =")) if (!Token::Match(tok,"%type%| %var% ="))
return false; return false;
const Token * const vartok = tok->tokAt(Token::Match(tok, "%var% =") ? 0 : 1); const Token * const vartok = Token::Match(tok, "%var% =") ? tok : tok->next();
if (vartok->varId() == 0U) if (vartok->varId() == 0U)
return false; return false;
*varid = vartok->varId(); *varid = vartok->varId();
@ -1492,7 +1492,7 @@ static void valueFlowSubFunction(TokenList *tokenlist, ErrorLogger *errorLogger,
std::list<ValueFlow::Value> argvalues; std::list<ValueFlow::Value> argvalues;
// passing value(s) to function // passing value(s) to function
if (Token::Match(argtok, "%var%|%num%|%str% [,)]") && !argtok->values.empty()) if (!argtok->values.empty() && Token::Match(argtok, "%var%|%num%|%str% [,)]"))
argvalues = argtok->values; argvalues = argtok->values;
else { else {
// bool operator => values 1/0 are passed to function.. // bool operator => values 1/0 are passed to function..