mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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/trunk@9543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d0f784a071
commit
ea4a254de5
2 changed files with 11 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Nov 15 16:36:03 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 would break some script. so I reverted behavior.
|
||||||
|
|
||||||
Tue Nov 15 16:15:23 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Nov 15 16:15:23 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (file_load_ok): use eaccess() instead of actually opening
|
* file.c (file_load_ok): use eaccess() instead of actually opening
|
||||||
|
|
7
array.c
7
array.c
|
@ -2137,13 +2137,8 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
|
||||||
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
|
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
|
||||||
RARRAY(ary)->aux.capa = 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);
|
rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, end - RARRAY(ary)->len);
|
||||||
}
|
RARRAY(ary)->len = end;
|
||||||
else {
|
|
||||||
rb_mem_clear(RARRAY(ary)->ptr + beg, end - beg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block_p) {
|
if (block_p) {
|
||||||
|
|
Loading…
Reference in a new issue