Use rb_getnameinfo instead of directly using getnameinfo

This commit is contained in:
Yusuke Endoh 2023-10-17 17:00:45 +09:00
Родитель c9990c8d0f
Коммит 7362c484c8
1 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -1266,9 +1266,9 @@ rsock_inspect_sockaddr(struct sockaddr *sockaddr_arg, socklen_t socklen, VALUE r
* RFC 4007: IPv6 Scoped Address Architecture * RFC 4007: IPv6 Scoped Address Architecture
* draft-ietf-ipv6-scope-api-00.txt: Scoped Address Extensions to the IPv6 Basic Socket API * draft-ietf-ipv6-scope-api-00.txt: Scoped Address Extensions to the IPv6 Basic Socket API
*/ */
error = getnameinfo(&sockaddr->addr, socklen, error = rb_getnameinfo(&sockaddr->addr, socklen,
hbuf, (socklen_t)sizeof(hbuf), NULL, 0, hbuf, (socklen_t)sizeof(hbuf), NULL, 0,
NI_NUMERICHOST|NI_NUMERICSERV); NI_NUMERICHOST|NI_NUMERICSERV);
if (error) { if (error) {
rsock_raise_socket_error("getnameinfo", error); rsock_raise_socket_error("getnameinfo", error);
} }
@ -1634,9 +1634,9 @@ addrinfo_mdump(VALUE self)
{ {
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
int error; int error;
error = getnameinfo(&rai->addr.addr, rai->sockaddr_len, error = rb_getnameinfo(&rai->addr.addr, rai->sockaddr_len,
hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf), hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf),
NI_NUMERICHOST|NI_NUMERICSERV); NI_NUMERICHOST|NI_NUMERICSERV);
if (error) { if (error) {
rsock_raise_socket_error("getnameinfo", error); rsock_raise_socket_error("getnameinfo", error);
} }
@ -1980,9 +1980,9 @@ addrinfo_getnameinfo(int argc, VALUE *argv, VALUE self)
if (rai->socktype == SOCK_DGRAM) if (rai->socktype == SOCK_DGRAM)
flags |= NI_DGRAM; flags |= NI_DGRAM;
error = getnameinfo(&rai->addr.addr, rai->sockaddr_len, error = rb_getnameinfo(&rai->addr.addr, rai->sockaddr_len,
hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf), hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf),
flags); flags);
if (error) { if (error) {
rsock_raise_socket_error("getnameinfo", error); rsock_raise_socket_error("getnameinfo", error);
} }