From 398588ebb7dcd4579b869233b6638f2ba160b5b4 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 17 Aug 2024 12:01:17 +1200 Subject: [PATCH] logcmd: Only strip quotes on single arg --- passes/cmds/logcmd.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/passes/cmds/logcmd.cc b/passes/cmds/logcmd.cc index c6cba1115df..d3325b001bd 100644 --- a/passes/cmds/logcmd.cc +++ b/passes/cmds/logcmd.cc @@ -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";