aboutsummaryrefslogtreecommitdiffstats
path: root/struct.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 13:43:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 13:43:22 +0000
commit5e2f227d219fe67c8c57aa32dafb61ac4591fb20 (patch)
tree962aafa0b26bda66d9227acfb8775a848308fac5 /struct.c
parent26646186afbf474c75a3606a1c492fbc74575c2b (diff)
downloadruby-5e2f227d219fe67c8c57aa32dafb61ac4591fb20.tar.gz
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 'struct.c')
-rw-r--r--struct.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/struct.c b/struct.c
index dbfd406f72..5dc5e73ae8 100644
--- a/struct.c
+++ b/struct.c
@@ -460,6 +460,12 @@ rb_struct_new(VALUE klass, ...)
static VALUE
rb_struct_size(VALUE s);
+static VALUE
+struct_enum_size(VALUE s, VALUE args, VALUE eobj)
+{
+ return rb_struct_size(s);
+}
+
/*
* call-seq:
* struct.each {|obj| block } -> struct
@@ -484,7 +490,7 @@ rb_struct_each(VALUE s)
{
long i;
- RETURN_SIZED_ENUMERATOR(s, 0, 0, rb_struct_size);
+ RETURN_SIZED_ENUMERATOR(s, 0, 0, struct_enum_size);
for (i=0; i<RSTRUCT_LEN(s); i++) {
rb_yield(RSTRUCT_GET(s, i));
}
@@ -516,7 +522,7 @@ rb_struct_each_pair(VALUE s)
VALUE members;
long i;
- RETURN_SIZED_ENUMERATOR(s, 0, 0, rb_struct_size);
+ RETURN_SIZED_ENUMERATOR(s, 0, 0, struct_enum_size);
members = rb_struct_members(s);
for (i=0; i<RSTRUCT_LEN(s); i++) {
VALUE key = rb_ary_entry(members, i);
@@ -827,7 +833,7 @@ rb_struct_select(int argc, VALUE *argv, VALUE s)
long i;
rb_check_arity(argc, 0, 0);
- RETURN_SIZED_ENUMERATOR(s, 0, 0, rb_struct_size);
+ RETURN_SIZED_ENUMERATOR(s, 0, 0, struct_enum_size);
result = rb_ary_new();
for (i = 0; i < RSTRUCT_LEN(s); i++) {
if (RTEST(rb_yield(RSTRUCT_GET(s, i)))) {