diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-13 16:39:45 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-13 16:39:45 +0000 |
commit | 2b8bbd765eafe421bbbc9012968d6e0b2ad5efaa (patch) | |
tree | c1b87b6a21743408ae12ef0a30df8cb92d928e4e | |
parent | 1abdfa49b0ee4adf3e09f97f0c7a502ce3e4e9c4 (diff) | |
download | ruby-2b8bbd765eafe421bbbc9012968d6e0b2ad5efaa.tar.gz ruby-2b8bbd765eafe421bbbc9012968d6e0b2ad5efaa.tar.xz ruby-2b8bbd765eafe421bbbc9012968d6e0b2ad5efaa.zip |
* array.c (rb_ary_slice_bang): should not use rb_ary_subseq()
which shares internal pointer. splice modifies the receiver
right after subseq. [ruby-dev:34005]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | array.c | 3 |
2 files changed, 8 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Thu Mar 13 21:00:50 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * array.c (rb_ary_slice_bang): should not use rb_ary_subseq() + which shares internal pointer. splice modifies the receiver + right after subseq. [ruby-dev:34005] + Thu Mar 13 19:42:43 2008 NAKAMURA Usaku <usa@ruby-lang.org> * {bcc,win}32/Makefile.sub (config.h): define uint32_t. @@ -1790,7 +1790,8 @@ rb_ary_slice_bang(int argc, VALUE *argv, VALUE ary) pos = RARRAY_LEN(ary) + pos; if (pos < 0) return Qnil; } - arg2 = rb_ary_subseq(ary, pos, len); + arg2 = rb_ary_new4(len, RARRAY_PTR(ary)+pos); + RBASIC(arg2)->klass = rb_obj_class(ary); rb_ary_splice(ary, pos, len, Qundef); /* Qnil/rb_ary_new2(0) */ return arg2; } |