summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 08:33:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 08:33:10 +0000
commit19451891d8750a44097fae76422642bd288e9197 (patch)
tree376c15d8de8e17f614f5ac9c4794fa52a2e786a7 /enum.c
parenta920c29c16c8ffa2afe3f4126d307ee0001d5bc8 (diff)
* enum.c (enum_take): allocate buffer array before iteration, as well
as enum_first did. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/enum.c b/enum.c
index 1be1dea..fd5ba1c 100644
--- a/enum.c
+++ b/enum.c
@@ -2050,7 +2050,7 @@ enum_take(VALUE obj, VALUE n)
}
if (len == 0) return rb_ary_new2(0);
- result = rb_ary_new();
+ result = rb_ary_new2(len);
memo = NEW_MEMO(result, 0, len);
rb_block_call(obj, id_each, 0, 0, take_i, (VALUE)memo);
return result;