summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-11 04:09:02 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-11 04:09:02 +0000
commitc480ca0f131a5f87b8c49b8bf6af3684a13b2e84 (patch)
treee7bb55562e510be1d0246cf6639a50aeeb4b8bc4 /array.c
parentdd55661f56d7105adb5f6d5fe3ea1994f9d36390 (diff)
* 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
Diffstat (limited to 'array.c')
-rw-r--r--array.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/array.c b/array.c
index 43cc910cdc..c86562e5dc 100644
--- a/array.c
+++ b/array.c
@@ -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);
}