summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-01 14:45:38 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-01 14:45:38 +0000
commit3c774662e10caf7849440bc5a48d794c8d1da09b (patch)
tree6d9af0bdaad0c0728299a0bf031e08e8e4201961
parentbcae240ca5d6f4f575da0f893363f1d927406292 (diff)
* array.c (rb_ary_shift): should not move memory region if array
body is shared. a patch from Kent Sibilev <ksruby at gmail.com>. [ruby-core:08922] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--array.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cfa44fb..be38ae4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,12 @@ Tue Sep 26 15:31:26 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* {win32,wince}/Makefile.sub (CPP): check predefined value.
+Tue Sep 26 07:55:16 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_shift): should not move memory region if array
+ body is shared. a patch from Kent Sibilev <ksruby at gmail.com>.
+ [ruby-core:08922]
+
Mon Sep 25 22:26:26 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_path_end): skip root directory. fixed: [ruby-core:08913]
diff --git a/array.c b/array.c
index 6df82f7..2e9d927 100644
--- a/array.c
+++ b/array.c
@@ -501,7 +501,7 @@ rb_ary_shift(ary)
rb_ary_modify_check(ary);
if (RARRAY(ary)->len == 0) return Qnil;
top = RARRAY(ary)->ptr[0];
- if (RARRAY_LEN(ary) < ARY_DEFAULT_SIZE) {
+ if (RARRAY_LEN(ary) < ARY_DEFAULT_SIZE && !FL_TEST(ary, ELTS_SHARED)) {
MEMMOVE(RARRAY_PTR(ary), RARRAY_PTR(ary)+1, VALUE, RARRAY_LEN(ary));
}
else {