summaryrefslogtreecommitdiff
path: root/array.c
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 /array.c
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
Diffstat (limited to 'array.c')
-rw-r--r--array.c2
1 files changed, 1 insertions, 1 deletions
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 {