Skip to content

Commit

Permalink
call to_int once for an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Dec 28, 2011
1 parent 8b69c2e commit bf4a128
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions enum.c
Expand Up @@ -724,9 +724,13 @@ enum_first(VALUE obj, SEL sel, int argc, VALUE *argv)
ary[0] = ary[1] = Qnil;
}
else {
long len;

rb_scan_args(argc, argv, "01", &n);
ary[0] = n;
ary[1] = rb_ary_new2(NUM2LONG(n));
len = NUM2LONG(n);
if (len == 0) return rb_ary_new2(0);
ary[0] = len;
ary[1] = rb_ary_new2(len);
}
rb_objc_block_call(obj, selEach, 0, 0, first_i, (VALUE)ary);

Expand Down

0 comments on commit bf4a128

Please sign in to comment.