1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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>
* 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);
if (RARRAY_LEN(ary) == 0) return Qnil;
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));
ARY_SET_LEN(ary, RARRAY_LEN(ary)-1);
}