From f73c84542c5a7462c12118ec56b459660636f903 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 22 May 2008 08:19:04 +0000 Subject: [PATCH] * array.c (rb_ary_compact_bang): fix reallocation size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ array.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6376e196f2..1f96eb0264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu May 22 17:18:35 2008 Tanaka Akira + + * array.c (rb_ary_compact_bang): fix reallocation size. + Thu May 22 15:20:20 2008 NAKAMURA Usaku * eval_intern.h, vm_core.h, include/ruby/intern.h, include/ruby/ruby.h, diff --git a/array.c b/array.c index 2cd3478edb..4cb74ac4f7 100644 --- a/array.c +++ b/array.c @@ -2715,7 +2715,7 @@ rb_ary_compact_bang(VALUE ary) return Qnil; } if (n * 2 < ARY_CAPA(ary) && ARY_DEFAULT_SIZE * 2 < ARY_CAPA(ary)) { - RESIZE_CAPA(ary, ARY_DEFAULT_SIZE * 2); + RESIZE_CAPA(ary, n * 2); } RARRAY(ary)->len = n;