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

ruby-changes:31864

From: glass <ko1@a...>
Date: Sun, 1 Dec 2013 14:39:43 +0900 (JST)
Subject: [ruby-changes:31864] glass:r43943 (trunk): * hash.c (rb_hash_to_a): specify array capa.

glass	2013-12-01 14:39:38 +0900 (Sun, 01 Dec 2013)

  New Revision: 43943

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

  Log:
    * hash.c (rb_hash_to_a): specify array capa.

  Modified files:
    trunk/ChangeLog
    trunk/hash.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43942)
+++ ChangeLog	(revision 43943)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec  1 14:37:20 2013  Masaki Matsushita  <glass.saga@g...>
+
+	* hash.c (rb_hash_to_a): specify array capa.
+
 Sun Dec  1 14:15:36 2013  Masaki Matsushita  <glass.saga@g...>
 
 	* hash.c (rb_hash_rehash): fix to free new st_table when exception
Index: hash.c
===================================================================
--- hash.c	(revision 43942)
+++ hash.c	(revision 43943)
@@ -1606,7 +1606,7 @@ rb_hash_to_a(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L1606
 {
     VALUE ary;
 
-    ary = rb_ary_new();
+    ary = rb_ary_new_capa(RHASH_SIZE(hash));
     rb_hash_foreach(hash, to_a_i, ary);
     OBJ_INFECT(ary, hash);
 

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

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