diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-11 05:59:41 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-11 05:59:41 +0000 |
commit | 4d49ec8d3f96d2d675cbeb930bd548739e123240 (patch) | |
tree | e667e2073525e2806d6108cb8b1150b1bba5f808 | |
parent | fedfa6e5fac9ffc3b1ac7fbbcbaec39ca0cf54a1 (diff) |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | array.c | 36 |
2 files changed, 41 insertions, 0 deletions
@@ -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 @@ -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 |