[macruby-changes] [1768] MacRuby/branches/experimental/array.c
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 5 19:15:06 PDT 2009
Revision: 1768
http://trac.macosforge.org/projects/ruby/changeset/1768
Author: lsansonetti at apple.com
Date: 2009-06-05 19:15:05 -0700 (Fri, 05 Jun 2009)
Log Message:
-----------
Array#insert: check if the receiver can be modified even if we do nothing, fixed a bug in the way we should pass the array with nil objects in case the given offset is greater than the receiver's length
Modified Paths:
--------------
MacRuby/branches/experimental/array.c
Modified: MacRuby/branches/experimental/array.c
===================================================================
--- MacRuby/branches/experimental/array.c 2009-06-06 02:02:35 UTC (rev 1767)
+++ MacRuby/branches/experimental/array.c 2009-06-06 02:15:05 UTC (rev 1768)
@@ -1008,12 +1008,13 @@
rb_ary_modify(ary);
if (beg >= n) {
long i;
- for (i = n; i < beg - n; i++) {
+ for (i = n; i < beg; i++) {
CFArrayAppendValue((CFMutableArrayRef)ary, (const void *)kCFNull);
}
- if (rlen > 0)
+ if (rlen > 0) {
CFArrayAppendArray((CFMutableArrayRef)ary, (CFArrayRef)rpl,
CFRangeMake(0, rlen));
+ }
}
else {
const void **values;
@@ -1104,7 +1105,10 @@
{
long pos;
- if (argc == 1) return ary;
+ if (argc == 1) {
+ rb_ary_modify(ary);
+ return ary;
+ }
if (argc < 1) {
rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090605/fbd1a292/attachment.html>
More information about the macruby-changes
mailing list