mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI2: Pre-reserve the size of the escaped string
This commit is contained in:
parent
c119b6d1de
commit
ddf2f122a2
1 changed files with 4 additions and 2 deletions
|
@ -422,10 +422,12 @@ void CLI2::lexArguments ()
|
||||||
|
|
||||||
// Escape unescaped single quotes
|
// Escape unescaped single quotes
|
||||||
std::string escaped = "";
|
std::string escaped = "";
|
||||||
|
|
||||||
|
// For performance reasons. The escaped string is as long as the original.
|
||||||
|
escaped.reserve (_original_args[i].attribute ("raw").size ());
|
||||||
|
|
||||||
std::string::size_type cursor = 0;
|
std::string::size_type cursor = 0;
|
||||||
|
|
||||||
bool nextEscaped = false;
|
bool nextEscaped = false;
|
||||||
|
|
||||||
while (int num = utf8_next_char (_original_args[i].attribute ("raw"), cursor))
|
while (int num = utf8_next_char (_original_args[i].attribute ("raw"), cursor))
|
||||||
{
|
{
|
||||||
std::string character = utf8_character (num);
|
std::string character = utf8_character (num);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue