mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 05:57:59 +01:00
Reserve hrp memory in Decode and LocateErrors
This commit is contained in:
@@ -393,6 +393,7 @@ DecodeResult Decode(const std::string& str, CharLimit limit) {
|
|||||||
values[i] = rev;
|
values[i] = rev;
|
||||||
}
|
}
|
||||||
std::string hrp;
|
std::string hrp;
|
||||||
|
hrp.reserve(pos);
|
||||||
for (size_t i = 0; i < pos; ++i) {
|
for (size_t i = 0; i < pos; ++i) {
|
||||||
hrp += LowerCase(str[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;
|
std::string hrp;
|
||||||
|
hrp.reserve(pos);
|
||||||
for (size_t i = 0; i < pos; ++i) {
|
for (size_t i = 0; i < pos; ++i) {
|
||||||
hrp += LowerCase(str[i]);
|
hrp += LowerCase(str[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user