* 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/trunk@11024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-09-25 22:58:13 +00:00
parent 500a5c34ac
commit 94fa180c07
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
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 23:10:46 2006 Yukihiro Matsumoto <matz@ruby-lang.org> Mon Sep 25 23:10:46 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (rb_push_glob): need not to check by FilePathValue(). * dir.c (rb_push_glob): need not to check by FilePathValue().

View File

@ -578,7 +578,7 @@ rb_ary_shift(VALUE ary)
rb_ary_modify_check(ary); rb_ary_modify_check(ary);
if (RARRAY_LEN(ary) == 0) return Qnil; if (RARRAY_LEN(ary) == 0) return Qnil;
top = RARRAY_PTR(ary)[0]; top = RARRAY_PTR(ary)[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)); MEMMOVE(RARRAY_PTR(ary), RARRAY_PTR(ary)+1, VALUE, RARRAY_LEN(ary));
ARY_SET_LEN(ary, RARRAY_LEN(ary)-1); ARY_SET_LEN(ary, RARRAY_LEN(ary)-1);
} }