Skip to content

Commit 2d2a1a2

Browse files
committed
net/AddressInfo: remove MakeAddrInfo()
Use designated initializers instead.
1 parent 026bde8 commit 2d2a1a2

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/net/AddressInfo.hxx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@
1414
#include <netdb.h> // IWYU pragma: export
1515
#endif
1616

17-
constexpr struct addrinfo
18-
MakeAddrInfo(int flags, int family, int socktype, int protocol=0) noexcept
19-
{
20-
struct addrinfo ai{};
21-
ai.ai_flags = flags;
22-
ai.ai_family = family;
23-
ai.ai_socktype = socktype;
24-
ai.ai_protocol = protocol;
25-
return ai;
26-
}
27-
2817
class AddressInfo : addrinfo {
2918
/* this class cannot be instantiated, it can only be cast from
3019
a struct addrinfo pointer */

src/net/Resolver.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ Resolve(const char *host_and_port, int default_port,
122122
AddressInfoList
123123
Resolve(const char *host_port, unsigned default_port, int flags, int socktype)
124124
{
125-
const auto hints = MakeAddrInfo(flags, AF_UNSPEC, socktype);
125+
const struct addrinfo hints{
126+
.ai_flags = flags,
127+
.ai_family = AF_UNSPEC,
128+
.ai_socktype = socktype,
129+
};
130+
126131
return Resolve(host_port, default_port, &hints);
127132
}

0 commit comments

Comments
 (0)