mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/raddrinfo.c (addrinfo_mdump, addrinfo_mload): support
UNIX socket only on platforms which support it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4316e4d99b
commit
80980a98b1
3 changed files with 18 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
|||
Mon Jan 19 09:21:04 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* ext/socket/mkconstants.rb: define macros with default value in
|
||||
constdefs.h if not exist them.
|
||||
|
||||
* ext/socket/raddrinfo.c (addrinfo_mdump, addrinfo_mload): support
|
||||
UNIX socket only on platforms which support it.
|
||||
|
||||
Mon Jan 19 08:56:53 2009 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* eval.c, vm_eval.c (rb_f_local_variables): move definition from eval.c
|
||||
|
|
|
@ -74,17 +74,15 @@ def each_name(pat)
|
|||
}
|
||||
end
|
||||
|
||||
MISSING_DEFS = {}
|
||||
|
||||
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs_in_guard(define, name, default_value)")
|
||||
% if default_value
|
||||
#ifndef <%=name%>
|
||||
#define <%=name%> <%=default_value%>
|
||||
#endif
|
||||
<%=define%>(<%=c_str name%>, <%=name%>);
|
||||
% else
|
||||
% MISSING_DEFS[name] = default_value
|
||||
% end
|
||||
#if defined(<%=name%>)
|
||||
<%=define%>(<%=c_str name%>, <%=name%>);
|
||||
#endif
|
||||
% end
|
||||
EOS
|
||||
|
||||
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs")
|
||||
|
@ -273,6 +271,8 @@ init_constants(VALUE mConst)
|
|||
EOS
|
||||
|
||||
header_result = ERB.new(<<'EOS', nil, '%').result(binding)
|
||||
<%= MISSING_DEFS.map {|name, value| ["\#ifndef #{name}", "\# define #{name} #{value}", '#endif']}.join("\n") %>
|
||||
|
||||
<%= NAME_TO_INT_DEFS.map {|decl, func| decl }.join("\n") %>
|
||||
|
||||
<%= INTERN_DEFS.map {|vardef, gen_hash, decl, func| decl }.join("\n") %>
|
||||
|
|
|
@ -1153,6 +1153,7 @@ addrinfo_mdump(VALUE self)
|
|||
afamily = rb_id2str(id);
|
||||
|
||||
switch(afamily_int) {
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
case AF_UNIX:
|
||||
{
|
||||
struct sockaddr_un *su = (struct sockaddr_un *)&rai->addr;
|
||||
|
@ -1164,6 +1165,7 @@ addrinfo_mdump(VALUE self)
|
|||
sockaddr = rb_str_new(s, e-s);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
|
@ -1250,6 +1252,7 @@ addrinfo_mload(VALUE self, VALUE ary)
|
|||
|
||||
v = rb_ary_entry(ary, 1);
|
||||
switch(afamily) {
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
case AF_UNIX:
|
||||
{
|
||||
struct sockaddr_un *su = (struct sockaddr_un *)&ss;
|
||||
|
@ -1263,6 +1266,7 @@ addrinfo_mload(VALUE self, VALUE ary)
|
|||
len = sizeof(*su);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue