Skip to content

Commit 2047c47

Browse files
committed
* 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
1 parent 00dfd7d commit 2047c47

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Thu Jul 31 15:25:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* array.c (rb_ary_collect): must get length of array for each
4+
iteration. reported on [ruby-talk:77500], and fixed by
5+
K.Sasada <ko1@namikilab.tuat.ac.jp> on [ruby-talk:77504]
6+
17
Thu Jul 31 14:11:54 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
28

39
* ext/openssl/extconf.rb: move gmake specific features

array.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,16 +1190,15 @@ static VALUE
11901190
rb_ary_collect(ary)
11911191
VALUE ary;
11921192
{
1193-
long len, i;
1193+
long i;
11941194
VALUE collect;
11951195

11961196
if (!rb_block_given_p()) {
11971197
return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr);
11981198
}
11991199

1200-
len = RARRAY(ary)->len;
1201-
collect = rb_ary_new2(len);
1202-
for (i=0; i<len; i++) {
1200+
collect = rb_ary_new2(RARRAY(ary)->len);
1201+
for (i = 0; i < RARRAY(ary)->len; i++) {
12031202
rb_ary_push(collect, rb_yield(RARRAY(ary)->ptr[i]));
12041203
}
12051204
return collect;

0 commit comments

Comments
 (0)