Differences From Artifact [234e32b5ef]:
- File src/runtime/protocol.m — part of check-in [650f34cb63] at 2012-03-06 17:09:45 on branch runtime — Fix a typo. (user: js, size: 1511) [annotate] [blame] [check-ins using]
To Artifact [1e751e9c03]:
- File
src/runtime/protocol.m
— part of check-in
[df24f80ab0]
at
2012-04-08 14:06:14
on branch runtime
— Don't have any methods in Protocol.
Messaging protocols is deprecated and unreliable. Thus we shouldn't do
it in the runtime either. (user: js, size: 1431) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 | #include <string.h> #import "runtime.h" #import "runtime-private.h" @implementation Protocol | > | > > | | < < < < < < < | 18 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 62 63 64 | #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; 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, p->name)) { objc_global_mutex_unlock(); return YES; } } } if ((cats = objc_categories_for_class(cls)) == NULL) { objc_global_mutex_unlock(); return NO; } 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, p->name)) { objc_global_mutex_unlock(); return YES; } } } } objc_global_mutex_unlock(); return NO; } |