Overview
Comment: | Add protocol_{getName,isEqual,conformsToProtocol}. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | runtime |
Files: | files | file ages | folders |
SHA3-256: |
b8744d8d68b874127a9e140826030d00 |
User & Date: | js on 2012-04-08 14:14:46 |
Other Links: | branch diff | manifest | tags |
Context
2012-04-08
| ||
14:25 | Properly call initialize. check-in: 36d5f460a5 user: js tags: runtime | |
14:14 | Add protocol_{getName,isEqual,conformsToProtocol}. check-in: b8744d8d68 user: js tags: runtime | |
14:07 | Reduce locking in class_conformsToProtocol(). check-in: 10c3b59143 user: js tags: runtime | |
Changes
Modified src/runtime/protocol.m from [c0d1405d27] to [9f39113692].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <string.h> #import "runtime.h" #import "runtime-private.h" @implementation Protocol @end BOOL class_conformsToProtocol(Class cls, Protocol *p) { struct objc_protocol_list *pl; struct objc_category **cats; long i, j; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include <string.h> #import "runtime.h" #import "runtime-private.h" @implementation Protocol @end inline const char* protocol_getName(Protocol *p) { return p->name; } inline BOOL protocol_isEqual(Protocol *a, Protocol *b) { return !strcmp(protocol_getName(a), protocol_getName(b)); } BOOL protocol_conformsToProtocol(Protocol *a, Protocol *b) { struct objc_protocol_list *pl; size_t i; if (protocol_isEqual(a, b)) return YES; for (pl = a->protocol_list; pl != NULL; pl = pl->next) for (i = 0; i < pl->count; i++) if (protocol_conformsToProtocol(pl->list[i], b)) return YES; return NO; } BOOL class_conformsToProtocol(Class cls, Protocol *p) { struct objc_protocol_list *pl; struct objc_category **cats; long i, j; |
︙ | ︙ |
Modified src/runtime/runtime.h from [a7ea76e777] to [97bbb9569f].
︙ | ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 | extern BOOL class_respondsToSelector(Class, SEL); extern BOOL class_conformsToProtocol(Class, Protocol*); extern IMP class_getMethodImplementation(Class, SEL); extern IMP class_replaceMethod(Class, SEL, IMP, const char*); extern const char* objc_get_type_encoding(Class, SEL); extern IMP objc_msg_lookup(id, SEL); extern IMP objc_msg_lookup_super(struct objc_super*, SEL); extern void objc_thread_add(void); extern void objc_thread_remove(void); extern void objc_exit(void); #endif | > > > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | extern BOOL class_respondsToSelector(Class, SEL); extern BOOL class_conformsToProtocol(Class, Protocol*); extern IMP class_getMethodImplementation(Class, SEL); extern IMP class_replaceMethod(Class, SEL, IMP, const char*); extern const char* objc_get_type_encoding(Class, SEL); extern IMP objc_msg_lookup(id, SEL); extern IMP objc_msg_lookup_super(struct objc_super*, SEL); extern const char* protocol_getName(Protocol*); extern BOOL protocol_isEqual(Protocol*, Protocol*); extern BOOL protocol_conformsToProtocol(Protocol*, Protocol*); extern void objc_thread_add(void); extern void objc_thread_remove(void); extern void objc_exit(void); #endif |