summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-19 00:23:48 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-19 00:23:48 +0000
commit80980a98b10c0fae6b041e4b85fb888467b2dfaa (patch)
treec0d26ad479f48e97222460929849f8508a5f14ae /ext/socket/mkconstants.rb
parent4316e4d99b856fcd16a2aa0f08cb6285dcab24af (diff)
* 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
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 cfc0fbe..1d4e90b 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -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") %>