зеркало из https://github.com/github/ruby.git
* 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:
Родитель
fedfa6e5fa
Коммит
4d49ec8d3f
|
@ -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>
|
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
|
* ext/digest/sha1/sha1ossl.h: libssl 0.9.8c-3 defines no
|
||||||
|
|
36
array.c
36
array.c
|
@ -1245,6 +1245,42 @@ iter_unlock(VALUE ary)
|
||||||
return 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:
|
* call-seq:
|
||||||
* array.each {|item| block } -> array
|
* array.each {|item| block } -> array
|
||||||
|
|
Загрузка…
Ссылка в новой задаче