summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-04 00:27:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-04 00:27:43 +0000
commit9ac683818301ea2cdf089b0154f7b4f7c2b1c11d (patch)
tree574bc68089d1105c1cc48922ad8b5fb03d973d35 /ext/socket
parentd51c5a137ff595cd5f5a344853df81589af63fe0 (diff)
* ext/socket/socket.c (constant_arg): constified.
* ext/socket/socket.c (optname_arg): cygwin does not have IPPROTO_IPV6. * ext/socket/mkconstants.rb (ipv6_optname_to_int): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/mkconstants.rb2
-rw-r--r--ext/socket/socket.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 9dce82495b4..da15fb4c795 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -228,11 +228,13 @@ ip_optname_to_int(char *str, int len, int *valp)
<%= gen_name_to_int("str", "len", "valp", /\AIP_/, "IP_") %>
}
+#ifdef IPPROTO_IPV6
static int
ipv6_optname_to_int(char *str, int len, int *valp)
{
<%= gen_name_to_int("str", "len", "valp", /\AIPV6_/, "IPV6_") %>
}
+#endif
static int
tcp_optname_to_int(char *str, int len, int *valp)
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 08efab52d83..3751303a9ed 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -242,7 +242,7 @@ ruby_getnameinfo__aix(sa, salen, host, hostlen, serv, servlen, flags)
#endif
static int
-constant_arg(VALUE arg, int (*str_to_int)(char*, int, int*), char *errmsg)
+constant_arg(VALUE arg, int (*str_to_int)(char*, int, int*), const char *errmsg)
{
VALUE tmp;
char *ptr;
@@ -295,8 +295,10 @@ optname_arg(int level, VALUE optname)
return constant_arg(optname, so_optname_to_int, "unknown socket level option name");
case IPPROTO_IP:
return constant_arg(optname, ip_optname_to_int, "unknown IP level option name");
+#ifdef IPPROTO_IPV6
case IPPROTO_IPV6:
return constant_arg(optname, ipv6_optname_to_int, "unknown IPv6 level option name");
+#endif
case IPPROTO_TCP:
return constant_arg(optname, tcp_optname_to_int, "unknown TCP level option name");
case IPPROTO_UDP: