diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-29 17:16:05 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-29 17:16:05 +0000 |
commit | 7f2ef1a96e3ae57b578bbb4d996fce3ddefc81fa (patch) | |
tree | bc6299ca6771ec0811ce6b11331987b4ebf0ca46 /enum.c | |
parent | 2f2e8455e3644385e517299163bb538cd4f07030 (diff) |
* enum.c (enum_count): call #size using rb_funcall_no_recursive()
to prevent infinite recursive calls. [ruby-core:24794]
* vm_eval.c (rb_funcall_no_recursive): utility function to check
direct recursive call.
* vm_eval.c (rb_check_funcall): move from eval.c. [refactoring]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r-- | enum.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -119,6 +119,8 @@ count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv) return Qnil; } +extern VALUE rb_funcall_no_recursive(VALUE, ID, int, VALUE*, VALUE (*)()); + /* * call-seq: * enum.count => int @@ -150,8 +152,8 @@ enum_count(int argc, VALUE *argv, VALUE obj) } else { VALUE tmp; - - tmp = rb_check_funcall(obj, id_size, 0, 0); + + tmp = rb_funcall_no_recursive(obj, id_size, 0, 0, enum_count); if (tmp != Qundef) return tmp; func = count_all_i; } |