summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-16 02:24:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-16 02:24:58 +0000
commit33d5995270b655343d8d3b63d9ecd8c2aa808cc1 (patch)
tree077d3c6124832c82d2a30c9f81bcb4596bedb9a5
parent6f228672886be425558be685da5b6ccf0314a806 (diff)
downloadruby-33d5995270b655343d8d3b63d9ecd8c2aa808cc1.tar.gz
ruby-33d5995270b655343d8d3b63d9ecd8c2aa808cc1.tar.xz
ruby-33d5995270b655343d8d3b63d9ecd8c2aa808cc1.zip
* array.c (ary_shared_first): should create embedded copies
instead of sharing memory region for smaller arrays. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--.cvsignore1
-rw-r--r--ChangeLog5
-rw-r--r--array.c2
3 files changed, 7 insertions, 1 deletions
diff --git a/.cvsignore b/.cvsignore
index 5004a53b7..9709c87cb 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -34,6 +34,7 @@ newdate.rb
newver.rb
parse.c
patches
+patches-master
pitest.rb
ppack
preview
diff --git a/ChangeLog b/ChangeLog
index 516c08a23..43831ae93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/array.c b/array.c
index cb3644837..d154bf35e 100644
--- a/array.c
+++ b/array.c
@@ -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 {