ruby-changes:38370
From: glass <ko1@a...>
Date: Sun, 10 May 2015 11:06:22 +0900 (JST)
Subject: [ruby-changes:38370] glass:r50451 (trunk): temp
glass 2015-05-10 11:06:06 +0900 (Sun, 10 May 2015) New Revision: 50451 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50451 Log: temp Modified files: trunk/enum.c Index: enum.c =================================================================== --- enum.c (revision 50450) +++ enum.c (revision 50451) @@ -515,7 +515,14 @@ enum_flat_map(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L515 static VALUE enum_to_a(int argc, VALUE *argv, VALUE obj) { - VALUE ary = rb_ary_new(); + VALUE ary, size = rb_check_funcall(obj, id_size, 0, 0); + + if (size == Qundef) { + ary = rb_ary_new(); + } + else { + ary = rb_ary_new2(NUM2LONG(size)); + } rb_block_call(obj, id_each, argc, argv, collect_all, ary); OBJ_INFECT(ary, obj); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/