summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-06 02:42:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-06 02:42:55 +0000
commit24e4104675272d3c8d9c9cc0f1b845e4015c3235 (patch)
tree1bc24e81ceb766212529007407be3c541b4bc077 /ext
parent09e36e478ff7c0f4ddedebe2ec8f3a7dbbec63bc (diff)
mkconstants.rb: remove empty comments
* ext/etc/mkconstants.rb: remove empty comments, defaut_proc isn't called by accessing nil-assigned elements, and the same content is useless. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/etc/mkconstants.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/etc/mkconstants.rb b/ext/etc/mkconstants.rb
index 548a02227a..c9fddfd132 100644
--- a/ext/etc/mkconstants.rb
+++ b/ext/etc/mkconstants.rb
@@ -35,7 +35,7 @@ opt.def_option('-H FILE', 'specify output header file') {|filename|
opt.parse!
h = {}
-COMMENTS = Hash.new { |h, name| h[name] = name }
+COMMENTS = {}
DATA.each_line {|s|
next if /\A\s*(\#|\z)/ =~ s
@@ -48,7 +48,7 @@ DATA.each_line {|s|
next
end
h[name] = default_value
- COMMENTS[name] = comment
+ COMMENTS[name] = comment if comment
}
DEFS = h.to_a
@@ -82,7 +82,9 @@ EOS
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs")
% each_const {|name, default_value|
#if defined(<%=name%>)
- /* <%= COMMENTS[name] %> */
+% if comment = COMMENTS[name]
+ /* <%=comment%> */
+% end
rb_define_const(mod, <%=c_str name.sub(/\A_*/, '')%>, INTEGER2NUM(<%=name%>));
#endif
% }