From e92f7530916b3a8e11bea513caf7c03418a03a5f Mon Sep 17 00:00:00 2001 From: qmathe Date: Fri, 8 Jan 2010 23:59:24 +0000 Subject: [PATCH] Restored objc_getProtocol() which seems to have been accidentally removed. Fixed class_replaceMethod() to update the dispatch table. --- runtime.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/runtime.c b/runtime.c index 55cdd23..0fa10d8 100644 --- a/runtime.c +++ b/runtime.c @@ -425,6 +425,12 @@ IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types) } IMP old = (IMP)method->method_imp; method->method_imp = (objc_imp_gnu)imp; + + if (CLS_ISRESOLV(cls)) + { + __objc_update_dispatch_table_for_class(cls); + } + return old; } @@ -820,6 +826,14 @@ 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;