diff options
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | enumerator.c | 9 |
2 files changed, 12 insertions, 5 deletions
@@ -1,3 +1,11 @@ +Mon Apr 21 16:06:47 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * enumerator.c (enumerator_init): preserve the method name in ID. + + * enumerator.c (enumerator_each): need not to call rb_to_id(). + + * enumerator.c (enumerator_with_index): ditto. + Mon Apr 21 17:19:52 2008 Akinori MUSHA <knu@iDaemons.org> * eval.c (rb_f_method_name): New gloval function: __method__; diff --git a/enumerator.c b/enumerator.c index 6702bca1cd..4a5e88f6ac 100644 --- a/enumerator.c +++ b/enumerator.c @@ -38,7 +38,7 @@ proc_call(proc, args) struct enumerator { VALUE obj; - VALUE meth; + ID meth; VALUE proc; VALUE args; rb_block_call_func *iter; @@ -51,7 +51,6 @@ enumerator_mark(p) { struct enumerator *ptr = p; rb_gc_mark(ptr->obj); - rb_gc_mark(ptr->meth); rb_gc_mark(ptr->proc); rb_gc_mark(ptr->args); } @@ -258,7 +257,7 @@ enumerator_init(enum_obj, obj, meth, argc, argv) struct enumerator *ptr = enumerator_ptr(enum_obj); ptr->obj = obj; - ptr->meth = meth; + ptr->meth = rb_to_id(meth); if (rb_block_given_p()) { ptr->proc = rb_block_proc(); ptr->iter = enumerator_iter_i; @@ -357,7 +356,7 @@ enumerator_each(obj) argc = RARRAY_LEN(e->args); argv = RARRAY_PTR(e->args); } - return rb_block_call(e->obj, rb_to_id(e->meth), argc, argv, e->iter, (VALUE)e); + return rb_block_call(e->obj, e->meth, argc, argv, e->iter, (VALUE)e); } static VALUE @@ -393,7 +392,7 @@ enumerator_with_index(obj) argc = RARRAY_LEN(e->args); argv = RARRAY_PTR(e->args); } - return rb_block_call(e->obj, rb_to_id(e->meth), argc, argv, + return rb_block_call(e->obj, e->meth, argc, argv, enumerator_with_index_i, (VALUE)&memo); } |
