Skip to content

Commit

Permalink
Let the arrays for the singleton and instance method reflection helpe…
Browse files Browse the repository at this point in the history
…rs be initialized to the methods count
  • Loading branch information
methodmissing authored and shyouhei committed Oct 29, 2019
1 parent fecaa6e commit 85b88c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions class.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 85b88c1

Please sign in to comment.