mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 01:54:00 +02:00
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.
This commit is contained in:
parent
6c6a25feca
commit
dd883de5ba
Notes:
git
2019-09-30 10:27:04 +09:00
9 changed files with 88 additions and 109 deletions
6
class.c
6
class.c
|
@ -965,7 +965,7 @@ static enum rb_id_table_iterator_result
|
|||
inject_refined_method(ID *key, VALUE *value, void *data, int _)
|
||||
{
|
||||
const tuple *ptr = data;
|
||||
const rb_method_entry_t *me = *(rb_method_entry_t **) value;
|
||||
const rb_method_entry_t *me = *(const rb_method_entry_t **) value;
|
||||
const rb_method_entry_t *orig_me = me->def->body.refined.orig_me;
|
||||
const rb_method_entry_t *new_me =
|
||||
rb_method_entry_from_template(
|
||||
|
@ -982,8 +982,8 @@ inject_refined_method(ID *key, VALUE *value, void *data, int _)
|
|||
static enum rb_id_table_iterator_result
|
||||
move_refined_method(ID key, VALUE value, void *data)
|
||||
{
|
||||
const tuple *ptr = data;
|
||||
rb_method_entry_t *me = (rb_method_entry_t *) value;
|
||||
const tuple *ptr = data;
|
||||
const rb_method_entry_t *me = (const rb_method_entry_t *) value;
|
||||
|
||||
if (me->def->type == VM_METHOD_TYPE_REFINED) {
|
||||
if (me->def->body.refined.orig_me) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue