Skip to content

Commit c480ca0

Browse files
committed
* 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
1 parent dd55661 commit c480ca0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ChangeLog

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Tue Jan 11 13:06:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* array.c (rb_ary_resize): should care of embeded array when extending
4+
the array.
5+
6+
* array.c (rb_ary_resize): need to set capa when changing the real
7+
size of the array.
8+
these are latent bugs.
9+
110
Mon Jan 10 22:46:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
211

312
* include/ruby/defines.h (CASEFOLD_FILESYSTEM): HFS+ is case

array.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ rb_ary_resize(VALUE ary, long len)
13321332
ary_double_capa(ary, len);
13331333
}
13341334
rb_mem_clear(RARRAY_PTR(ary) + olen, len - olen);
1335-
ARY_SET_HEAP_LEN(ary, len);
1335+
ARY_SET_LEN(ary, len);
13361336
}
13371337
else if (ARY_EMBED_P(ary)) {
13381338
ARY_SET_EMBED_LEN(ary, len);
@@ -1347,6 +1347,7 @@ rb_ary_resize(VALUE ary, long len)
13471347
else {
13481348
if (olen > len + ARY_DEFAULT_SIZE) {
13491349
REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, len);
1350+
ARY_SET_CAPA(ary, len);
13501351
}
13511352
ARY_SET_HEAP_LEN(ary, len);
13521353
}

0 commit comments

Comments
 (0)