mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
JSON: Added std::string::reserve to compensate for growth
This commit is contained in:
parent
6ce3285c77
commit
b4fc2b5583
1 changed files with 3 additions and 0 deletions
|
@ -377,6 +377,7 @@ json::value* json::parse (const std::string& input)
|
|||
std::string json::encode (const std::string& input)
|
||||
{
|
||||
std::string output;
|
||||
output.reserve ((input.size () * 6) / 5); // 20% increase.
|
||||
|
||||
for (auto& i : input)
|
||||
{
|
||||
|
@ -405,6 +406,8 @@ std::string json::encode (const std::string& input)
|
|||
std::string json::decode (const std::string& input)
|
||||
{
|
||||
std::string output;
|
||||
output.reserve (input.size ()); // Same size.
|
||||
|
||||
size_t pos = 0;
|
||||
|
||||
while (pos < input.length ())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue