From a2dbc582de760ce5d49bc27b9388ca2e8e03f63e Mon Sep 17 00:00:00 2001 From: theraven Date: Thu, 21 Jan 2010 17:35:25 +0000 Subject: [PATCH] Made objc_getProtocol() return a protocol from the protocol table, rather than creating a new one. --- protocol.c | 7 +++++++ runtime.c | 10 +--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/protocol.c b/protocol.c index 7e8003a..0324f40 100644 --- a/protocol.c +++ b/protocol.c @@ -133,3 +133,10 @@ struct objc_protocol2 *__objc_unique_protocol(struct objc_protocol2 *aProto) } } } + + +// Public functions: +Protocol *objc_getProtocol(const char *name) +{ + return (Protocol*)protocol_for_name(name); +} diff --git a/runtime.c b/runtime.c index 0fa10d8..ec9b214 100644 --- a/runtime.c +++ b/runtime.c @@ -391,7 +391,7 @@ IMP class_getMethodImplementation_stret(Class cls, SEL name) const char * class_getName(Class cls) { - return class_get_class_name(cls); + return cls->name; } Class class_getSuperclass(Class cls) @@ -826,14 +826,6 @@ static id objectNew(id cls) return newIMP((id)cls, newSel); } -Protocol *objc_getProtocol(const char *name) -{ - // Protocols are not centrally registered in the GNU runtime. - Protocol *protocol = (Protocol*)(objectNew(objc_getClass("Protocol"))); - protocol->protocol_name = (char*)name; - return protocol; -} - BOOL protocol_conformsToProtocol(Protocol *p, Protocol *other) { return NO;