ruby-changes:9737
From: akr <ko1@a...>
Date: Fri, 2 Jan 2009 23:38:32 +0900 (JST)
Subject: [ruby-changes:9737] Ruby:r21278 (trunk): * ext/socket/socket.c: don't apply socktype hack for
akr 2009-01-02 23:36:39 +0900 (Fri, 02 Jan 2009) New Revision: 21278 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21278 Log: * ext/socket/socket.c: don't apply socktype hack [ruby-core:184] for sock_s_getaddrinfo. (sock_getaddrinfo): add socktype_hack argument. (sock_addrinfo): call sock_getaddrinfo with socktype_hack. (sock_s_getaddrinfo): call sock_getaddrinfo without socktype_hack. [ruby-dev:37674] Modified files: trunk/ChangeLog trunk/ext/socket/socket.c Index: ChangeLog =================================================================== --- ChangeLog (revision 21277) +++ ChangeLog (revision 21278) @@ -1,3 +1,12 @@ +Fri Jan 2 23:36:10 2009 Tanaka Akira <akr@f...> + + * ext/socket/socket.c: don't apply socktype hack [ruby-core:184] for + sock_s_getaddrinfo. + (sock_getaddrinfo): add socktype_hack argument. + (sock_addrinfo): call sock_getaddrinfo with socktype_hack. + (sock_s_getaddrinfo): call sock_getaddrinfo without socktype_hack. + [ruby-dev:37674] + Fri Jan 2 23:33:38 2009 NAKAMURA Usaku <usa@r...> * include/ruby/missing.h, sprintf.c: get rid of a warning of VC++. Index: ext/socket/socket.c =================================================================== --- ext/socket/socket.c (revision 21277) +++ ext/socket/socket.c (revision 21278) @@ -999,7 +999,7 @@ #endif static struct addrinfo* -sock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints) +sock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack) { struct addrinfo* res = NULL; char *hostp, *portp; @@ -1009,7 +1009,7 @@ hostp = host_str(host, hbuf, sizeof(hbuf)); portp = port_str(port, pbuf, sizeof(pbuf)); - if (hints->ai_socktype == 0 && hints->ai_flags == 0 && str_isnumber(portp)) { + if (socktype_hack && hints->ai_socktype == 0 && hints->ai_flags == 0 && str_isnumber(portp)) { hints->ai_socktype = SOCK_DGRAM; } @@ -1051,7 +1051,7 @@ hints.ai_family = AF_UNSPEC; hints.ai_socktype = socktype; hints.ai_flags = flags; - return sock_getaddrinfo(host, port, &hints); + return sock_getaddrinfo(host, port, &hints, 1); } static VALUE @@ -3298,7 +3298,7 @@ if (!NIL_P(flags)) { hints.ai_flags = NUM2INT(flags); } - res = sock_getaddrinfo(host, port, &hints); + res = sock_getaddrinfo(host, port, &hints, 0); ret = make_addrinfo(res); freeaddrinfo(res); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/