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.
This commit is contained in:
Tomas Babej 2021-08-28 20:28:32 -04:00
parent 2619435148
commit 8b30046d0a

View file

@ -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;
}