Skip to content

Commit 1af91ac

Browse files
committed
Nits 7
1 parent 262e44d commit 1af91ac

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

simplecpp.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,9 @@ simplecpp::Token * simplecpp::TokenList::foldLogicalOpToSingleValue(Token *tok,
13311331
tok = (step)(tok);
13321332
deleteToken(oldToken);
13331333
} else {
1334-
deleteToken(tok);
1334+
Token * oldToken = tok;
1335+
tok = (step)(tok);
1336+
deleteToken(oldToken);
13351337
break;
13361338
}
13371339
}
@@ -1363,20 +1365,20 @@ void simplecpp::TokenList::constFoldLogicalOp(Token *tok)
13631365
breakPoints.insert(":");
13641366
breakPoints.insert("?");
13651367
if (tok->str() == "||"){
1366-
if (stringToLL(tok->previous->str()) != 0) {
1368+
if (stringToLL(tok->previous->str())) {
13671369
tok = foldLogicalOpToSingleValue(tok->previous, breakPoints, &stepForward, std::make_pair<std::string, std::string>("(", ")"), "1");
13681370
break;
1369-
} else if (stringToLL(tok->next->str()) != 0) {
1371+
} else if (stringToLL(tok->next->str())) {
13701372
tok = foldLogicalOpToSingleValue(tok->next, breakPoints, &stepBack, std::make_pair<std::string, std::string>(")", "("), "1");
13711373
break;
13721374
}
13731375
result = 0;
13741376
} else /*if (tok->str() == "&&")*/ {
13751377
breakPoints.insert("||");
1376-
if (stringToLL(tok->previous->str()) == 0) {
1378+
if (!stringToLL(tok->previous->str())) {
13771379
tok = foldLogicalOpToSingleValue(tok->previous, breakPoints, &stepForward, std::make_pair<std::string, std::string>("(", ")"), "0");
13781380
break;
1379-
} else if (stringToLL(tok->next->str()) == 0) {
1381+
} else if (!stringToLL(tok->next->str())) {
13801382
tok = foldLogicalOpToSingleValue(tok->next, breakPoints, &stepBack, std::make_pair<std::string, std::string>(")", "("), "0");
13811383
break;
13821384
}

0 commit comments

Comments
 (0)