From 71e0f07e9c5f0aef532b85c04807dcbedd04e0af Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Mon, 17 Aug 2020 17:34:06 +0200 Subject: [PATCH] util: remove unused c-string variant of atoi64() --- src/test/fuzz/locale.cpp | 3 --- src/util/strencodings.cpp | 9 --------- src/util/strencodings.h | 1 - src/wallet/wallet.h | 2 +- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/test/fuzz/locale.cpp b/src/test/fuzz/locale.cpp index 3597f51e51a..2b181c6da16 100644 --- a/src/test/fuzz/locale.cpp +++ b/src/test/fuzz/locale.cpp @@ -52,7 +52,6 @@ void test_one_input(const std::vector& 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(); 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& 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); diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp index d10f92ffe60..4d51b9045e3 100644 --- a/src/util/strencodings.cpp +++ b/src/util/strencodings.cpp @@ -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 diff --git a/src/util/strencodings.h b/src/util/strencodings.h index eaa0fa9992f..b4bbaeebf63 100644 --- a/src/util/strencodings.h +++ b/src/util/strencodings.h @@ -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); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 6d9512f59a6..2f9d3010007 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -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"]); }