aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2022-07-15 17:56:30 +0200
committerVasil Dimov <vd@FreeBSD.org>2022-12-12 11:54:23 +0100
commitc9d548c91fb12fba516dee896f1f97692cfa2104 (patch)
treedfe50919cd4ef51f9f609d9f074c0456be293a4b
parentfd4f0f41e915d99c9b0eac1afd21c5628222e368 (diff)
net: remove CService::ToStringPort()
It is used only internally in `CService::ToStringAddrPort()`.
-rw-r--r--src/netaddress.cpp11
-rw-r--r--src/netaddress.h1
-rw-r--r--src/test/fuzz/netaddress.cpp1
3 files changed, 4 insertions, 9 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp
index ba29aa5f64..13c505ca34 100644
--- a/src/netaddress.cpp
+++ b/src/netaddress.cpp
@@ -911,17 +911,14 @@ std::vector<unsigned char> CService::GetKey() const
return key;
}
-std::string CService::ToStringPort() const
-{
- return strprintf("%u", port);
-}
-
std::string CService::ToStringAddrPort() const
{
+ const auto port_str = strprintf("%u", port);
+
if (IsIPv4() || IsTor() || IsI2P() || IsInternal()) {
- return ToStringAddr() + ":" + ToStringPort();
+ return ToStringAddr() + ":" + port_str;
} else {
- return "[" + ToStringAddr() + "]:" + ToStringPort();
+ return "[" + ToStringAddr() + "]:" + port_str;
}
}
diff --git a/src/netaddress.h b/src/netaddress.h
index 8fb34194cb..a465e53809 100644
--- a/src/netaddress.h
+++ b/src/netaddress.h
@@ -535,7 +535,6 @@ public:
friend bool operator!=(const CService& a, const CService& b) { return !(a == b); }
friend bool operator<(const CService& a, const CService& b);
std::vector<unsigned char> GetKey() const;
- std::string ToStringPort() const;
std::string ToStringAddrPort() const;
CService(const struct in6_addr& ipv6Addr, uint16_t port);
diff --git a/src/test/fuzz/netaddress.cpp b/src/test/fuzz/netaddress.cpp
index ad18b35637..5ffa200238 100644
--- a/src/test/fuzz/netaddress.cpp
+++ b/src/test/fuzz/netaddress.cpp
@@ -80,7 +80,6 @@ FUZZ_TARGET(netaddress)
(void)service.GetKey();
(void)service.GetPort();
(void)service.ToStringAddrPort();
- (void)service.ToStringPort();
(void)CServiceHash()(service);
(void)CServiceHash(0, 0)(service);