summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 13:43:22 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 13:43:22 (GMT)
commit5e2f227d219fe67c8c57aa32dafb61ac4591fb20 (patch)
tree962aafa0b26bda66d9227acfb8775a848308fac5 /enumerator.c
parent26646186afbf474c75a3606a1c492fbc74575c2b (diff)
intern.h: define rb_enumerator_size_func
* include/ruby/intern.h (rb_enumerator_size_func): define strict function declaration for rb_enumeratorize_with_size(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/enumerator.c b/enumerator.c
index 54fa49f..0c45bf3 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -120,7 +120,7 @@ struct enumerator {
VALUE feedvalue;
VALUE stop_exc;
VALUE size;
- VALUE (*size_fn)(ANYARGS);
+ rb_enumerator_size_func *size_fn;
};
static VALUE rb_cGenerator, rb_cYielder;
@@ -474,6 +474,12 @@ enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
static VALUE
enumerator_size(VALUE obj);
+static VALUE
+enumerator_enum_size(VALUE obj, VALUE args, VALUE eobj)
+{
+ return enumerator_size(obj);
+}
+
/*
* call-seq:
* e.with_index(offset = 0) {|(*args), idx| ... }
@@ -492,7 +498,7 @@ enumerator_with_index(int argc, VALUE *argv, VALUE obj)
VALUE memo;
rb_scan_args(argc, argv, "01", &memo);
- RETURN_SIZED_ENUMERATOR(obj, argc, argv, enumerator_size);
+ RETURN_SIZED_ENUMERATOR(obj, argc, argv, enumerator_enum_size);
if (NIL_P(memo))
memo = INT2FIX(0);
else
@@ -557,7 +563,7 @@ enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
static VALUE
enumerator_with_object(VALUE obj, VALUE memo)
{
- RETURN_SIZED_ENUMERATOR(obj, 1, &memo, enumerator_size);
+ RETURN_SIZED_ENUMERATOR(obj, 1, &memo, enumerator_enum_size);
enumerator_block_call(obj, enumerator_with_object_i, memo);
return memo;