summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-29 04:55:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-29 04:55:10 +0000
commit0580ba06110f7998fdaead724907a4c8d6540107 (patch)
tree4ceed7d1642d46a147114fc1a303ce5257af49bb /enum.c
parent2bb26c118d9e52a52940f73c9cb1fc26e07003d6 (diff)
downloadruby-0580ba06110f7998fdaead724907a4c8d6540107.tar.gz
* array.c (rb_ary_to_ary): do not use #respond_to? to detect
to_ary. Just call. [ruby-core:23738] * eval.c (rb_check_funcall): new function with method existence check. returns Qundef when the method does not exist. * enumerator.c (enumerator_rewind): just call method, using rb_check_funcall(). [ruby-core:23738] * error.c (exc_equal): ditto. * object.c (convert_type): ditto. * error.c (rb_name_err_mesg_new): export function. * eval.c (make_exception): ditto. * io.c (pop_last_hash): return early when the last argument is nil. * io.c (rb_io_puts): treat T_STRING specially for small optimization. * vm_eval.c (raise_method_missing): skip method call if possible using rb_method_basic_definition_p(). * vm_eval.c (method_missing): ditto. * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test suites changed to ignore exceptions caused by just-call policy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/enum.c b/enum.c
index 875beb9eaf..c1efb1b5c2 100644
--- a/enum.c
+++ b/enum.c
@@ -149,9 +149,10 @@ enum_count(int argc, VALUE *argv, VALUE obj)
func = count_iter_i;
}
else {
- if (rb_respond_to(obj, id_size)) {
- return rb_funcall(obj, id_size, 0, 0);
- }
+ VALUE tmp;
+
+ tmp = rb_check_funcall(obj, id_size, 0, 0);
+ if (tmp != Qundef) return tmp;
func = count_all_i;
}
}