1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Let the arrays for the singleton and instance method reflection helpers be initialized to the methods count

This commit is contained in:
Lourens Naudé 2019-10-22 00:18:37 +01:00 committed by 卜部昌平
parent fecaa6e946
commit 85b88c1d89
Notes: git 2019-10-29 11:33:08 +09:00

View file

@ -1229,7 +1229,7 @@ class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int
if (BUILTIN_TYPE(mod) == T_ICLASS && !prepended) continue;
if (!recur) break;
}
ary = rb_ary_new();
ary = rb_ary_new2(me_arg.list->num_entries);
st_foreach(me_arg.list, func, ary);
st_free_table(me_arg.list);
@ -1466,7 +1466,7 @@ rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
klass = RCLASS_SUPER(klass);
}
}
ary = rb_ary_new();
ary = rb_ary_new2(me_arg.list->num_entries);
st_foreach(me_arg.list, ins_methods_i, ary);
st_free_table(me_arg.list);