Reserve hrp memory in Decode and LocateErrors

This commit is contained in:
Lőrinc committed 2024-06-05 12:46:39 +02:00
1 parent ff7d2054c4
commit d5ece3c4b5
1 file changed
+2
+2
View File
@@ -393,6 +393,7 @@ DecodeResult Decode(const std::string& str, CharLimit limit) {
values[i] = rev;
}
std::string hrp;
hrp.reserve(pos);
for (size_t i = 0; i < pos; ++i) {
hrp += LowerCase(str[i]);
}
@@ -425,6 +426,7 @@ std::pair<std::string, std::vector<int>> LocateErrors(const std::string& str, Ch
}
std::string hrp;
hrp.reserve(pos);
for (size_t i = 0; i < pos; ++i) {
hrp += LowerCase(str[i]);
}