mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Merge #19750: refactor: remove unused c-string variant of atoi64()
71e0f07e9c
util: remove unused c-string variant of atoi64() (Sebastian Falbesoner) Pull request description: This is another micro-PR "removing old cruft with potentially sharp edges" (quote by practicalswift, see #19739). Gets rid of the c-string variant of the function `atoi64()`, which is only used in fuzzers and on one place with `wallet/wallet.h` (where it is originally a `std::string` anyways and uses `.c_str()` -- this method call can simply be removed.) ACKs for top commit: practicalswift: ACK71e0f07e9c
-- diff looks correct laanwj: ACK71e0f07e9c
Tree-SHA512: 4d1d28e2f5274fdbe0652e7a0f83dd416f4d19c1e1a49979927960a3ad40b0990eeaa4374656bf2c6998a965a14d62c1bc78303b7d583d3307c17828030a8e3b
This commit is contained in:
commit
e9b3012654
4 changed files with 1 additions and 14 deletions
|
@ -52,7 +52,6 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
|||
const bool parseint64_without_locale = ParseInt64(random_string, &parseint64_out_without_locale);
|
||||
const int64_t atoi64_without_locale = atoi64(random_string);
|
||||
const int atoi_without_locale = atoi(random_string);
|
||||
const int64_t atoi64c_without_locale = atoi64(random_string.c_str());
|
||||
const int64_t random_int64 = fuzzed_data_provider.ConsumeIntegral<int64_t>();
|
||||
const std::string tostring_without_locale = ToString(random_int64);
|
||||
// The variable `random_int32` is no longer used, but the harness still needs to
|
||||
|
@ -80,8 +79,6 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
|||
}
|
||||
const int64_t atoi64_with_locale = atoi64(random_string);
|
||||
assert(atoi64_without_locale == atoi64_with_locale);
|
||||
const int64_t atoi64c_with_locale = atoi64(random_string.c_str());
|
||||
assert(atoi64c_without_locale == atoi64c_with_locale);
|
||||
const int atoi_with_locale = atoi(random_string);
|
||||
assert(atoi_without_locale == atoi_with_locale);
|
||||
const std::string tostring_with_locale = ToString(random_int64);
|
||||
|
|
|
@ -407,15 +407,6 @@ std::string FormatParagraph(const std::string& in, size_t width, size_t indent)
|
|||
return out.str();
|
||||
}
|
||||
|
||||
int64_t atoi64(const char* psz)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return _atoi64(psz);
|
||||
#else
|
||||
return strtoll(psz, nullptr, 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t atoi64(const std::string& str)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
@ -56,7 +56,6 @@ std::string EncodeBase32(const unsigned char* pch, size_t len);
|
|||
std::string EncodeBase32(const std::string& str);
|
||||
|
||||
void SplitHostPort(std::string in, int& portOut, std::string& hostOut);
|
||||
int64_t atoi64(const char* psz);
|
||||
int64_t atoi64(const std::string& str);
|
||||
int atoi(const std::string& str);
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ static inline void ReadOrderPos(int64_t& nOrderPos, mapValue_t& mapValue)
|
|||
nOrderPos = -1; // TODO: calculate elsewhere
|
||||
return;
|
||||
}
|
||||
nOrderPos = atoi64(mapValue["n"].c_str());
|
||||
nOrderPos = atoi64(mapValue["n"]);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue