1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (rb_ary_resize): should care of embeded array when extending

the array.

* array.c (rb_ary_resize): need to set capa when changing the real
  size of the array.
  these are latent bugs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2011-01-11 04:09:02 +00:00
parent dd55661f56
commit c480ca0f13
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,12 @@
Tue Jan 11 13:06:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
* array.c (rb_ary_resize): should care of embeded array when extending
the array.
* array.c (rb_ary_resize): need to set capa when changing the real
size of the array.
these are latent bugs.
Mon Jan 10 22:46:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/defines.h (CASEFOLD_FILESYSTEM): HFS+ is case

View file

@ -1332,7 +1332,7 @@ rb_ary_resize(VALUE ary, long len)
ary_double_capa(ary, len);
}
rb_mem_clear(RARRAY_PTR(ary) + olen, len - olen);
ARY_SET_HEAP_LEN(ary, len);
ARY_SET_LEN(ary, len);
}
else if (ARY_EMBED_P(ary)) {
ARY_SET_EMBED_LEN(ary, len);
@ -1347,6 +1347,7 @@ rb_ary_resize(VALUE ary, long len)
else {
if (olen > len + ARY_DEFAULT_SIZE) {
REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, len);
ARY_SET_CAPA(ary, len);
}
ARY_SET_HEAP_LEN(ary, len);
}