Reserve memory for ToLower/ToUpper conversions

Github-Pull: #29606
Rebased-From: 6f2f4a4d09
This commit is contained in:
Lőrinc 2024-03-08 23:06:22 +01:00 committed by Luke Dashjr
parent 30308cc380
commit 2435c39a6c

View File

@ -490,6 +490,7 @@ bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
std::string ToLower(const std::string& str)
{
std::string r;
r.reserve(str.size());
for (auto ch : str) r += ToLower(ch);
return r;
}
@ -497,6 +498,7 @@ std::string ToLower(const std::string& str)
std::string ToUpper(const std::string& str)
{
std::string r;
r.reserve(str.size());
for (auto ch : str) r += ToUpper(ch);
return r;
}