Tokenizer: use list.back() when we start the loop backwards.

This commit is contained in:
Edoardo Prezioso 2012-11-29 17:42:31 +01:00
parent 233b7ddb4c
commit e214d94589
1 changed files with 1 additions and 5 deletions

View File

@ -4003,11 +4003,7 @@ bool Tokenizer::simplifyIfAddBraces()
void Tokenizer::simplifyDoWhileAddBraces()
{
//start from the last token and proceed backwards
Token *last = list.front();
while (last && last->next())
last = last->next();
for (Token *tok = last; tok; tok = tok->previous()) {
for (Token *tok = list.back(); tok; tok = tok->previous()) {
// fix for #988
if (tok->str() == ")" || tok->str() == "]" ||
(tok->str() == "}" && tok->link()->previous() &&