summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 04:22:44 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 04:22:44 +0000
commit80361e2c47fa79880e04df2f344b48fb607e144f (patch)
tree9cc918d847ba6e0d78e312676e7a1042f674ccb9 /struct.c
parent7d848354f8e25a652ccaabbd54e106b44e7da308 (diff)
* range.c (range_each, range_step): Return an enumerator if no
block is given. * struct.c (rb_struct_each, rb_struct_each_pair): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/struct.c b/struct.c
index aaa2a4bce7..73017d1210 100644
--- a/struct.c
+++ b/struct.c
@@ -431,6 +431,7 @@ rb_struct_each(s)
{
long i;
+ RETURN_ENUMERATOR(s, 0, 0);
for (i=0; i<RSTRUCT(s)->len; i++) {
rb_yield(RSTRUCT(s)->ptr[i]);
}
@@ -462,6 +463,7 @@ rb_struct_each_pair(s)
VALUE members;
long i;
+ RETURN_ENUMERATOR(s, 0, 0);
members = rb_struct_members(s);
for (i=0; i<RSTRUCT(s)->len; i++) {
rb_yield_values(2, rb_ary_entry(members, i), RSTRUCT(s)->ptr[i]);