diff --git a/ChangeLog b/ChangeLog index 5058979cf..e4b27a7c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-02-20 Richard Frith-Macdonald + + * Source/NSPortCoder.m: + * Source/common.h: + * Source/NSObject.m: + * Source/NSAutoreleasePool.m: + * Source/NSProxy.m: + * Source/NSSerializer.m: + Replace all calls to get_imp() with the new runtime API + class_getMethodImplementation(). + 2011-02-20 Richard Frith-Macdonald * Source/NSDistributedNotificationCenter.m: diff --git a/Source/NSAutoreleasePool.m b/Source/NSAutoreleasePool.m index a4eb1b41f..6db79bc16 100644 --- a/Source/NSAutoreleasePool.m +++ b/Source/NSAutoreleasePool.m @@ -433,13 +433,14 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv) { /* If anObject was an instance, c is it's class. * If anObject was a class, c is its metaclass. - * Either way, get_imp() should get the appropriate pointer. + * Either way, we should get the appropriate pointer. * If anObject is a proxy to something, * the +instanceMethodForSelector: and -methodForSelector: - * methods may not exist, but get_imp() will return the + * methods may not exist, but this will return the * address of the forwarding method if necessary. */ - imps[hash] = get_imp(c, @selector(release)); + imps[hash] + = class_getMethodImplementation(c, @selector(release)); classes[hash] = c; } (imps[hash])(anObject, @selector(release)); diff --git a/Source/NSObject.m b/Source/NSObject.m index e10511001..dc5876e00 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -586,7 +586,7 @@ GSFinalize(void* object, void* data) static BOOL GSIsFinalizable(Class c) { - if (get_imp(c, finalize_sel) != finalize_imp) + if (class_getMethodImplementation(c, finalize_sel) != finalize_imp) return YES; return NO; } @@ -927,7 +927,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); #if GS_WITH_GC finalize_sel = @selector(finalize); - finalize_imp = get_imp(self, finalize_sel); + finalize_imp = class_getMethodImplementation(self, finalize_sel); #endif #if (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__i386__) @@ -1376,9 +1376,10 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); [NSException raise: NSInvalidArgumentException format: @"%@ null selector given", NSStringFromSelector(_cmd)]; /* - * Since 'self' is an class, get_imp() will get the instance method. + * Since 'self' is an class, class_getMethodImplementation() will get + * the instance method. */ - return get_imp((Class)self, aSelector); + return class_getMethodImplementation((Class)self, aSelector); } /** @@ -1393,11 +1394,11 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); format: @"%@ null selector given", NSStringFromSelector(_cmd)]; /* * If 'self' is an instance, object_getClass() will get the class, - * and get_imp() will get the instance method. + * and class_getMethodImplementation() will get the instance method. * If 'self' is a class, object_getClass() will get the meta-class, - * and get_imp() will get the class method. + * and class_getMethodImplementation() will get the class method. */ - return get_imp(object_getClass(self), aSelector); + return class_getMethodImplementation(object_getClass(self), aSelector); } /** @@ -1767,7 +1768,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); [NSException raise: NSInvalidArgumentException format: @"%@ null selector given", NSStringFromSelector(_cmd)]; - msg = get_imp(object_getClass(self), aSelector); + msg = class_getMethodImplementation(object_getClass(self), aSelector); if (!msg) { [NSException raise: NSGenericException @@ -1792,7 +1793,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); [NSException raise: NSInvalidArgumentException format: @"%@ null selector given", NSStringFromSelector(_cmd)]; - msg = get_imp(object_getClass(self), aSelector); + msg = class_getMethodImplementation(object_getClass(self), aSelector); if (!msg) { [NSException raise: NSGenericException @@ -1820,7 +1821,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); [NSException raise: NSInvalidArgumentException format: @"%@ null selector given", NSStringFromSelector(_cmd)]; - msg = get_imp(object_getClass(self), aSelector); + msg = class_getMethodImplementation(object_getClass(self), aSelector); if (!msg) { [NSException raise: NSGenericException diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m index 33949523d..4e6f50935 100644 --- a/Source/NSPortCoder.m +++ b/Source/NSPortCoder.m @@ -2044,10 +2044,10 @@ static IMP _xRefImp; /* Serialize a crossref. */ { proxyClass = [NSDistantObject class]; /* - * use get_imp() because NSDistantObject doesn't implement - * methodForSelector: + * Use class_getMethodImplementation() because NSDistantObject + * doesn't implement methodForSelector: */ - proxyImp = get_imp(object_getClass((id)proxyClass), + proxyImp = class_getMethodImplementation(object_getClass((id)proxyClass), @selector(proxyWithLocal:connection:)); } diff --git a/Source/NSProxy.m b/Source/NSProxy.m index cd7617ff3..745272124 100644 --- a/Source/NSProxy.m +++ b/Source/NSProxy.m @@ -102,9 +102,10 @@ extern BOOL __objc_responds_to(id, SEL); [NSException raise: NSInvalidArgumentException format: @"%@ null selector given", NSStringFromSelector(_cmd)]; /* - * Since 'self' is an class, get_imp() will get the instance method. + * Since 'self' is an class, class_getMethodImplementation() will get + * the instance method. */ - return get_imp((Class)self, aSelector); + return class_getMethodImplementation((Class)self, aSelector); } /** @@ -137,7 +138,7 @@ extern BOOL __objc_responds_to(id, SEL); [NSException raise: NSInvalidArgumentException format: @"%@ null selector given", NSStringFromSelector(_cmd)]; - return get_imp(object_getClass((id)self), aSelector); + return class_getMethodImplementation(object_getClass((id)self), aSelector); } /** @@ -475,10 +476,10 @@ extern BOOL __objc_responds_to(id, SEL); { proxyClass = [NSDistantObject class]; /* - * use get_imp() because NSDistantObject doesn't implement - * methodForSelector: + * use class_getMethodImplementation() because NSDistantObject + * doesn't implement methodForSelector: */ - proxyImp = get_imp(object_getClass((id)proxyClass), + proxyImp = class_getMethodImplementation(object_getClass((id)proxyClass), @selector(proxyWithLocal:connection:)); } diff --git a/Source/NSSerializer.m b/Source/NSSerializer.m index 9c5c6d682..6feaac1e9 100644 --- a/Source/NSSerializer.m +++ b/Source/NSSerializer.m @@ -144,11 +144,16 @@ initSerializerInfo(_NSSerializerInfo* info, NSMutableData *d, BOOL u) c = object_getClass(d); info->data = d; - info->appImp = (void (*)(NSData*,SEL,const void*,unsigned))get_imp(c, appSel); - info->datImp = (void* (*)(NSMutableData*,SEL))get_imp(c, datSel); - info->lenImp = (unsigned int (*)(NSData*,SEL))get_imp(c, lenSel); - info->serImp = (void (*)(NSMutableData*,SEL,int))get_imp(c, serSel); - info->setImp = (void (*)(NSMutableData*,SEL,unsigned))get_imp(c, setSel); + info->appImp = (void (*)(NSData*,SEL,const void*,unsigned)) + class_getMethodImplementation(c, appSel); + info->datImp = (void* (*)(NSMutableData*,SEL)) + class_getMethodImplementation(c, datSel); + info->lenImp = (unsigned int (*)(NSData*,SEL)) + class_getMethodImplementation(c, lenSel); + info->serImp = (void (*)(NSMutableData*,SEL,int)) + class_getMethodImplementation(c, serSel); + info->setImp = (void (*)(NSMutableData*,SEL,unsigned)) + class_getMethodImplementation(c, setSel); info->shouldUnique = u; (*info->appImp)(d, appSel, &info->shouldUnique, 1); if (u) diff --git a/Source/common.h b/Source/common.h index 435f66c12..ec3bf1428 100644 --- a/Source/common.h +++ b/Source/common.h @@ -51,5 +51,3 @@ #import "Foundation/NSBundle.h" #import "GNUstepBase/NSBundle+GNUstepBase.h" -// Semi-private GNU[step] runtime function. -IMP get_imp(Class, SEL);