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

Let the backtrace array constructed in backtrace_collect be initialized with the size already given

This commit is contained in:
Lourens Naudé 2019-10-22 00:03:05 +01:00 committed by 卜部昌平
parent 0095362918
commit fecaa6e946
Notes: git 2019-10-29 11:32:31 +09:00

View file

@ -578,7 +578,7 @@ backtrace_collect(rb_backtrace_t *bt, long lev, long n, VALUE (*func)(rb_backtra
rb_bug("backtrace_collect: unreachable");
}
btary = rb_ary_new();
btary = rb_ary_new2(n);
for (i=0; i+lev<bt->backtrace_size && i<n; i++) {
rb_backtrace_location_t *loc = &bt->backtrace[bt->backtrace_size - 1 - (lev+i)];