tokenize: Minor refactorings

This commit is contained in:
Daniel Marjamäki 2008-12-05 18:25:08 +00:00
parent 89663bef0a
commit 09f7c07a4d
1 changed files with 2 additions and 3 deletions

View File

@ -901,7 +901,7 @@ void Tokenizer::simplifyTokenList()
if (tok2) if (tok2)
{ {
if (tok2->aaaa0() == ',') if (tok2->str() == ",")
{ {
tok2->setstr(";"); tok2->setstr(";");
InsertTokens(tok2, type0, typelen); InsertTokens(tok2, type0, typelen);
@ -1008,8 +1008,7 @@ bool Tokenizer::simplifyConditions()
// Reduce "(%num% == %num%)" => "(true)"/"(false)" // Reduce "(%num% == %num%)" => "(true)"/"(false)"
if ( (TOKEN::Match(tok, "&&") || TOKEN::Match(tok, "||") || TOKEN::Match(tok, "(")) && if ( (TOKEN::Match(tok, "&&") || TOKEN::Match(tok, "||") || TOKEN::Match(tok, "(")) &&
TOKEN::Match(tok->tokAt(1), "%num%") && TOKEN::Match(tok->tokAt(1), "%num% %any% %num%") &&
TOKEN::Match(tok->tokAt(3), "%num%") &&
(TOKEN::Match(tok->tokAt(4), "&&") || TOKEN::Match(tok->tokAt(4), "||") || TOKEN::Match(tok->tokAt(4), ")")) ) (TOKEN::Match(tok->tokAt(4), "&&") || TOKEN::Match(tok->tokAt(4), "||") || TOKEN::Match(tok->tokAt(4), ")")) )
{ {
double op1 = (strstr(tok->strAt(1), "0x")) ? strtol(tok->strAt(1),0,16) : atof( tok->strAt(1) ); double op1 = (strstr(tok->strAt(1), "0x")) ? strtol(tok->strAt(1),0,16) : atof( tok->strAt(1) );