summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-22 10:36:31 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-22 10:36:31 +0000
commit80467678ddedd41a37724ae6cba1e25f0242823a (patch)
tree76ce783be10ee47a3c3970493948bc72fa40b85d
parent5e2aeec8ce6fef9fa678053a233dc3c1a0378c44 (diff)
* enumerator.c (enumerator_initialize): Remove an undocumented
feature (passing a block to the constructor) that's broken. This is not what I intended. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--enumerator.c27
2 files changed, 7 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index fd721095f8..a731c64a5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Apr 22 19:23:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (enumerator_initialize): Remove an undocumented
+ feature (passing a block to the constructor) that's broken.
+ This is not what I intended.
+
Tue Apr 22 17:54:05 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
* vm_core.h (exec_event_hooks): ``inline'' is a type modifier, not
diff --git a/enumerator.c b/enumerator.c
index c52f61d9aa..ced64bd4eb 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -26,19 +26,9 @@ static VALUE sym_each;
VALUE rb_eStopIteration;
-static VALUE
-proc_call(VALUE proc, VALUE args)
-{
- if (TYPE(args) != T_ARRAY) {
- args = rb_ary_new3(1, args);
- }
- return rb_proc_call(proc, args);
-}
-
struct enumerator {
VALUE obj;
ID meth;
- VALUE proc;
VALUE args;
rb_block_call_func *iter;
VALUE fib;
@@ -51,7 +41,6 @@ enumerator_mark(void *p)
{
struct enumerator *ptr = p;
rb_gc_mark(ptr->obj);
- rb_gc_mark(ptr->proc);
rb_gc_mark(ptr->args);
rb_gc_mark(ptr->fib);
rb_gc_mark(ptr->dst);
@@ -74,13 +63,6 @@ enumerator_ptr(VALUE obj)
return ptr;
}
-static VALUE
-enumerator_iter_i(VALUE i, VALUE enum_obj, int argc, VALUE *argv)
-{
- struct enumerator *e = (struct enumerator *)enum_obj;
- return rb_yield(proc_call(e->proc, i));
-}
-
/*
* call-seq:
* obj.to_enum(method = :each, *args)
@@ -237,13 +219,7 @@ enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv)
ptr->obj = obj;
ptr->meth = rb_to_id(meth);
- if (rb_block_given_p()) {
- ptr->proc = rb_block_proc();
- ptr->iter = enumerator_iter_i;
- }
- else {
- ptr->iter = enumerator_each_i;
- }
+ ptr->iter = enumerator_each_i;
if (argc) ptr->args = rb_ary_new4(argc, argv);
ptr->fib = 0;
ptr->dst = Qnil;
@@ -297,7 +273,6 @@ enumerator_init_copy(VALUE obj, VALUE orig)
ptr1->obj = ptr0->obj;
ptr1->meth = ptr0->meth;
- ptr1->proc = ptr0->proc;
ptr1->iter = ptr0->iter;
ptr1->args = ptr0->args;
ptr1->fib = 0;