summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 10:54:38 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 10:54:38 +0000
commit10bc6f8d49ab82e16e6aab39a263cdc838207154 (patch)
tree6103261afe07b2b8af6f436626bd7f35df84446c /ext/socket/mkconstants.rb
parent175561f8dd142d6db89bc6eb8054834da26ee0d9 (diff)
* ext/socket/mkconstants.rb: add valp argument for family_to_int and
socktype_to_int. * ext/socket/socket.c (setup_domain_and_type): use valp argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r--ext/socket/mkconstants.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 09f0f03..3b3492b 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -75,14 +75,14 @@ def each_names_with_len(pat)
}
end
-ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int(str_var, len_var, pat)")
+ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int(str_var, len_var, retp_var, pat)")
switch (<%=len_var%>) {
% each_names_with_len(pat) {|names, len|
case <%=len%>:
% names.each {|name|
#ifdef <%=name%>
% size = name.bytesize
- if (memcmp(<%=str_var%>, <%=c_str name%>, <%=size%>) == 0) return <%=name%>;
+ if (memcmp(<%=str_var%>, <%=c_str name%>, <%=size%>) == 0) { *<%=retp_var%> = <%=name%>; return 0; }
#endif
% }
return -1;
@@ -153,15 +153,15 @@ init_constants(VALUE mConst)
}
static int
-family_to_int(char *str, int len)
+family_to_int(char *str, int len, int *valp)
{
-<%= gen_name_to_int("str", "len", /\A[AP]F_/) %>
+<%= gen_name_to_int("str", "len", "valp", /\A[AP]F_/) %>
}
static int
-socktype_to_int(char *str, int len)
+socktype_to_int(char *str, int len, int *valp)
{
-<%= gen_name_to_int("str", "len", /\ASOCK_/) %>
+<%= gen_name_to_int("str", "len", "valp", /\ASOCK_/) %>
}
static char *