Skip to content

Commit e9b3012

Browse files
committed
Merge #19750: refactor: remove unused c-string variant of atoi64()
71e0f07 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: ACK 71e0f07 -- diff looks correct laanwj: ACK 71e0f07 Tree-SHA512: 4d1d28e2f5274fdbe0652e7a0f83dd416f4d19c1e1a49979927960a3ad40b0990eeaa4374656bf2c6998a965a14d62c1bc78303b7d583d3307c17828030a8e3b
2 parents 44ddcd8 + 71e0f07 commit e9b3012

File tree

4 files changed

+1
-14
lines changed

4 files changed

+1
-14
lines changed

src/test/fuzz/locale.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void test_one_input(const std::vector<uint8_t>& buffer)
5252
const bool parseint64_without_locale = ParseInt64(random_string, &parseint64_out_without_locale);
5353
const int64_t atoi64_without_locale = atoi64(random_string);
5454
const int atoi_without_locale = atoi(random_string);
55-
const int64_t atoi64c_without_locale = atoi64(random_string.c_str());
5655
const int64_t random_int64 = fuzzed_data_provider.ConsumeIntegral<int64_t>();
5756
const std::string tostring_without_locale = ToString(random_int64);
5857
// 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)
8079
}
8180
const int64_t atoi64_with_locale = atoi64(random_string);
8281
assert(atoi64_without_locale == atoi64_with_locale);
83-
const int64_t atoi64c_with_locale = atoi64(random_string.c_str());
84-
assert(atoi64c_without_locale == atoi64c_with_locale);
8582
const int atoi_with_locale = atoi(random_string);
8683
assert(atoi_without_locale == atoi_with_locale);
8784
const std::string tostring_with_locale = ToString(random_int64);

src/util/strencodings.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,6 @@ std::string FormatParagraph(const std::string& in, size_t width, size_t indent)
407407
return out.str();
408408
}
409409

410-
int64_t atoi64(const char* psz)
411-
{
412-
#ifdef _MSC_VER
413-
return _atoi64(psz);
414-
#else
415-
return strtoll(psz, nullptr, 10);
416-
#endif
417-
}
418-
419410
int64_t atoi64(const std::string& str)
420411
{
421412
#ifdef _MSC_VER

src/util/strencodings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ std::string EncodeBase32(const unsigned char* pch, size_t len);
5656
std::string EncodeBase32(const std::string& str);
5757

5858
void SplitHostPort(std::string in, int& portOut, std::string& hostOut);
59-
int64_t atoi64(const char* psz);
6059
int64_t atoi64(const std::string& str);
6160
int atoi(const std::string& str);
6261

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static inline void ReadOrderPos(int64_t& nOrderPos, mapValue_t& mapValue)
227227
nOrderPos = -1; // TODO: calculate elsewhere
228228
return;
229229
}
230-
nOrderPos = atoi64(mapValue["n"].c_str());
230+
nOrderPos = atoi64(mapValue["n"]);
231231
}
232232

233233

0 commit comments

Comments
 (0)