diff --git a/ChangeLog b/ChangeLog index 29c120c255..70e5794c84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Jun 4 04:10:43 2015 Koichi Sasada + + * vm_core.h (rb_vm_rewrite_cref_stack): rename to rb_vm_rewrite_cref(). + + * class.c (clone_method): use renamed name. + + * vm_insnhelper.c (rb_vm_rewrite_cref): do not use `node' in variable + names. + Wed Jun 3 23:03:50 2015 Koichi Sasada * vm_method.c: rename `rb_frame_...' to `rb_scope_...'. diff --git a/class.c b/class.c index da41d85023..d711f94779 100644 --- a/class.c +++ b/class.c @@ -247,7 +247,7 @@ clone_method(VALUE klass, ID mid, const rb_method_entry_t *me) VALUE newiseqval; rb_cref_t *new_cref; newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass); - rb_vm_rewrite_cref_stack(me->def->body.iseq.cref, me->klass, klass, &new_cref); + rb_vm_rewrite_cref(me->def->body.iseq.cref, me->klass, klass, &new_cref); rb_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flags.visi); RB_GC_GUARD(newiseqval); } diff --git a/vm_core.h b/vm_core.h index ff2b8a964d..c18611e047 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1005,7 +1005,7 @@ void rb_gc_mark_machine_stack(rb_thread_t *th); int rb_autoloading_value(VALUE mod, ID id, VALUE* value); -void rb_vm_rewrite_cref_stack(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr); +void rb_vm_rewrite_cref(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr); const rb_method_entry_t *rb_vm_frame_method_entry(const rb_control_frame_t *cfp); diff --git a/vm_insnhelper.c b/vm_insnhelper.c index b5963ed840..3482f96b2e 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -465,23 +465,23 @@ rb_vm_get_cref(const VALUE *ep) } void -rb_vm_rewrite_cref_stack(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr) +rb_vm_rewrite_cref(rb_cref_t *cref, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr) { - rb_cref_t *new_node; + rb_cref_t *new_cref; - while (node) { - if (CREF_CLASS(node) == old_klass) { - new_node = vm_cref_new(new_klass, 0, NULL); - COPY_CREF_OMOD(new_node, node); - CREF_NEXT_SET(new_node, CREF_NEXT(node)); - *new_cref_ptr = new_node; + while (cref) { + if (CREF_CLASS(cref) == old_klass) { + new_cref = vm_cref_new(new_klass, 0, NULL); + COPY_CREF_OMOD(new_cref, cref); + CREF_NEXT_SET(new_cref, CREF_NEXT(cref)); + *new_cref_ptr = new_cref; return; } - new_node = vm_cref_new(CREF_CLASS(node), 0, NULL); - COPY_CREF_OMOD(new_node, node); - node = CREF_NEXT(node); - *new_cref_ptr = new_node; - new_cref_ptr = (rb_cref_t **)&new_node->next; + new_cref = vm_cref_new(CREF_CLASS(cref), 0, NULL); + COPY_CREF_OMOD(new_cref, cref); + cref = CREF_NEXT(cref); + *new_cref_ptr = new_cref; + new_cref_ptr = (rb_cref_t **)&new_cref->next; } *new_cref_ptr = NULL; }