* array.c (rb_ary_pop): may cause realloc oscillation. a patch

from MORITA Naoyuki <mlgetter at kidou.sakura.ne.jp>.
  [ruby-dev:29028]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-07-13 15:12:56 +00:00
Родитель 5d11f0072c
Коммит 05a34a764d
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Fri Jul 14 00:10:15 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_pop): may cause realloc oscillation. a patch
from MORITA Naoyuki <mlgetter at kidou.sakura.ne.jp>.
[ruby-dev:29028]
Thu Jul 13 22:23:56 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/composite.rb: improve handling of the classname on the

Просмотреть файл

@ -454,7 +454,7 @@ rb_ary_pop(VALUE 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);