* array.c (rb_ary_each): prohibit array modification during each

iteration.  [ruby-core:09104]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-10-11 05:59:41 +00:00
Родитель fedfa6e5fa
Коммит 4d49ec8d3f
2 изменённых файлов: 41 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Wed Oct 11 14:58:44 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_each): prohibit array modification during each
iteration. [ruby-core:09104]
Wed Oct 11 14:56:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/digest/sha1/sha1ossl.h: libssl 0.9.8c-3 defines no

36
array.c
Просмотреть файл

@ -1245,6 +1245,42 @@ iter_unlock(VALUE ary)
return ary;
}
VALUE
each_internal(VALUE ary)
{
long i;
for (i=0; i<RARRAY_LEN(ary); i++) {
rb_yield(RARRAY_PTR(ary)[i]);
}
return ary;
}
static VALUE
iter_unlock(VALUE ary)
{
FL_UNSET(ary, ARY_TMPLOCK);
return ary;
}
VALUE
each_internal(VALUE ary)
{
long i;
for (i=0; i<RARRAY_LEN(ary); i++) {
rb_yield(RARRAY_PTR(ary)[i]);
}
return ary;
}
static VALUE
iter_unlock(VALUE ary)
{
FL_UNSET(ary, ARY_TMPLOCK);
return ary;
}
/*
* call-seq:
* array.each {|item| block } -> array