summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-26 12:34:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-26 12:34:51 +0000
commit8c8e4f59c2e8247e1b485b458b38dbfa0744bfc9 (patch)
tree6b3ce89287db8afc551750c188868d20fd3b6f21 /class.c
parent79edd1af703289bfa827ac6418916ba28f490690 (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
Diffstat (limited to 'class.c')
-rw-r--r--class.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/class.c b/class.c
index 579cc83..0fce4bc 100644
--- a/class.c
+++ b/class.c
@@ -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