mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
5d11f0072c
commit
05a34a764d
2 changed files with 7 additions and 1 deletions
|
@ -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>
|
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
|
* ext/tk/lib/tk/composite.rb: improve handling of the classname on the
|
||||||
|
|
2
array.c
2
array.c
|
@ -454,7 +454,7 @@ rb_ary_pop(VALUE ary)
|
||||||
rb_ary_modify_check(ary);
|
rb_ary_modify_check(ary);
|
||||||
if (RARRAY(ary)->len == 0) return Qnil;
|
if (RARRAY(ary)->len == 0) return Qnil;
|
||||||
if (!FL_TEST(ary, ELTS_SHARED) &&
|
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 > ARY_DEFAULT_SIZE) {
|
||||||
RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2;
|
RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2;
|
||||||
REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);
|
REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);
|
||||||
|
|
Loading…
Reference in a new issue