summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-12 14:32:21 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-12 14:32:21 +0000
commit68552c4248398d5460ce67710647b1578e109c21 (patch)
tree6cd0bb723db47a4e46f563f62fe50d4fc6c4bb52 /ext
parent839214e1e635d3af9049fa637e484b3b8b9c0dfb (diff)
* ext/socket/socket.c (IS_IP_FAMILY): defined.
(addrinfo_ip_p): use it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/socket.c13
1 files changed, 7 insertions, 6 deletions
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;
}
/*