summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-09 12:56:02 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-09 12:56:02 +0000
commit357f65d5922264767cefa84784750f757eec357d (patch)
tree4d0516cc2fcdedf2fc7cdf4e728cacd2117f3cbd
parent0c0881d517160f5095518c84d99e2429f6eb2b41 (diff)
* array.c (rb_ary_pop): Do not reallocate too often; backported
from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--array.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a07295a4fe..739302bdce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Apr 9 21:54:45 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_pop): Do not reallocate too often; backported
+ from 1.9.
+
Wed Apr 9 21:13:05 2008 Akinori MUSHA <knu@iDaemons.org>
* array.c (rb_ary_each, rb_ary_each_index, rb_ary_reverse_each,
diff --git a/array.c b/array.c
index f1748179c1..7d7775c8a2 100644
--- a/array.c
+++ b/array.c
@@ -450,7 +450,7 @@ rb_ary_pop(ary)
rb_ary_modify_check(ary);
if (RARRAY(ary)->len == 0) return Qnil;
if (!FL_TEST(ary, ELTS_SHARED) &&
- RARRAY(ary)->len * 2 < RARRAY(ary)->aux.capa &&
+ RARRAY(ary)->len * 3 < RARRAY(ary)->aux.capa &&
RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) {
RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2;
REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);