ruby-changes:4277
From: ko1@a...
Date: Fri, 14 Mar 2008 01:43:52 +0900 (JST)
Subject: [ruby-changes:4277] matz - Ruby:r15767 (trunk): * array.c (rb_ary_slice_bang): should not use rb_ary_subseq()
matz 2008-03-14 01:39:45 +0900 (Fri, 14 Mar 2008) New Revision: 15767 Modified files: trunk/ChangeLog trunk/array.c Log: * 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] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?r1=15767&r2=15766&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15767&r2=15766&diff_format=u Index: array.c =================================================================== --- array.c (revision 15766) +++ array.c (revision 15767) @@ -1790,7 +1790,8 @@ 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; } Index: ChangeLog =================================================================== --- ChangeLog (revision 15766) +++ ChangeLog (revision 15767) @@ -1,3 +1,9 @@ +Thu Mar 13 21:00:50 2008 Yukihiro Matsumoto <matz@r...> + + * 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@r...> * {bcc,win}32/Makefile.sub (config.h): define uint32_t. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/