From 8c8e4f59c2e8247e1b485b458b38dbfa0744bfc9 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 26 Jun 2003 12:34:51 +0000 Subject: [PATCH] * class.c (class_instance_method_list): get rid of warning about arguement type mismatch, and inline method_list(). [ruby-core:01198] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ class.c | 48 ++++++++++++++++++++++-------------------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2168909719..b209603e61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 26 21:34:49 2003 Nobuyoshi Nakada + + * class.c (class_instance_method_list): get rid of warning about + arguement type mismatch, and inline method_list(). + [ruby-core:01198] + Wed Jun 25 12:52:58 2003 Matthew Dempsky * class.c (rb_generic_class_instance_methods): merge argument diff --git a/class.c b/class.c index 579cc83c7e..0fce4bcfca 100644 --- a/class.c +++ b/class.c @@ -529,17 +529,33 @@ method_entry(key, body, list) } static VALUE -method_list(mod, recur, func) +class_instance_method_list(argc, argv, mod, func) + int argc; + VALUE *argv; VALUE mod; - int recur; - int (*func)(); + int (*func) _((ID, long, VALUE)); { + VALUE ary; + int recur; st_table *list; - VALUE klass, ary; + + if (argc == 0) { +#if RUBY_VERSION_CODE < 181 + rb_warn("%s: parameter will default to 'true' as of 1.8.1", rb_id2name(rb_frame_last_func())); + recur = Qfalse; +#else + recur = Qtrue; +#endif + } + else { + VALUE r; + rb_scan_args(argc, argv, "01", &r); + recur = RTEST(r); + } list = st_init_numtable(); - for (klass = mod; klass; klass = RCLASS(klass)->super) { - st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list); + for (; mod; mod = RCLASS(mod)->super) { + st_foreach(RCLASS(mod)->m_tbl, method_entry, (st_data_t)list); if (!recur) break; } ary = rb_ary_new(); @@ -549,26 +565,6 @@ method_list(mod, recur, func) return ary; } -static VALUE -class_instance_method_list(argc, argv, mod, func) - int argc; - VALUE *argv; - VALUE mod; - void (*func)(); -{ - VALUE recur; - - rb_scan_args(argc, argv, "01", &recur); - if (argc == 0) { -#if RUBY_VERSION_CODE < 181 - rb_warn("%s: parameter will default to 'true' as of 1.8.1", rb_id2name(rb_frame_last_func())); -#else - recur = Qtrue; -#endif - } - return method_list(mod, RTEST(recur), func); -} - VALUE rb_class_instance_methods(argc, argv, mod) int argc;