summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-20 10:14:18 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-20 10:14:18 +0000
commita40ca8c047d8c174d1757dcbc82ec16185144717 (patch)
treead7d21dc7aeb7c725ce5de1cea332f172803483e /array.c
parent6033673c795d398ad84aa17f6eb29dac1d2a9831 (diff)
* reverts r21693.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/array.c b/array.c
index d88a9fcc3f..3ba450cbe9 100644
--- a/array.c
+++ b/array.c
@@ -2209,11 +2209,9 @@ take_i(VALUE val, VALUE *args, int argc, VALUE *argv)
static VALUE
take_items(VALUE obj, long n)
{
- VALUE result = to_ary(obj);
+ VALUE result = rb_ary_new2(n);
VALUE args[2];
- if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);
- result = rb_ary_new2(n);
args[0] = result; args[1] = (VALUE)n;
rb_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args);
return result;