From 7a176201c64daa6a08cf45828ae019e1076ec176 Mon Sep 17 00:00:00 2001 From: theraven Date: Sun, 6 Jun 2010 21:08:14 +0000 Subject: [PATCH] ... and check superclasses when checking protocol conformance. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30589 72102866-910b-0410-8b05-ffd578937521 --- Source/ObjectiveC2/runtime.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Source/ObjectiveC2/runtime.c b/Source/ObjectiveC2/runtime.c index 0fd4871ad..028737e68 100644 --- a/Source/ObjectiveC2/runtime.c +++ b/Source/ObjectiveC2/runtime.c @@ -1066,22 +1066,26 @@ BOOL class_conformsToProtocol(Class cls, Protocol *protocol) { struct objc_protocol_list *protocols; - for (protocols = cls->protocols; - protocols != NULL ; protocols = protocols->next) + while (cls) { - int i; - for (i=0 ; icount ; i++) + for (protocols = cls->protocols; + protocols != NULL ; protocols = protocols->next) { - Protocol *p1 = (Protocol*)protocols->list[i]; - if (strcmp(p1->protocol_name, protocol->protocol_name) == 0) + int i; + for (i=0 ; icount ; i++) { - return YES; - } - if (protocol_conformsToProtocol(p1, protocol)) - { - return YES; + Protocol *p1 = (Protocol*)protocols->list[i]; + if (strcmp(p1->protocol_name, protocol->protocol_name) == 0) + { + return YES; + } + if (protocol_conformsToProtocol(p1, protocol)) + { + return YES; + } } } + cls = cls ->super_class; } return NO; }