summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/socket/socket.c13
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index a0897587052..f244c689eec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jan 12 23:31:42 2009 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (IS_IP_FAMILY): defined.
+ (addrinfo_ip_p): use it.
+
Mon Jan 12 17:23:05 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit/assertions.rb (assert_nothing_raised): removes the
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 08276bf8b63..afec72e59ab 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;
}
/*