Reserve hrp memory in Decode and LocateErrors

This commit is contained in:
Lőrinc 2024-03-09 13:31:40 +01:00
parent ff7d2054c4
commit d5ece3c4b5

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]);
}