summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-09 06:41:07 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-09 06:41:07 +0000
commitf73dca932c1172d9add59c499b7e3c2ada00ea61 (patch)
tree8c15e8f24b8f165f5ab50089569b4581a7a259ce /ext/socket/mkconstants.rb
parentc8b8db001b06e464982f227f6b0b893ac74228d6 (diff)
* ext/socket/mkconstants.rb: define macro if default_value is passed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r--ext/socket/mkconstants.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 20df7b5..23993f9 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -197,13 +197,17 @@ init_constants(VALUE mConst)
% if guard
#if <%=guard%>
% end
-#if defined(<%=name%>)
- <%=define%>(<%=c_str name%>, <%=name%>);
% if default_value
-#else
- <%=define%>(<%=c_str name%>, <%=default_value%>);
+#ifndef <%=name%>
+#define <%=name%> <%=default_value%>
+#endif
+% else
+#if defined(<%=name%>)
% end
+ <%=define%>(<%=c_str name%>, <%=name%>);
+% unless default_value
#endif
+% end
% if guard
#endif
% end