From 4b9d3247259d083b2813cb243664ade5199961b8 Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 9 Mar 2011 12:01:04 +0000 Subject: [PATCH] tweak git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32516 72102866-910b-0410-8b05-ffd578937521 --- Source/NSObject.m | 53 +++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/Source/NSObject.m b/Source/NSObject.m index c3a0de49e..1015541fd 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -1374,9 +1374,10 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); format: @"%@ null selector given", NSStringFromSelector(_cmd)]; mth = GSGetMethod(self, aSelector, YES, YES); - if (mth == 0) + if (0 == mth) return nil; - return [NSMethodSignature signatureWithObjCTypes: method_getTypeEncoding(mth)]; + return [NSMethodSignature + signatureWithObjCTypes: method_getTypeEncoding(mth)]; } /** @@ -1386,27 +1387,28 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); */ - (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector { - const char *types = NULL; - Class c; - unsigned int count; - Protocol **protocols; + const char *types = NULL; + Class c; + unsigned int count; + Protocol **protocols; if (0 == aSelector) { return nil; } - c = (GSObjCIsInstance(self) ? object_getClass(self) : (Class)self); + c = object_getClass(self); - // Do a fast lookup to see if the method is implemented at all. If it isn't, - // we can give up without doing a very expensive linear search through every - // method list in the class hierarchy. - if (!class_respondsToSelector(object_getClass(self), aSelector)) + /* Do a fast lookup to see if the method is implemented at all. If it isn't, + * we can give up without doing a very expensive linear search through every + * method list in the class hierarchy. + */ + if (!class_respondsToSelector(c, aSelector)) { return nil; // Method not implemented } - /* - * If there are protocols that this class conforms to, + + /* If there are protocols that this class conforms to, * the method may be listed in a protocol with more * detailed type information than in the class itself * and we must therefore use the information from the @@ -1415,24 +1417,28 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); * used by the Distributed Objects system, which the * runtime does not maintain in classes. */ - protocols = class_copyProtocolList(isa, &count); + protocols = class_copyProtocolList(c, &count); if (NULL != protocols) { struct objc_method_description mth; int i; - for (i=0 ; itypes; #else struct objc_method *mth = @@ -2062,9 +2068,10 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); format: @"%@ null selector given", NSStringFromSelector(_cmd)]; mth = GSGetMethod(self, aSelector, YES, YES); - if (mth == 0) + if (0 == mth) return nil; - return [NSMethodSignature signatureWithObjCTypes: method_getTypeEncoding(mth)]; + return [NSMethodSignature + signatureWithObjCTypes: method_getTypeEncoding(mth)]; } - (IMP) methodFor: (SEL)aSel @@ -2237,7 +2244,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak)); @implementation NSZombie - (Class) class { - return (Class)isa; + return object_getClass(self); } - (Class) originalClass {