@@ -1331,7 +1331,9 @@ simplecpp::Token * simplecpp::TokenList::foldLogicalOpToSingleValue(Token *tok,
1331
1331
tok = (step)(tok);
1332
1332
deleteToken (oldToken);
1333
1333
} else {
1334
- deleteToken (tok);
1334
+ Token * oldToken = tok;
1335
+ tok = (step)(tok);
1336
+ deleteToken (oldToken);
1335
1337
break ;
1336
1338
}
1337
1339
}
@@ -1363,20 +1365,20 @@ void simplecpp::TokenList::constFoldLogicalOp(Token *tok)
1363
1365
breakPoints.insert (" :" );
1364
1366
breakPoints.insert (" ?" );
1365
1367
if (tok->str () == " ||" ){
1366
- if (stringToLL (tok->previous ->str ()) != 0 ) {
1368
+ if (stringToLL (tok->previous ->str ())) {
1367
1369
tok = foldLogicalOpToSingleValue (tok->previous , breakPoints, &stepForward, std::make_pair<std::string, std::string>(" (" , " )" ), " 1" );
1368
1370
break ;
1369
- } else if (stringToLL (tok->next ->str ()) != 0 ) {
1371
+ } else if (stringToLL (tok->next ->str ())) {
1370
1372
tok = foldLogicalOpToSingleValue (tok->next , breakPoints, &stepBack, std::make_pair<std::string, std::string>(" )" , " (" ), " 1" );
1371
1373
break ;
1372
1374
}
1373
1375
result = 0 ;
1374
1376
} else /* if (tok->str() == "&&")*/ {
1375
1377
breakPoints.insert (" ||" );
1376
- if (stringToLL (tok->previous ->str ()) == 0 ) {
1378
+ if (! stringToLL (tok->previous ->str ())) {
1377
1379
tok = foldLogicalOpToSingleValue (tok->previous , breakPoints, &stepForward, std::make_pair<std::string, std::string>(" (" , " )" ), " 0" );
1378
1380
break ;
1379
- } else if (stringToLL (tok->next ->str ()) == 0 ) {
1381
+ } else if (! stringToLL (tok->next ->str ())) {
1380
1382
tok = foldLogicalOpToSingleValue (tok->next , breakPoints, &stepBack, std::make_pair<std::string, std::string>(" )" , " (" ), " 0" );
1381
1383
break ;
1382
1384
}
0 commit comments