Simplify code for finding string format token

This commit is contained in:
Dmitry-Me 2017-10-02 18:03:55 +03:00
parent e9b4cbbd87
commit 4601e40615
1 changed files with 6 additions and 2 deletions

View File

@ -480,8 +480,12 @@ static bool findFormat(unsigned int arg, const Token *firstArg,
argTok->variable()->dimensionKnown(0) &&
argTok->variable()->dimension(0) != 0))) {
*formatArgTok = argTok->nextArgument();
if (!argTok->values().empty() && argTok->values().front().isTokValue() && argTok->values().front().tokvalue && argTok->values().front().tokvalue->tokType() == Token::eString)
*formatStringTok = argTok->values().front().tokvalue;
if (!argTok->values().empty()) {
const ValueFlow::Value &value = argTok->values().front();
if (value.isTokValue() && value.tokvalue && value.tokvalue->tokType() == Token::eString) {
*formatStringTok = value.tokvalue;
}
}
return true;
}
return false;