ruby-changes:4798
From: ko1@a...
Date: Mon, 5 May 2008 12:14:06 +0900 (JST)
Subject: [ruby-changes:4798] matz - Ruby:r16292 (trunk): * array.c (rb_ary_slice_bang): should adjust length before making
matz 2008-05-05 12:13:32 +0900 (Mon, 05 May 2008)
New Revision: 16292
Modified files:
trunk/ChangeLog
trunk/array.c
Log:
* array.c (rb_ary_slice_bang): should adjust length before making
sub-array.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?r1=16292&r2=16291&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16292&r2=16291&diff_format=u
Index: array.c
===================================================================
--- array.c (revision 16291)
+++ array.c (revision 16292)
@@ -1794,6 +1794,9 @@
pos = RARRAY_LEN(ary) + pos;
if (pos < 0) return Qnil;
}
+ if (RARRAY_LEN(ary) < len || RARRAY_LEN(ary) < pos + len) {
+ len = RARRAY_LEN(ary) - pos;
+ }
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) */
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16291)
+++ ChangeLog (revision 16292)
@@ -1,3 +1,8 @@
+Mon May 5 12:12:11 2008 Yukihiro Matsumoto <matz@r...>
+
+ * array.c (rb_ary_slice_bang): should adjust length before making
+ sub-array.
+
Mon May 5 11:36:14 2008 Yukihiro Matsumoto <matz@r...>
* array.c (rb_ary_dup): should dupe corresponding information.
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/