ruby-changes:58486
From: Lourens <ko1@a...>
Date: Tue, 29 Oct 2019 11:41:43 +0900 (JST)
Subject: [ruby-changes:58486] 85b88c1d89 (master): Let the arrays for the singleton and instance method reflection helpers be initialized to the methods count
https://git.ruby-lang.org/ruby.git/commit/?id=85b88c1d89 From 85b88c1d89924d00ecd893cea696d2a94232745c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lourens=20Naud=C3=A9?= <lourens@b...> Date: Tue, 22 Oct 2019 00:18:37 +0100 Subject: Let the arrays for the singleton and instance method reflection helpers be initialized to the methods count diff --git a/class.c b/class.c index 010faed..0b2bd2c 100644 --- a/class.c +++ b/class.c @@ -1229,7 +1229,7 @@ class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int https://github.com/ruby/ruby/blob/trunk/class.c#L1229 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) https://github.com/ruby/ruby/blob/trunk/class.c#L1466 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); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/