summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-15 07:38:38 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-15 07:38:38 +0000
commite23aa93e5b35da0e9eba75cae8482e8ea47c00d8 (patch)
tree6ffffb2a798a2ca7a573fad67393ce4a50e81647 /array.c
parent518851f88d2bf0a66b829f8f05373f8ac8d1fdc4 (diff)
* 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 would break some script. so I reverted behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c7
1 files changed, 1 insertions, 6 deletions
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) {