ruby-changes:4652
From: ko1@a...
Date: Tue, 22 Apr 2008 19:36:47 +0900 (JST)
Subject: [ruby-changes:4652] knu - Ruby:r16146 (trunk): * enumerator.c (enumerator_initialize): Remove an undocumented
knu 2008-04-22 19:36:31 +0900 (Tue, 22 Apr 2008)
New Revision: 16146
Modified files:
trunk/ChangeLog
trunk/enumerator.c
Log:
* enumerator.c (enumerator_initialize): Remove an undocumented
feature (passing a block to the constructor) that's broken.
This is not what I intended.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16146&r2=16145&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enumerator.c?r1=16146&r2=16145&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16145)
+++ ChangeLog (revision 16146)
@@ -1,3 +1,9 @@
+Tue Apr 22 19:23:05 2008 Akinori MUSHA <knu@i...>
+
+ * 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@r...>
* vm_core.h (exec_event_hooks): ``inline'' is a type modifier, not
Index: enumerator.c
===================================================================
--- enumerator.c (revision 16145)
+++ enumerator.c (revision 16146)
@@ -26,19 +26,9 @@
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 @@
{
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 @@
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 @@
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 @@
ptr1->obj = ptr0->obj;
ptr1->meth = ptr0->meth;
- ptr1->proc = ptr0->proc;
ptr1->iter = ptr0->iter;
ptr1->args = ptr0->args;
ptr1->fib = 0;
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/