ruby-changes:5119
From: knu <ko1@a...>
Date: Mon, 26 May 2008 17:49:23 +0900 (JST)
Subject: [ruby-changes:5119] Ruby:r16614 (trunk): * enumerator.c (struct enumerator, enumerator_init)
knu 2008-05-26 17:49:08 +0900 (Mon, 26 May 2008) New Revision: 16614 Modified files: trunk/ChangeLog trunk/enumerator.c Log: * enumerator.c (struct enumerator, enumerator_init) (enumerator_init_copy, enumerator_each): Eliminate iter. (enumerator_ptr): Do not hardcode the class name. (enumerator_with_index): Delay variable initialization after RETURN_ENUMERATOR(). http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16614&r2=16613&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enumerator.c?r1=16614&r2=16613&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 16613) +++ ChangeLog (revision 16614) @@ -1,3 +1,11 @@ +Mon May 26 17:48:42 2008 Akinori MUSHA <knu@i...> + + * enumerator.c (struct enumerator, enumerator_init) + (enumerator_init_copy, enumerator_each): Eliminate iter. + (enumerator_ptr): Do not hardcode the class name. + (enumerator_with_index): Delay variable initialization after + RETURN_ENUMERATOR(). + Mon May 26 17:23:49 2008 NAKAMURA Usaku <usa@r...> * file.c (file_expand_path): add more space for '/'. Index: enumerator.c =================================================================== --- enumerator.c (revision 16613) +++ enumerator.c (revision 16614) @@ -30,7 +30,6 @@ VALUE obj; ID meth; VALUE args; - rb_block_call_func *iter; VALUE fib; VALUE dst; VALUE no_next; @@ -54,8 +53,8 @@ Data_Get_Struct(obj, struct enumerator, ptr); if (RDATA(obj)->dmark != enumerator_mark) { rb_raise(rb_eTypeError, - "wrong argument type %s (expected Enumerable::Enumerator)", - rb_obj_classname(obj)); + "wrong argument type %s (expected %s)", + rb_obj_classname(obj), rb_class2name(rb_cEnumerator)); } if (!ptr) { rb_raise(rb_eArgError, "uninitialized enumerator"); @@ -222,7 +221,6 @@ ptr->obj = obj; ptr->meth = rb_to_id(meth); - ptr->iter = enumerator_each_i; if (argc) ptr->args = rb_ary_new4(argc, argv); ptr->fib = 0; ptr->dst = Qnil; @@ -272,7 +270,6 @@ ptr1->obj = ptr0->obj; ptr1->meth = ptr0->meth; - ptr1->iter = ptr0->iter; ptr1->args = ptr0->args; ptr1->fib = 0; @@ -306,7 +303,8 @@ argc = RARRAY_LEN(e->args); argv = RARRAY_PTR(e->args); } - return rb_block_call(e->obj, e->meth, argc, argv, e->iter, (VALUE)e); + return rb_block_call(e->obj, e->meth, argc, argv, + enumerator_each_i, (VALUE)e); } static VALUE @@ -329,12 +327,13 @@ static VALUE enumerator_with_index(VALUE obj) { - struct enumerator *e = enumerator_ptr(obj); + struct enumerator *e; VALUE memo = 0; int argc = 0; VALUE *argv = 0; RETURN_ENUMERATOR(obj, 0, 0); + e = enumerator_ptr(obj); if (e->args) { argc = RARRAY_LEN(e->args); argv = RARRAY_PTR(e->args); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/