[#1147] Copying RVALUE — why the lucky stiff <ruby-core@...>

Hello, everyone. Hope you are all doing well.

18 messages 2003/06/17
[#1155] Re: Copying RVALUE — matz@... (Yukihiro Matsumoto) 2003/06/20

Hi,

[#1157] Re: Copying RVALUE — why the lucky stiff <ruby-core@...> 2003/06/20

Yukihiro Matsumoto (matz@ruby-lang.org) wrote:

[#1173] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...>

Hi, I'm new to this mailing list so I don't know the procedure for

15 messages 2003/06/22
[#1174] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1175] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/22

On Sun, 2003-06-22 at 05:36, nobu.nokada@softhome.net wrote:

[#1176] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1193] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/25

On Sun, 2003-06-22 at 07:41, nobu.nokada@softhome.net wrote:

[#1177] Re: In 1.8.0 nil.to_s is not the same as "" — ts <decoux@...>

14 messages 2003/06/22

Re: [Patch] class.c code cleanup (rb_class_*_instance_methods)

From: nobu.nokada@...
Date: 2003-06-25 22:54:24 UTC
List: ruby-core #1198
Hi,

At Wed, 25 Jun 2003 21:12:02 +0900,
Yukihiro Matsumoto wrote:
> |Eh... It figures that I'd miss something like this... okay, but if
> |that's all that's wrong with it this time, it should be actually be
> |ready to go now (though, that's what I thought the last two times :)
> 
> It's already in.

Warnings are emitted.

  In file included from class.c:578:
  class.c: In function `rb_class_instance_methods':
  class.c:558: warning: passing arg 0 of `class_instance_method_list' from incompatible pointer type
  In file included from class.c:568:
  class.c:536: warning: passing arg 0 of `method_list' from incompatible pointer type
  In file included from class.c:587:
  class.c: In function `rb_class_protected_instance_methods':
  class.c:558: warning: passing arg 0 of `class_instance_method_list' from incompatible pointer type
  In file included from class.c:568:
  class.c:536: warning: passing arg 0 of `method_list' from incompatible pointer type
  In file included from class.c:596:
  class.c: In function `rb_class_private_instance_methods':
  class.c:558: warning: passing arg 0 of `class_instance_method_list' from incompatible pointer type
  In file included from class.c:568:
  class.c:536: warning: passing arg 0 of `method_list' from incompatible pointer type
  In file included from class.c:605:
  class.c: In function `rb_class_public_instance_methods':
  class.c:558: warning: passing arg 0 of `class_instance_method_list' from incompatible pointer type
  In file included from class.c:568:
  class.c:536: warning: passing arg 0 of `method_list' from incompatible pointer type
  In file included from class.c:569:
  class.c: At top level:
  class.c:536: warning: passing arg 0 of `method_list' from incompatible pointer type


And method_list() is no longer needed.


Index: class.c
===================================================================
RCS file: /cvs/ruby/src/ruby/class.c,v
retrieving revision 1.69
diff -u -2 -p -r1.69 class.c
--- class.c	25 Jun 2003 07:12:10 -0000	1.69
+++ class.c	25 Jun 2003 22:51:24 -0000
@@ -530,32 +530,13 @@ 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 recur, ary;
+    int recurse;
+    st_table *list;
 
     rb_scan_args(argc, argv, "01", &recur);
@@ -564,8 +545,21 @@ class_instance_method_list(argc, argv, m
 	rb_warn("%s: parameter will default to 'true' as of 1.8.1", rb_id2name(rb_frame_last_func()));
 #else
-	recur = Qtrue;
+	recurse = Qtrue;
 #endif
     }
-    return method_list(mod, RTEST(recur), func);
+    else {
+	recurse = RTEST(recur);
+    }
+
+    list = st_init_numtable();
+    for (; mod; mod = RCLASS(mod)->super) {
+	st_foreach(RCLASS(mod)->m_tbl, method_entry, (st_data_t)list);
+	if (!recurse) break;
+    }
+    ary = rb_ary_new();
+    st_foreach(list, func, ary);
+    st_free_table(list);
+
+    return ary;
 }
 


-- 
Nobu Nakada

In This Thread