summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 c5244623312..9b7b0cd2e58 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 20df7b598d0..23993f99fa1 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