summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-25 01:55:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-25 01:55:44 +0000
commit0e4abc3295804b5af91542cdc1d278caef5d6d36 (patch)
treef36563609623ad32fa9e806f5ffc67c927b304d4 /class.c
parent2fdc058e805e1b56da519b096b9a2d8966566f4d (diff)
class.c: simplify
* class.c (rb_obj_methods): simplify without jump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/class.c b/class.c
index e161e25063..25f73ecd51 100644
--- a/class.c
+++ b/class.c
@@ -1289,20 +1289,11 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
VALUE
rb_obj_methods(int argc, VALUE *argv, VALUE obj)
{
- retry:
- if (argc == 0) {
- return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_i);
- }
- else {
- VALUE recur;
-
- rb_scan_args(argc, argv, "1", &recur);
- if (RTEST(recur)) {
- argc = 0;
- goto retry;
- }
+ rb_check_arity(argc, 0, 1);
+ if (argc > 0 && !RTEST(argv[0])) {
return rb_obj_singleton_methods(argc, argv, obj);
}
+ return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_i);
}
/*