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

* array.c (rb_ary_compact_bang): use ary_resize_smaller().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
glass 2013-10-10 12:37:58 +00:00
parent 026955e375
commit 840cd22d85
2 changed files with 5 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Thu Oct 10 21:36:16 2013 Masaki Matsushita <glass.saga@gmail.com>
* array.c (rb_ary_compact_bang): use ary_resize_smaller().
Thu Oct 10 21:00:38 2013 Masaki Matsushita <glass.saga@gmail.com>
* st.c (st_keys): define st_keys() for performance improvement of

View file

@ -4166,10 +4166,7 @@ rb_ary_compact_bang(VALUE ary)
if (RARRAY_LEN(ary) == n) {
return Qnil;
}
ARY_SET_LEN(ary, n);
if (n * 2 < ARY_CAPA(ary) && ARY_DEFAULT_SIZE * 2 < ARY_CAPA(ary)) {
ary_resize_capa(ary, n * 2);
}
ary_resize_smaller(ary, n);
return ary;
}