Improve reliability of methodSignatureForSelector.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9310 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-03-07 21:21:10 +00:00
parent aab21f70fc
commit 097642b0d7
3 changed files with 18 additions and 17 deletions

View file

@ -1,3 +1,8 @@
2001-03-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSObject.m: ([methodSignatureForSelector:]) reliability
fix suggested by Manuel Guesdon <ml@sbuilders.com>
2001-03-06 Adam Fedor <fedor@gnu.org> 2001-03-06 Adam Fedor <fedor@gnu.org>
* Source/libgnustep-base.def: Regenerate. * Source/libgnustep-base.def: Regenerate.

View file

@ -113,6 +113,9 @@
<sel>instanceMethodSignatureForSelector:</sel> <sel>instanceMethodSignatureForSelector:</sel>
<arg type="SEL">aSelector</arg> <arg type="SEL">aSelector</arg>
<desc> <desc>
Returns a method signature object representing the
method implemented for instsances of this class which
corresponds to the supplied selector.
</desc> </desc>
</method> </method>
<method type="BOOL" factory="yes"> <method type="BOOL" factory="yes">
@ -293,6 +296,9 @@
<sel>methodSignatureForSelector:</sel> <sel>methodSignatureForSelector:</sel>
<arg type="SEL">aSelector</arg> <arg type="SEL">aSelector</arg>
<desc> <desc>
Returns a method signature object representing the
method implemented in this object which corresponds to
the supplied selector.
</desc> </desc>
</method> </method>
<method type="id"> <method type="id">

View file

@ -754,26 +754,16 @@ static BOOL deallocNotifications = NO;
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector - (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
{ {
const char *types; const char *types;
struct objc_method *mth;
#ifdef __FreeBSD__ mth = (GSObjCIsInstance(self)
types = NULL; ? class_get_instance_method(GSObjCClass(self), aSelector)
#else : class_get_class_method(GSObjCClass(self), aSelector));
types = aSelector->sel_types; if (mth == 0)
#endif
if (types == 0)
{ {
struct objc_method *mth; return nil;
mth = (GSObjCIsInstance(self)
? class_get_instance_method(GSObjCClass(self), aSelector)
: class_get_class_method(GSObjCClass(self), aSelector));
if (mth == 0)
{
return nil;
}
types = mth->method_types;
} }
types = mth->method_types;
return [NSMethodSignature signatureWithObjCTypes: types]; return [NSMethodSignature signatureWithObjCTypes: types];
} }