summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--array.c7
2 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index bc21d5d..123aa7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Nov 15 16:23:26 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * array.c (rb_ary_fill): previous commit disabled this usage:
+
+ a = [0,1,2,3,4,5,6,7,8,9]
+ a.fill {|i| a[i] * 10} #=> [nil, nil, ...., nil]
+
+ previous commit has advantange for early garbage collection, but
+ potensially this would break some script. so I reverted behavior.
+
Tue Nov 15 16:04:10 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* array.c (rb_ary_fill): tail elements were vanished when the middle
diff --git a/array.c b/array.c
index b23c311..b808c64 100644
--- a/array.c
+++ b/array.c
@@ -2261,13 +2261,8 @@ rb_ary_fill(argc, argv, ary)
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
RARRAY(ary)->aux.capa = end;
}
- RARRAY(ary)->len = end;
- }
- if (beg > RARRAY(ary)->len) {
rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, end - RARRAY(ary)->len);
- }
- else {
- rb_mem_clear(RARRAY(ary)->ptr + beg, end - beg);
+ RARRAY(ary)->len = end;
}
if (block_p) {