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

ruby-changes:35214

From: nobu <ko1@a...>
Date: Wed, 27 Aug 2014 11:10:42 +0900 (JST)
Subject: [ruby-changes:35214] nobu:r47296 (trunk): parse.y: use rb_ary_tmp_new_fill

nobu	2014-08-27 11:10:22 +0900 (Wed, 27 Aug 2014)

  New Revision: 47296

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

  Log:
    parse.y: use rb_ary_tmp_new_fill
    
    * parse.y (coverage): use rb_ary_tmp_new_fill() instead of setting
      internal structure directly.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 47295)
+++ parse.y	(revision 47296)
@@ -5313,11 +5313,7 @@ coverage(VALUE fname, int n) https://github.com/ruby/ruby/blob/trunk/parse.y#L5313
 {
     VALUE coverages = rb_get_coverages();
     if (RTEST(coverages) && RBASIC(coverages)->klass == 0) {
-	VALUE lines = rb_ary_new2(n);
-	int i;
-	RBASIC_CLEAR_CLASS(lines);
-	for (i = 0; i < n; i++) RARRAY_ASET(lines, i, Qnil);
-	RARRAY(lines)->as.heap.len = n;
+	VALUE lines = rb_ary_tmp_new_fill(n);
 	rb_hash_aset(coverages, fname, lines);
 	return lines;
     }

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

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