* array.c (ary_shared_first): should create embedded copies

instead of sharing memory region for smaller arrays.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-09-16 02:24:58 +00:00
parent 23c5ee8a9d
commit efc605aead
3 changed files with 7 additions and 1 deletions

View File

@ -34,6 +34,7 @@ newdate.rb
newver.rb
parse.c
patches
patches-master
pitest.rb
ppack
preview

View File

@ -1,3 +1,8 @@
Sat Sep 16 11:03:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (ary_shared_first): should create embedded copies
instead of sharing memory region for smaller arrays.
Sat Sep 16 09:37:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* struct.c (inspect_struct): do not display a class name for

View File

@ -474,7 +474,7 @@ ary_shared_first(int argc, VALUE *argv, VALUE ary, int last)
if (last) {
offset = RARRAY_LEN(ary) - n;
}
if (ARY_EMBED_P(ary)) {
if (ARY_EMBED_P(ary) || n <= RARRAY_EMBED_LEN_MAX) {
return rb_ary_new4(n, RARRAY_PTR(ary)+offset);
}
else {