mirror of
https://github.com/monero-project/monero.git
synced 2025-07-29 08:38:40 -04:00
epee: avoid string allocation when parsing a pod from string
This commit is contained in:
parent
e282e9fa40
commit
3a3858dc90
2 changed files with 14 additions and 38 deletions
|
@ -74,7 +74,7 @@ namespace cryptonote
|
|||
bool checkpoints::add_checkpoint(uint64_t height, const std::string& hash_str)
|
||||
{
|
||||
crypto::hash h = crypto::null_hash;
|
||||
bool r = epee::string_tools::parse_tpod_from_hex_string(hash_str, h);
|
||||
bool r = epee::string_tools::hex_to_pod(hash_str, h);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to parse checkpoint hash string into binary representation!");
|
||||
|
||||
// return false if adding at a height we already have AND the hash is different
|
||||
|
@ -292,7 +292,7 @@ namespace cryptonote
|
|||
// parse the second part as crypto::hash,
|
||||
// if this fails move on to the next record
|
||||
std::string hashStr = record.substr(pos + 1);
|
||||
if (!epee::string_tools::parse_tpod_from_hex_string(hashStr, hash))
|
||||
if (!epee::string_tools::hex_to_pod(hashStr, hash))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue