From 8b30046d0a2486d1c61f7903cd06a0551e2cb4af Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 28 Aug 2021 20:28:32 -0400 Subject: [PATCH] CLI2: Simplify code by using const quote string The "\'" string is equal to "'", which is already stored in the quote variable, so we might as well use that. Thanks to Sebastian Uharek for the review suggestion. --- src/CLI2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 8866179ee..4a8e7fda7 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -418,7 +418,7 @@ void CLI2::lexArguments () // Process multiple-token arguments. else { - std::string quote = "'"; + const std::string quote = "'"; // Escape unescaped single quotes std::string escaped = ""; @@ -434,7 +434,7 @@ void CLI2::lexArguments () if (!nextEscaped && (character == "\\")) nextEscaped = true; else { - if (character == "\'" && !nextEscaped) + if (character == quote && !nextEscaped) escaped += "\\"; nextEscaped = false; }