Index: src/runtime/protocol.m ================================================================== --- src/runtime/protocol.m +++ src/runtime/protocol.m @@ -20,21 +20,24 @@ #import "runtime.h" #import "runtime-private.h" @implementation Protocol -- (BOOL)_isImplementedByClass: (Class)cls +@end + +BOOL +class_conformsToProtocol(Class cls, Protocol *p) { struct objc_protocol_list *pl; struct objc_category **cats; long i, j; objc_global_mutex_lock(); for (pl = cls->protocols; pl != NULL; pl = pl->next) { for (i = 0; i < pl->count; i++) { - if (!strcmp(pl->list[i]->name, name)) { + if (!strcmp(pl->list[i]->name, p->name)) { objc_global_mutex_unlock(); return YES; } } } @@ -45,11 +48,11 @@ } for (i = 0; cats[i] != NULL; i++) { for (pl = cats[i]->protocols; pl != NULL; pl = pl->next) { for (j = 0; j < pl->count; j++) { - if (!strcmp(pl->list[j]->name, name)) { + if (!strcmp(pl->list[j]->name, p->name)) { objc_global_mutex_unlock(); return YES; } } } @@ -57,12 +60,5 @@ objc_global_mutex_unlock(); return NO; } -@end - -BOOL -class_conformsToProtocol(Class cls, Protocol *p) -{ - return [p _isImplementedByClass: cls]; -} Index: src/runtime/runtime.h ================================================================== --- src/runtime/runtime.h +++ src/runtime/runtime.h @@ -22,25 +22,10 @@ typedef struct objc_object *id; typedef const struct objc_selector *SEL; typedef signed char BOOL; typedef id (*IMP)(id, SEL, ...); -#ifdef __OBJC__ -@interface Protocol -{ -@private - Class isa; - const char *name; - struct objc_protocol_list *protocol_list; - struct objc_abi_method_description_list *instance_methods; - struct objc_abi_method_description_list *class_methods; -} -@end -#else -typedef const void Protocol; -#endif - struct objc_class { Class isa; Class superclass; const char *name; unsigned long version; @@ -88,10 +73,29 @@ const char *class_name; struct objc_method_list *instance_methods; struct objc_method_list *class_methods; struct objc_protocol_list *protocols; }; + +#ifdef __OBJC__ +@interface Protocol +{ +@public +#else +typedef struct { +#endif + Class isa; + const char *name; + struct objc_protocol_list *protocol_list; + struct objc_abi_method_description_list *instance_methods; + struct objc_abi_method_description_list *class_methods; +#ifdef __OBJC__ +} +@end +#else +} Protocol; +#endif struct objc_protocol_list { struct objc_protocol_list *next; long count; Protocol *list[1];