summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-10 12:37:58 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-10 12:37:58 +0000
commit840cd22d8587c45056737317ed186d7433c94716 (patch)
tree43bd591788d4e3884aaf3327a136b43662cff7af /array.c
parent026955e37517d07679ea8044d939400d6e9beaaf (diff)
* 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
Diffstat (limited to 'array.c')
-rw-r--r--array.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/array.c b/array.c
index 7e8617b..c45c992 100644
--- a/array.c
+++ b/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;
}