aboutsummaryrefslogtreecommitdiff
path: root/libobjc/selector.c
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-10-15 10:35:00 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-10-15 10:35:00 +0000
commitf7185d479171342a33ffc2bc76226e86d400a785 (patch)
tree25c0b3362de3f254c6fe9987ea63d4a668631f87 /libobjc/selector.c
parentfbbf834e27301ed73f079d0311a2f6d53d78d908 (diff)
downloadgcc-f7185d479171342a33ffc2bc76226e86d400a785.zip
gcc-f7185d479171342a33ffc2bc76226e86d400a785.tar.gz
gcc-f7185d479171342a33ffc2bc76226e86d400a785.tar.bz2
In libobjc/: 2010-10-14 Nicola Pero <nicola.pero@meta-innovation.com>
In libobjc/: 2010-10-14 Nicola Pero <nicola.pero@meta-innovation.com> * init.c (__objc_init_protocol): New function which fixes up a protocol's class pointer, registers it with the runtime, register all protocol selectors and registers associated protocols too. (objc_init_statics): Detect if we are initializing protocols, and if so, use __objc_init_protocol instead of only fixing up the class pointer. (__objc_init_protocls): Use __objc_init_protocol. * objc-private/module-abi-8.h: Updated comments. * objc-private/runtime.h (__objc_register_selectors_from_description_list): New. * selector.c (__objc_register_selectors_from_description_list): New. (struct objc_method_description_list): Declare. * Protocol.m ([-descriptionForInstanceMethod:]): Use sel_get_name when accessing the name of a method, which is now correctly a SEL. ([-descriptionForClassMethod:]): Same change. * protocols.c (protocol_getMethodDescription): Same change. * objc/runtime.h: Updated comments. (sel_registerTypedName): Fixed typo in function name. From-SVN: r165499
Diffstat (limited to 'libobjc/selector.c')
-rw-r--r--libobjc/selector.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/libobjc/selector.c b/libobjc/selector.c
index 1d4bc7e..ca8aa42 100644
--- a/libobjc/selector.c
+++ b/libobjc/selector.c
@@ -95,6 +95,40 @@ __objc_register_selectors_from_list (MethodList_t method_list)
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
+ lists of method descriptions, not methods.
+ */
+void
+__objc_register_selectors_from_description_list
+(struct objc_method_description_list *method_list)
+{
+ int i = 0;
+
+ objc_mutex_lock (__objc_runtime_mutex);
+ while (i < method_list->count)
+ {
+ struct objc_method_description *method = &method_list->list[i];
+ if (method->name)
+ {
+ method->name
+ = __sel_register_typed_name ((const char *) method->name,
+ method->types, 0, YES);
+ }
+ i += 1;
+ }
+ objc_mutex_unlock (__objc_runtime_mutex);
+}
/* Register instance methods as class methods for root classes */
void __objc_register_instance_methods_to_class (Class class)