Skip to content

Commit

Permalink
logcmd: Only strip quotes on single arg
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion committed Aug 17, 2024
1 parent db90d1a commit 398588e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions passes/cmds/logcmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,15 @@ struct LogPass : public Pass {
if (push) { log_push(); return; }
if (pop) { log_pop(); return; }

for (; argidx < args.size(); argidx++)
text += args[argidx] + ' ';
if (!text.empty()) text.resize(text.size()-1);

if (text.size() > 1 && text[0] == '"' && text[text.size()-1] == '"')
text = text.substr(1, text.size()-2);
text = args[argidx++];
if (argidx < args.size()) {
for (; argidx < args.size(); argidx++) {
text += ' ' + args[argidx];
}
} else {
if (text.size() > 1 && text[0] == '"' && text[text.size()-1] == '"')
text = text.substr(1, text.size()-2);
}

const char *fmtline = newline ? "%s\n" : "%s";

Expand Down

0 comments on commit 398588e

Please sign in to comment.