mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* array.c (rb_ary_collect): must get length of array for each
iteration. reported on [ruby-talk:77500], and fixed by K.Sasada <ko1@namikilab.tuat.ac.jp> on [ruby-talk:77504] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
00dfd7d7cc
commit
2047c47d63
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Jul 31 15:25:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* array.c (rb_ary_collect): must get length of array for each
|
||||||
|
iteration. reported on [ruby-talk:77500], and fixed by
|
||||||
|
K.Sasada <ko1@namikilab.tuat.ac.jp> on [ruby-talk:77504]
|
||||||
|
|
||||||
Thu Jul 31 14:11:54 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
Thu Jul 31 14:11:54 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
* ext/openssl/extconf.rb: move gmake specific features
|
* ext/openssl/extconf.rb: move gmake specific features
|
||||||
|
|
7
array.c
7
array.c
|
@ -1190,16 +1190,15 @@ static VALUE
|
||||||
rb_ary_collect(ary)
|
rb_ary_collect(ary)
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
{
|
{
|
||||||
long len, i;
|
long i;
|
||||||
VALUE collect;
|
VALUE collect;
|
||||||
|
|
||||||
if (!rb_block_given_p()) {
|
if (!rb_block_given_p()) {
|
||||||
return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr);
|
return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = RARRAY(ary)->len;
|
collect = rb_ary_new2(RARRAY(ary)->len);
|
||||||
collect = rb_ary_new2(len);
|
for (i = 0; i < RARRAY(ary)->len; i++) {
|
||||||
for (i=0; i<len; i++) {
|
|
||||||
rb_ary_push(collect, rb_yield(RARRAY(ary)->ptr[i]));
|
rb_ary_push(collect, rb_yield(RARRAY(ary)->ptr[i]));
|
||||||
}
|
}
|
||||||
return collect;
|
return collect;
|
||||||
|
|
Loading…
Reference in a new issue