[前][次][番号順一覧][スレッド一覧]

ruby-changes:34629

From: nobu <ko1@a...>
Date: Sun, 6 Jul 2014 11:43:10 +0900 (JST)
Subject: [ruby-changes:34629] nobu:r46712 (trunk): mkconstants.rb: remove empty comments

nobu	2014-07-06 11:42:55 +0900 (Sun, 06 Jul 2014)

  New Revision: 46712

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46712

  Log:
    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.

  Modified files:
    trunk/ext/etc/mkconstants.rb
Index: ext/etc/mkconstants.rb
===================================================================
--- ext/etc/mkconstants.rb	(revision 46711)
+++ ext/etc/mkconstants.rb	(revision 46712)
@@ -35,7 +35,7 @@ opt.def_option('-H FILE', 'specify outpu https://github.com/ruby/ruby/blob/trunk/ext/etc/mkconstants.rb#L35
 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| https://github.com/ruby/ruby/blob/trunk/ext/etc/mkconstants.rb#L48
     next
   end
   h[name] = default_value
-  COMMENTS[name] = comment
+  COMMENTS[name] = comment if comment
 }
 DEFS = h.to_a
 
@@ -82,7 +82,9 @@ EOS https://github.com/ruby/ruby/blob/trunk/ext/etc/mkconstants.rb#L82
 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
 % }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]