diff --git a/ChangeLog b/ChangeLog index a089758705..f244c689ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 12 23:31:42 2009 Tanaka Akira + + * ext/socket/socket.c (IS_IP_FAMILY): defined. + (addrinfo_ip_p): use it. + Mon Jan 12 17:23:05 2009 Nobuyoshi Nakada * lib/test/unit/assertions.rb (assert_nothing_raised): removes the diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 08276bf8b6..afec72e59a 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -5106,6 +5106,12 @@ addrinfo_canonname(VALUE self) return rai->canonname; } +#ifdef AF_INET6 +# define IS_IP_FAMILY(af) ((af) == AF_INET || (af) == AF_INET6) +#else +# define IS_IP_FAMILY(af) ((af) == AF_INET) +#endif + /* * call-seq: * addrinfo.ip? => true or false @@ -5123,12 +5129,7 @@ addrinfo_ip_p(VALUE self) { rb_addrinfo_t *rai = get_addrinfo(self); int family = ai_get_afamily(rai); - return family == AF_INET -#ifdef AF_INET6 - || family == AF_INET6 -#endif - ? Qtrue : Qfalse; - return Qfalse; + return IS_IP_FAMILY(family) ? Qtrue : Qfalse; } /*