Skip to content

Commit 6f2f4a4

Browse files
author
Lőrinc
committed
Reserve memory for ToLower/ToUpper conversions
1 parent 54172c6 commit 6f2f4a4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/util/strencodings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,15 @@ bool ParseFixedPoint(std::string_view val, int decimals, int64_t *amount_out)
444444
std::string ToLower(std::string_view str)
445445
{
446446
std::string r;
447+
r.reserve(str.size());
447448
for (auto ch : str) r += ToLower(ch);
448449
return r;
449450
}
450451

451452
std::string ToUpper(std::string_view str)
452453
{
453454
std::string r;
455+
r.reserve(str.size());
454456
for (auto ch : str) r += ToUpper(ch);
455457
return r;
456458
}

0 commit comments

Comments
 (0)