mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
23c5ee8a9d
commit
efc605aead
3 changed files with 7 additions and 1 deletions
|
|
@ -34,6 +34,7 @@ newdate.rb
|
||||||
newver.rb
|
newver.rb
|
||||||
parse.c
|
parse.c
|
||||||
patches
|
patches
|
||||||
|
patches-master
|
||||||
pitest.rb
|
pitest.rb
|
||||||
ppack
|
ppack
|
||||||
preview
|
preview
|
||||||
|
|
|
||||||
|
|
@ -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>
|
Sat Sep 16 09:37:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* struct.c (inspect_struct): do not display a class name for
|
* struct.c (inspect_struct): do not display a class name for
|
||||||
|
|
|
||||||
2
array.c
2
array.c
|
|
@ -474,7 +474,7 @@ ary_shared_first(int argc, VALUE *argv, VALUE ary, int last)
|
||||||
if (last) {
|
if (last) {
|
||||||
offset = RARRAY_LEN(ary) - n;
|
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);
|
return rb_ary_new4(n, RARRAY_PTR(ary)+offset);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue