aboutsummaryrefslogtreecommitdiffstats
path: root/proc.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-09-26 10:22:01 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-09-30 10:26:38 +0900
commitdd883de5ba311c38818d0f638a94b4fbc63f5ee5 (patch)
treed430c06f19a7dcafdc35558f7720d48308dfd435 /proc.c
parent6c6a25feca8752205d81c5247f85d8ae8fb880d8 (diff)
downloadruby-dd883de5ba311c38818d0f638a94b4fbc63f5ee5.tar.gz
refactor constify most of rb_method_entry_t
Now that we have eliminated most destructive operations over the rb_method_entry_t / rb_callable_method_entry_t, let's make them mostly immutabe and mark them const. One exception is rb_export_method(), which destructively modifies visibilities of method entries. I have left that operation as is because I suspect that destructiveness is the nature of that function.
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/proc.c b/proc.c
index 09b310356c..0fd2126fff 100644
--- a/proc.c
+++ b/proc.c
@@ -1426,7 +1426,7 @@ bm_compact(void *ptr)
UPDATE_REFERENCE(data->recv);
UPDATE_REFERENCE(data->klass);
UPDATE_REFERENCE(data->iclass);
- UPDATE_TYPED_REFERENCE(rb_method_entry_t *, data->me);
+ UPDATE_TYPED_REFERENCE(const rb_method_entry_t *, data->me);
}
static size_t
@@ -1519,7 +1519,7 @@ mnew_internal(const rb_method_entry_t *me, VALUE klass, VALUE iclass,
if (me->defined_class) {
VALUE klass = RCLASS_SUPER(RCLASS_ORIGIN(me->defined_class));
id = me->def->original_id;
- me = (rb_method_entry_t *)rb_callable_method_entry_with_refinements(klass, id, &iclass);
+ me = (const rb_method_entry_t *)rb_callable_method_entry_with_refinements(klass, id, &iclass);
}
else {
VALUE klass = RCLASS_SUPER(me->owner);
@@ -1557,7 +1557,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
me = rb_method_entry_with_refinements(klass, id, &iclass);
}
else {
- me = (rb_method_entry_t *)rb_callable_method_entry_with_refinements(klass, id, &iclass);
+ me = (const rb_method_entry_t *)rb_callable_method_entry_with_refinements(klass, id, &iclass);
}
return mnew_from_me(me, klass, iclass, obj, id, mclass, scope);
}
@@ -2947,7 +2947,7 @@ method_super_method(VALUE method)
super_class = RCLASS_SUPER(RCLASS_ORIGIN(iclass));
mid = data->me->called_id;
if (!super_class) return Qnil;
- me = (rb_method_entry_t *)rb_callable_method_entry_with_refinements(super_class, mid, &iclass);
+ me = (const rb_method_entry_t *)rb_callable_method_entry_with_refinements(super_class, mid, &iclass);
if (!me) return Qnil;
return mnew_internal(me, me->owner, iclass, data->recv, mid, rb_obj_class(method), FALSE, FALSE);
}