diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-26 12:34:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-26 12:34:51 +0000 |
commit | 8c8e4f59c2e8247e1b485b458b38dbfa0744bfc9 (patch) | |
tree | 6b3ce89287db8afc551750c188868d20fd3b6f21 | |
parent | 79edd1af703289bfa827ac6418916ba28f490690 (diff) |
* 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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | class.c | 46 |
2 files changed, 27 insertions, 25 deletions
@@ -1,3 +1,9 @@ +Thu Jun 26 21:34:49 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> + + * 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 <jivera@flame.org> * class.c (rb_generic_class_instance_methods): merge argument @@ -529,44 +529,40 @@ method_entry(key, body, list) } static VALUE -method_list(mod, recur, func) - VALUE mod; - int recur; - int (*func)(); -{ - st_table *list; - VALUE klass, ary; - - list = st_init_numtable(); - for (klass = mod; klass; klass = RCLASS(klass)->super) { - st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list); - if (!recur) break; - } - ary = rb_ary_new(); - st_foreach(list, func, ary); - st_free_table(list); - - return ary; -} - -static VALUE class_instance_method_list(argc, argv, mod, func) int argc; VALUE *argv; VALUE mod; - void (*func)(); + int (*func) _((ID, long, VALUE)); { - VALUE recur; + VALUE ary; + int recur; + st_table *list; - 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())); + recur = Qfalse; #else recur = Qtrue; #endif } - return method_list(mod, RTEST(recur), func); + else { + VALUE r; + rb_scan_args(argc, argv, "01", &r); + recur = RTEST(r); + } + + list = st_init_numtable(); + 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(); + st_foreach(list, func, ary); + st_free_table(list); + + return ary; } VALUE |