diff mbox

libobjc: have selectors.c use objc/runtime.h instead of objc/objc-api.h

Message ID 1292363931.48464505@192.168.2.229
State New
Headers show

Commit Message

Nicola Pero Dec. 14, 2010, 9:58 p.m. UTC
This patch migrates selectors.c to use the new Objective-C runtime API,
and removes a now obsolete #undef in objects.c.

It's part of a process of tidying up a few lose ends remained in libobjc
after migrating to the new API.

Committed to trunk.

Thanks

2010-12-14  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objects.c (object_copy): Do not #undef as we are no longer
        including objc/objc-api.h.
        * selector.c: Include objc/runtime.h and
        objc-private/module-abi-8.h.  Do not include objc/objc-api.h and
        objc/encoding.h.  Updated
        (__objc_register_selectors_from_class): Use struct
        objc_method_list * instead of MethodList_t.
        (__objc_register_selectors_from_list): Use Method instead of
        Method_t.
        (struct objc_method_description_list): Do not define here.
        (__objc_register_instance_methods_to_class): Use struct
        objc_method_list * instead of MethodList_t and Method instead of
        Method_t.
diff mbox

Patch

Index: selector.c
===================================================================
--- selector.c	(revision 167817)
+++ selector.c	(working copy)
@@ -23,13 +23,13 @@  see the files COPYING3 and COPYING.RUNTIME respect
 <http://www.gnu.org/licenses/>.  */
 
 #include "objc-private/common.h"
-#include "objc/objc-api.h"
+#include "objc/runtime.h"
 #include "objc/thr.h"
 #include "objc-private/hash.h"
-#include "objc-private/objc-list.h" 
+#include "objc-private/objc-list.h"
+#include "objc-private/module-abi-8.h"
 #include "objc-private/runtime.h"
 #include "objc-private/sarray.h"
-#include "objc/encoding.h"
 
 /* Initial selector hash table size. Value doesn't matter much.  */
 #define SELECTOR_HASH_SIZE 128
@@ -57,7 +57,7 @@  void __objc_init_selector_tables (void)
 void
 __objc_register_selectors_from_class (Class class)
 {
-  MethodList_t method_list;
+  struct objc_method_list * method_list;
 
   method_list = class->methods;
   while (method_list)
@@ -75,14 +75,14 @@  __objc_register_selectors_from_class (Class class)
    The name and type pointers in the method list must be permanent and
    immutable.  */
 void
-__objc_register_selectors_from_list (MethodList_t method_list)
+__objc_register_selectors_from_list (struct objc_method_list *method_list)
 {
   int i = 0;
 
   objc_mutex_lock (__objc_runtime_mutex);
   while (i < method_list->method_count)
     {
-      Method_t method = &method_list->method_list[i];
+      Method method = &method_list->method_list[i];
       if (method->method_name)
 	{
 	  method->method_name
@@ -94,15 +94,6 @@  void
   objc_mutex_unlock (__objc_runtime_mutex);
 }
 
-/* Temporary definition while we include objc/objc-api.h instead of
-   objc-private/module-abi-8.h.  It should go away once we include
-   module-abi-8.h.  */
-struct objc_method_description_list
-{
-  int count;
-  struct objc_method_description list[1];
-};
-
 /* The same as __objc_register_selectors_from_list, but works on a
    struct objc_method_description_list* instead of a struct
    objc_method_list*.  This is only used for protocols, which have
@@ -131,11 +122,11 @@  __objc_register_selectors_from_description_list
 /* Register instance methods as class methods for root classes.  */
 void __objc_register_instance_methods_to_class (Class class)
 {
-  MethodList_t method_list;
-  MethodList_t class_method_list;
+  struct objc_method_list *method_list;
+  struct objc_method_list *class_method_list;
   int max_methods_no = 16;
-  MethodList_t new_list;
-  Method_t curr_method;
+  struct objc_method_list *new_list;
+  Method curr_method;
 
   /* Only if a root class. */
   if (class->super_class)
@@ -156,7 +147,7 @@  void __objc_register_instance_methods_to_class (Cl
       /* Iterate through the methods from this method list.  */
       for (i = 0; i < method_list->method_count; i++)
 	{
-	  Method_t mth = &method_list->method_list[i];
+	  Method mth = &method_list->method_list[i];
 	  if (mth->method_name
 	      && ! search_for_method_in_list (class_method_list,
 					      mth->method_name))
Index: objects.c
===================================================================
--- objects.c	(revision 167817)
+++ objects.c	(working copy)
@@ -72,9 +72,6 @@  class_create_instance (Class class)
   return class_createInstance (class, 0);
 }
 
-/* Temporary, while we are including objc-api.h instead of runtime.h.  */
-#undef object_copy
-
 id
 object_copy (id object, size_t extraBytes)
 {
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 167817)
+++ ChangeLog	(working copy)
@@ -1,5 +1,21 @@ 
 2010-12-14  Nicola Pero  <nicola.pero@meta-innovation.com>
 
+	* objects.c (object_copy): Do not #undef as we are no longer
+	including objc/objc-api.h.
+	* selector.c: Include objc/runtime.h and
+	objc-private/module-abi-8.h.  Do not include objc/objc-api.h and
+	objc/encoding.h.  Updated
+	(__objc_register_selectors_from_class): Use struct
+	objc_method_list * instead of MethodList_t.
+	(__objc_register_selectors_from_list): Use Method instead of
+	Method_t.
+	(struct objc_method_description_list): Do not define here.
+	(__objc_register_instance_methods_to_class): Use struct
+	objc_method_list * instead of MethodList_t and Method instead of
+	Method_t.
+	
+2010-12-14  Nicola Pero  <nicola.pero@meta-innovation.com>
+
 	* selector.c: Reindented some code and tidied up comments.  No
 	actual code changes.