summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog4
-rw-r--r--ext/socket/mkconstants.rb12
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index c524462331..9b7b0cd2e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Jan 9 15:40:07 2009 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/mkconstants.rb: define macro if default_value is passed.
+
Fri Jan 9 13:20:08 2009 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: rescue abnormal Encoding.locale_charmap value.
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 20df7b598d..23993f99fa 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