summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
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;