Skip to content

Commit c9d548c

Browse files
committed
net: remove CService::ToStringPort()
It is used only internally in `CService::ToStringAddrPort()`.
1 parent fd4f0f4 commit c9d548c

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

src/netaddress.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -911,17 +911,14 @@ std::vector<unsigned char> CService::GetKey() const
911911
return key;
912912
}
913913

914-
std::string CService::ToStringPort() const
915-
{
916-
return strprintf("%u", port);
917-
}
918-
919914
std::string CService::ToStringAddrPort() const
920915
{
916+
const auto port_str = strprintf("%u", port);
917+
921918
if (IsIPv4() || IsTor() || IsI2P() || IsInternal()) {
922-
return ToStringAddr() + ":" + ToStringPort();
919+
return ToStringAddr() + ":" + port_str;
923920
} else {
924-
return "[" + ToStringAddr() + "]:" + ToStringPort();
921+
return "[" + ToStringAddr() + "]:" + port_str;
925922
}
926923
}
927924

src/netaddress.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,6 @@ class CService : public CNetAddr
535535
friend bool operator!=(const CService& a, const CService& b) { return !(a == b); }
536536
friend bool operator<(const CService& a, const CService& b);
537537
std::vector<unsigned char> GetKey() const;
538-
std::string ToStringPort() const;
539538
std::string ToStringAddrPort() const;
540539

541540
CService(const struct in6_addr& ipv6Addr, uint16_t port);

src/test/fuzz/netaddress.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ FUZZ_TARGET(netaddress)
8080
(void)service.GetKey();
8181
(void)service.GetPort();
8282
(void)service.ToStringAddrPort();
83-
(void)service.ToStringPort();
8483
(void)CServiceHash()(service);
8584
(void)CServiceHash(0, 0)(service);
8685

0 commit comments

Comments
 (0)