summaryrefslogtreecommitdiff
path: root/ext/socket/raddrinfo.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 23:14:22 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 23:14:22 +0000
commit1ff7108306f63b1f5cc9b0ed2d376f5a1f99bdf4 (patch)
treee6311f2f125a7bb6cf043e67dee4cf3e0ea02eb5 /ext/socket/raddrinfo.c
parentdfbb5b677c1b293e0177bc99b2d7dcf24e87453d (diff)
* ext/socket/sockport.h (SET_SS_LEN): removed.
(SET_SIN_LEN): removed. (INIT_SOCKADDR): new macro. * ext/socket/ancdata.c (extract_ipv6_pktinfo): use INIT_SOCKADDR. * ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR. (addrinfo_ipv6_to_ipv4): ditto. * ext/socket/getaddrinfo.c (GET_AI): use INIT_SOCKADDR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/raddrinfo.c')
-rw-r--r--ext/socket/raddrinfo.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c
index 8282173..a2b2029 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -253,9 +253,7 @@ make_inetaddr(unsigned int host, char *buf, size_t buflen)
{
struct sockaddr_in sin;
- MEMZERO(&sin, struct sockaddr_in, 1);
- sin.sin_family = AF_INET;
- SET_SIN_LEN(&sin, sizeof(sin));
+ INIT_SOCKADDR((struct sockaddr *)&sin, AF_INET, sizeof(sin));
sin.sin_addr.s_addr = host;
make_ipaddr0((struct sockaddr*)&sin, sizeof(sin), buf, buflen);
}
@@ -1931,9 +1929,7 @@ addrinfo_ipv6_to_ipv4(VALUE self)
addr = &((struct sockaddr_in6 *)&rai->addr)->sin6_addr;
if (IN6_IS_ADDR_V4MAPPED(addr) || IN6_IS_ADDR_V4COMPAT(addr)) {
struct sockaddr_in sin4;
- MEMZERO(&sin4, struct sockaddr_in, 1);
- sin4.sin_family = AF_INET;
- SET_SIN_LEN(&sin4, sizeof(sin4));
+ INIT_SOCKADDR((struct sockaddr *)&sin4, AF_INET, sizeof(sin4));
memcpy(&sin4.sin_addr, (char*)addr + sizeof(*addr) - sizeof(sin4.sin_addr), sizeof(sin4.sin_addr));
return rsock_addrinfo_new((struct sockaddr *)&sin4, (socklen_t)sizeof(sin4),
PF_INET, rai->socktype, rai->protocol,