Differences From Artifact [7ba1a7ad23]:
- File src/runtime/protocol.m — part of check-in [813c00ccf0] at 2013-01-09 22:24:47 on branch trunk — Update copyright. (user: js, size: 1925) [annotate] [blame] [check-ins using]
To Artifact [b56dfa610a]:
- File
src/runtime/protocol.m
— part of check-in
[c5ef582958]
at
2013-03-04 17:20:15
on branch trunk
— Replace BOOL with bool.
The only places where BOOL is left are those where they are required by
the ABI. (user: js, size: 1938) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
26 27 28 29 30 31 32 | inline const char* protocol_getName(Protocol *p) { return p->name; } | | < > | | | < > | | | | | 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | 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 true; 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 true; return false; } bool class_conformsToProtocol(Class cls, Protocol *p) { struct objc_protocol_list *pl; struct objc_category **cats; long i, j; for (pl = cls->protocols; pl != NULL; pl = pl->next) for (i = 0; i < pl->count; i++) if (protocol_conformsToProtocol(pl->list[i], p)) return true; objc_global_mutex_lock(); if ((cats = objc_categories_for_class(cls)) == NULL) { objc_global_mutex_unlock(); return false; } 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 (protocol_conformsToProtocol( pl->list[j], p)) { objc_global_mutex_unlock(); return true; } } } } objc_global_mutex_unlock(); return false; } |