ruby-changes:27207
From: akr <ko1@a...>
Date: Sat, 16 Feb 2013 07:36:46 +0900 (JST)
Subject: [ruby-changes:27207] akr:r39259 (trunk): * ext/socket/sockport.h (INIT_SOCKADDR_IN): don't need family
akr 2013-02-16 07:08:25 +0900 (Sat, 16 Feb 2013) New Revision: 39259 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39259 Log: * ext/socket/sockport.h (INIT_SOCKADDR_IN): don't need family argument. it is always AF_INET. * ext/socket/raddrinfo.c (make_inetaddr): follow INIT_SOCKADDR_IN change. (addrinfo_ipv6_to_ipv4): ditto. Modified files: trunk/ChangeLog trunk/ext/socket/raddrinfo.c trunk/ext/socket/sockport.h Index: ChangeLog =================================================================== --- ChangeLog (revision 39258) +++ ChangeLog (revision 39259) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Feb 16 07:05:59 2013 Tanaka Akira <akr@f...> + + * ext/socket/sockport.h (INIT_SOCKADDR_IN): don't need family + argument. it is always AF_INET. + + * ext/socket/raddrinfo.c (make_inetaddr): follow INIT_SOCKADDR_IN + change. + (addrinfo_ipv6_to_ipv4): ditto. + Sat Feb 16 04:21:07 2013 NAKAMURA Usaku <usa@r...> * ext/socket/extconf.rb: workaround for mswin/mingw build problem. Index: ext/socket/raddrinfo.c =================================================================== --- ext/socket/raddrinfo.c (revision 39258) +++ ext/socket/raddrinfo.c (revision 39259) @@ -253,7 +253,7 @@ make_inetaddr(unsigned int host, char *b https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L253 { struct sockaddr_in sin; - INIT_SOCKADDR_IN(&sin, AF_INET, sizeof(sin)); + INIT_SOCKADDR_IN(&sin, sizeof(sin)); sin.sin_addr.s_addr = host; make_ipaddr0((struct sockaddr*)&sin, sizeof(sin), buf, buflen); } @@ -1929,7 +1929,7 @@ addrinfo_ipv6_to_ipv4(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L1929 addr = &((struct sockaddr_in6 *)&rai->addr)->sin6_addr; if (IN6_IS_ADDR_V4MAPPED(addr) || IN6_IS_ADDR_V4COMPAT(addr)) { struct sockaddr_in sin4; - INIT_SOCKADDR_IN(&sin4, AF_INET, sizeof(sin4)); + INIT_SOCKADDR_IN(&sin4, 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, Index: ext/socket/sockport.h =================================================================== --- ext/socket/sockport.h (revision 39258) +++ ext/socket/sockport.h (revision 39259) @@ -38,12 +38,12 @@ https://github.com/ruby/ruby/blob/trunk/ext/socket/sockport.h#L38 SET_SA_LEN(init_sockaddr_ptr, init_sockaddr_len); \ } while (0) -#define INIT_SOCKADDR_IN(addr, family, len) \ +#define INIT_SOCKADDR_IN(addr, len) \ do { \ struct sockaddr_in *init_sockaddr_ptr = (addr); \ socklen_t init_sockaddr_len = (len); \ memset(init_sockaddr_ptr, 0, init_sockaddr_len); \ - init_sockaddr_ptr->sin_family = (family); \ + init_sockaddr_ptr->sin_family = AF_INET; \ SET_SIN_LEN(init_sockaddr_ptr, init_sockaddr_len); \ } while (0) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/