summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-31 16:59:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-31 16:59:12 +0000
commit3d7439d56829f38226d4fcd3cacb402297488fa4 (patch)
treedab8c85e1cc5b074677ae6f12de23e652d4339b1 /enum.c
parent44475bb20874b908160b2a9e6d1dda7fb0c10e88 (diff)
* enum.c (each_with_index_i): should work well with continuation.
a patch from sheepman <sheepman AT sheepman.sakura.ne.jp>. [ruby-dev:30846] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/enum.c b/enum.c
index 441ee9e8b7..f4c649550a 100644
--- a/enum.c
+++ b/enum.c
@@ -1167,11 +1167,11 @@ static VALUE
each_with_index_i(VALUE val, VALUE memo)
{
long n;
+ VALUE idx = RARRAY_PTR(memo)[1];
RARRAY_PTR(memo)[0] = val;
rb_yield(memo);
- val = RARRAY_PTR(memo)[1];
- n = NUM2LONG(val);
+ n = NUM2LONG(idx);
n++;
RARRAY_PTR(memo)[1] = INT2NUM(n);
return Qnil;