зеркало из https://github.com/github/ruby.git
* ext/socket/mkconstants.rb (gen_int_to_name): add lenp argument.
* ext/socket/socket.c (ipaddr): follow argument change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d4b3e8ae70
Коммит
90a65796e7
|
@ -1,3 +1,9 @@
|
|||
Fri Jan 2 14:11:07 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/mkconstants.rb (gen_int_to_name): add lenp argument.
|
||||
|
||||
* ext/socket/socket.c (ipaddr): follow argument change.
|
||||
|
||||
Fri Jan 2 06:43:58 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* signal.c (rb_signal_buff_size): defined for check whether signal
|
||||
|
|
|
@ -103,14 +103,14 @@ def each_alias(pat)
|
|||
yield names
|
||||
end
|
||||
|
||||
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_int_to_name(int_var, pat)")
|
||||
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_int_to_name(int_var, lenp_var, pat)")
|
||||
switch (<%=int_var%>) {
|
||||
% each_alias(pat) {|names|
|
||||
% names.each_with_index {|n, i|
|
||||
% cond = ["defined(#{n})"]
|
||||
% (0...i).each {|j| cond << "(!defined(#{names[j]}) || #{n} != #{names[j]})" }
|
||||
#if <%=cond.join(" && ")%>
|
||||
case <%=n%>: return <%=c_str n%>;
|
||||
case <%=n%>: if (<%=lenp_var%>) *<%=lenp_var%> = <%=n.bytesize%>; return <%=c_str n%>;
|
||||
#endif
|
||||
% }
|
||||
% }
|
||||
|
@ -190,9 +190,9 @@ udp_optname_to_int(char *str, int len, int *valp)
|
|||
}
|
||||
|
||||
static char *
|
||||
family_to_str(int val)
|
||||
family_to_str(int val, int *lenp)
|
||||
{
|
||||
<%= gen_int_to_name("val", /\AAF_/) %>
|
||||
<%= gen_int_to_name("val", "lenp", /\AAF_/) %>
|
||||
}
|
||||
|
||||
EOS
|
||||
|
@ -214,6 +214,8 @@ SOCK_RDM
|
|||
SOCK_SEQPACKET
|
||||
SOCK_PACKET
|
||||
|
||||
AF_UNSPEC
|
||||
PF_UNSPEC
|
||||
AF_INET
|
||||
PF_INET
|
||||
AF_INET6
|
||||
|
@ -226,8 +228,6 @@ AF_IPX
|
|||
PF_IPX
|
||||
AF_APPLETALK
|
||||
PF_APPLETALK
|
||||
AF_UNSPEC
|
||||
PF_UNSPEC
|
||||
AF_LOCAL
|
||||
PF_LOCAL
|
||||
AF_IMPLINK
|
||||
|
|
|
@ -1063,7 +1063,7 @@ ipaddr(struct sockaddr *sockaddr, int norevlookup)
|
|||
char hbuf[1024], pbuf[1024];
|
||||
char *name;
|
||||
|
||||
name = family_to_str(sockaddr->sa_family);
|
||||
name = family_to_str(sockaddr->sa_family, NULL);
|
||||
if (name)
|
||||
family = rb_str_new2(name);
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче