mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-08-05 06:24:49 +02:00
Reserve memory for ToLower/ToUpper conversions
Github-Pull: #29606
Rebased-From: 6f2f4a4d09
This commit is contained in:
parent
30308cc380
commit
2435c39a6c
@ -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 ToLower(const std::string& str)
|
||||||
{
|
{
|
||||||
std::string r;
|
std::string r;
|
||||||
|
r.reserve(str.size());
|
||||||
for (auto ch : str) r += ToLower(ch);
|
for (auto ch : str) r += ToLower(ch);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -497,6 +498,7 @@ std::string ToLower(const std::string& str)
|
|||||||
std::string ToUpper(const std::string& str)
|
std::string ToUpper(const std::string& str)
|
||||||
{
|
{
|
||||||
std::string r;
|
std::string r;
|
||||||
|
r.reserve(str.size());
|
||||||
for (auto ch : str) r += ToUpper(ch);
|
for (auto ch : str) r += ToUpper(ch);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user