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:
parent
026955e375
commit
840cd22d85
2 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
5
array.c
5
array.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue