[前][次][番号順一覧][スレッド一覧]

ruby-changes:32621

From: nobu <ko1@a...>
Date: Sat, 25 Jan 2014 10:55:50 +0900 (JST)
Subject: [ruby-changes:32621] nobu:r44700 (trunk): class.c: simplify

nobu	2014-01-25 10:55:44 +0900 (Sat, 25 Jan 2014)

  New Revision: 44700

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44700

  Log:
    class.c: simplify
    
    * class.c (rb_obj_methods): simplify without jump.

  Modified files:
    trunk/class.c
Index: class.c
===================================================================
--- class.c	(revision 44699)
+++ class.c	(revision 44700)
@@ -1289,20 +1289,11 @@ rb_class_public_instance_methods(int arg https://github.com/ruby/ruby/blob/trunk/class.c#L1289
 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);
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]