rewrite GSObjCMethodNames

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29799 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-02-28 13:07:28 +00:00
parent bbc0ddd60f
commit 7cd08f07f5

View file

@ -263,7 +263,6 @@ GSObjCMethodNames(id obj)
NSMutableSet *set; NSMutableSet *set;
NSArray *array; NSArray *array;
Class class; Class class;
GSMethodList methods;
if (obj == nil) if (obj == nil)
{ {
@ -275,33 +274,24 @@ GSObjCMethodNames(id obj)
*/ */
set = [[NSMutableSet alloc] initWithCapacity: 32]; set = [[NSMutableSet alloc] initWithCapacity: 32];
class = GSObjCClass(obj); class = object_getClass(obj);
while (class != nil) while (class != Nil)
{ {
void *iterator = 0; unsigned count;
Method *meth = class_copyMethodList(class, &count);
while ((methods = class_nextMethodList(class, &iterator))) while (count-- > 0)
{ {
int i; NSString *name;
for (i = 0; i < methods->method_count; i++) name = [[NSString alloc] initWithFormat: @"%s",
{ method_getName(meth[count])];
GSMethod method = &methods->method_list[i]; [set addObject: name];
[name release];
if (method->method_name != 0)
{
NSString *name;
const char *cName;
cName = GSNameFromSelector(method->method_name);
name = [[NSString alloc] initWithUTF8String: cName];
[set addObject: name];
RELEASE(name);
}
}
} }
class = class->super_class; free(meth);
class = class_getSuperclass(class);
} }
array = [set allObjects]; array = [set allObjects];
@ -327,7 +317,7 @@ GSObjCVariableNames(id obj)
return nil; return nil;
} }
array = [NSMutableArray arrayWithCapacity: 16]; array = [NSMutableArray arrayWithCapacity: 16];
class = GSObjCClass(obj); class = object_getClass(obj);
while (class != nil) while (class != nil)
{ {
ivars = class->ivars; ivars = class->ivars;