summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-17 18:14:34 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-17 18:14:34 +0000
commit86aa5043d86a24ad9e1bbddecbf84ed21b87005a (patch)
tree58289e991373d5e846e59a61ca8cad4864317b46 /ext/socket/mkconstants.rb
parent75e0fde36b829fa558b87ac1a3edd6a8dbccf600 (diff)
* ext/socket/raddrinfo.c (addrinfo_mdump): new method.
(addrinfo_mload): new method. (Init_addrinfo): define the method above. * ext/socket/constants.c (constant_arg): str_to_int's first argument constified. * ext/socket/mkconstants.rb (gen_name_to_int_decl): generated function's first argument constified. (gen_name_to_int_func_in_guard): ditto. (ipproto_to_int): generated. * ext/socket/rubysocket.h (IS_IP_FAMILY): moved from raddrinfo.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r--ext/socket/mkconstants.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 3c486d6..cfc0fbe 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -140,16 +140,16 @@ end
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int_decl(funcname, pat, prefix_optional, guard=nil)")
%if guard
#ifdef <%=guard%>
-int <%=funcname%>(char *str, int len, int *valp);
+int <%=funcname%>(const char *str, int len, int *valp);
#endif
%else
-int <%=funcname%>(char *str, int len, int *valp);
+int <%=funcname%>(const char *str, int len, int *valp);
%end
EOS
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int_func_in_guard(funcname, pat, prefix_optional, guard=nil)")
int
-<%=funcname%>(char *str, int len, int *valp)
+<%=funcname%>(const char *str, int len, int *valp)
{
switch (len) {
% each_names_with_len(pat, prefix_optional) {|pairs, len|
@@ -241,6 +241,7 @@ end
def_name_to_int("family_to_int", /\A(AF_|PF_)/, "AF_")
def_name_to_int("socktype_to_int", /\ASOCK_/, "SOCK_")
+def_name_to_int("ipproto_to_int", /\AIPPROTO_/, "IPPROTO_")
def_name_to_int("level_to_int", /\A(SOL_SOCKET\z|IPPROTO_)/, /\A(SOL_|IPPROTO_)/)
def_name_to_int("so_optname_to_int", /\ASO_/, "SO_")
def_name_to_int("ip_optname_to_int", /\AIP_/, "IP_")