From cf336082039ae84b5001908f6bb7e04bdda8893e Mon Sep 17 00:00:00 2001 From: 卜部昌平 Date: Fri, 20 Sep 2019 14:12:51 +0900 Subject: refactor constify most of rb_method_definition_t Most (if not all) of the fields of rb_method_definition_t are never meant to be modified once after they are stored. Marking them const makes it possible for compilers to warn on unintended modifications. --- vm_insnhelper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 54142b8d71..7db8630f75 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -19,7 +19,7 @@ #include "ruby/config.h" #include "debug_counter.h" -extern rb_method_definition_t *rb_method_definition_create(rb_method_type_t type, ID mid); +extern const rb_method_definition_t *rb_method_definition_create(rb_method_type_t type, ID mid); extern void rb_method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *def, void *opts); extern int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2); extern VALUE rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj, @@ -2589,9 +2589,9 @@ aliased_callable_method_entry(const rb_callable_method_entry_t *me) RB_OBJ_WRITE(me, &me->def->body.alias.original_me, cme); } else { - rb_method_definition_t *def = + const rb_method_definition_t *def = rb_method_definition_create(VM_METHOD_TYPE_ALIAS, me->def->original_id); - rb_method_definition_set((rb_method_entry_t *)me, def, (void *)cme); + rb_method_definition_set((rb_method_entry_t *)me, (void *)def, (void *)cme); } } else { -- cgit v1.2.3