mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
fix formatting errors
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34301 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ee3f0b14a0
commit
c471992651
1 changed files with 109 additions and 98 deletions
|
@ -116,9 +116,9 @@ class_getInstanceMethodNonrecursive(Class aClass, SEL aSelector)
|
||||||
Method_t method = &methods->method_list[i];
|
Method_t method = &methods->method_list[i];
|
||||||
|
|
||||||
if (method->method_name->sel_id == aSelector->sel_id)
|
if (method->method_name->sel_id == aSelector->sel_id)
|
||||||
{
|
{
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,8 +173,7 @@ class_addIvar(Class cls, const char *name,
|
||||||
ivarlist->ivar_count++;
|
ivarlist->ivar_count++;
|
||||||
// objc_ivar_list contains one ivar. Others follow it.
|
// objc_ivar_list contains one ivar. Others follow it.
|
||||||
cls->ivars = realloc(ivarlist, sizeof(struct objc_ivar_list)
|
cls->ivars = realloc(ivarlist, sizeof(struct objc_ivar_list)
|
||||||
+ (ivarlist->ivar_count -
|
+ (ivarlist->ivar_count - 1) * sizeof(struct objc_ivar));
|
||||||
1) * sizeof(struct objc_ivar));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ivar = &cls->ivars->ivar_list[cls->ivars->ivar_count - 1];
|
ivar = &cls->ivars->ivar_list[cls->ivars->ivar_count - 1];
|
||||||
|
@ -197,7 +196,7 @@ class_addMethod(Class cls, SEL name, IMP imp, const char *types)
|
||||||
struct objc_method_list *methods;
|
struct objc_method_list *methods;
|
||||||
|
|
||||||
for (methods = cls->methods; methods != NULL;
|
for (methods = cls->methods; methods != NULL;
|
||||||
methods = methods->method_next)
|
methods = methods->method_next)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -715,7 +714,7 @@ method_exchangeImplementations(Method m1, Method m2)
|
||||||
|
|
||||||
void
|
void
|
||||||
method_getArgumentType(Method method,
|
method_getArgumentType(Method method,
|
||||||
unsigned int index, char *dst, size_t dst_len)
|
unsigned int index, char *dst, size_t dst_len)
|
||||||
{
|
{
|
||||||
const char *types;
|
const char *types;
|
||||||
size_t length;
|
size_t length;
|
||||||
|
@ -1182,62 +1181,72 @@ objc_getProtocol(const char *name)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
Protocol **objc_copyProtocolList(unsigned int *count)
|
Protocol **
|
||||||
|
objc_copyProtocolList(unsigned int *count)
|
||||||
{
|
{
|
||||||
*count = 0;
|
*count = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL protocol_conformsToProtocol(Protocol *p1, Protocol *p2)
|
BOOL
|
||||||
|
protocol_conformsToProtocol(Protocol *p1, Protocol *p2)
|
||||||
{
|
{
|
||||||
struct objc_protocol_list *list = p1->protocol_list;
|
struct objc_protocol_list *list = p1->protocol_list;
|
||||||
// A protocol trivially conforms to itself
|
|
||||||
if (strcmp(p1->protocol_name, p2->protocol_name) == 0) { return YES; }
|
|
||||||
|
|
||||||
for (list = p1->protocol_list ; list != NULL ; list = list->next)
|
// A protocol trivially conforms to itself
|
||||||
|
if (strcmp(p1->protocol_name, p2->protocol_name) == 0)
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (list = p1->protocol_list; list != NULL; list = list->next)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < list->count; i++)
|
||||||
{
|
{
|
||||||
int i;
|
if (strcmp(list->list[i]->protocol_name, p2->protocol_name) == 0)
|
||||||
for (i=0 ; i<list->count ; i++)
|
{
|
||||||
{
|
return YES;
|
||||||
if (strcmp(list->list[i]->protocol_name, p2->protocol_name) == 0)
|
}
|
||||||
{
|
if (protocol_conformsToProtocol((Protocol*)list->list[i], p2))
|
||||||
return YES;
|
{
|
||||||
}
|
return YES;
|
||||||
if (protocol_conformsToProtocol((Protocol*)list->list[i], p2))
|
}
|
||||||
{
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return NO;
|
}
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL class_conformsToProtocol(Class cls, Protocol *protocol)
|
BOOL
|
||||||
|
class_conformsToProtocol(Class cls, Protocol *protocol)
|
||||||
{
|
{
|
||||||
struct objc_protocol_list *protocols;
|
struct objc_protocol_list *protocols;
|
||||||
|
|
||||||
while (cls)
|
while (cls)
|
||||||
|
{
|
||||||
|
for (protocols = cls->protocols;
|
||||||
|
protocols != NULL; protocols = protocols->next)
|
||||||
{
|
{
|
||||||
for (protocols = cls->protocols;
|
int i;
|
||||||
protocols != NULL ; protocols = protocols->next)
|
|
||||||
|
for (i = 0; i < protocols->count; i++)
|
||||||
|
{
|
||||||
|
Protocol *p1 = (Protocol*)protocols->list[i];
|
||||||
|
|
||||||
|
if (strcmp(p1->protocol_name, protocol->protocol_name) == 0)
|
||||||
{
|
{
|
||||||
int i;
|
return YES;
|
||||||
for (i=0 ; i<protocols->count ; i++)
|
|
||||||
{
|
|
||||||
Protocol *p1 = (Protocol*)protocols->list[i];
|
|
||||||
if (strcmp(p1->protocol_name, protocol->protocol_name) == 0)
|
|
||||||
{
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
if (protocol_conformsToProtocol(p1, protocol))
|
|
||||||
{
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
cls = cls ->super_class;
|
if (protocol_conformsToProtocol(p1, protocol))
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NO;
|
cls = cls->super_class;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct objc_method_description_list {
|
struct objc_method_description_list {
|
||||||
|
@ -1246,75 +1255,77 @@ struct objc_method_description_list {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct objc_method_description *
|
struct objc_method_description *
|
||||||
protocol_copyMethodDescriptionList(Protocol * p,
|
protocol_copyMethodDescriptionList(Protocol *p,
|
||||||
BOOL isRequiredMethod,
|
BOOL isRequiredMethod,
|
||||||
BOOL isInstanceMethod, unsigned int *count)
|
BOOL isInstanceMethod, unsigned int *count)
|
||||||
{
|
{
|
||||||
struct objc_method_description *output = NULL;
|
struct objc_method_description *output = NULL;
|
||||||
unsigned int outputCount = 0;
|
unsigned int outputCount = 0;
|
||||||
struct objc_method_description_list *methods;
|
struct objc_method_description_list *methods;
|
||||||
|
|
||||||
if (isInstanceMethod)
|
if (isInstanceMethod)
|
||||||
|
{
|
||||||
|
methods = p->instance_methods;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
methods = p->class_methods;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (methods != NULL)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
outputCount = methods->count;
|
||||||
|
output = malloc(outputCount * sizeof(struct objc_method_description));
|
||||||
|
|
||||||
|
for (i = 0; i < methods->count; i++)
|
||||||
{
|
{
|
||||||
methods = p->instance_methods;
|
output[i] = methods->list[i];
|
||||||
}
|
// HACK: the name field of the objc_method_description struct
|
||||||
else
|
// is supposed to be a selector, but testing reveals it is a string
|
||||||
{
|
output[i].name = sel_registerName((const char *) output[i].name);
|
||||||
methods = p->class_methods;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*count = outputCount;
|
||||||
if (methods != NULL)
|
return output;
|
||||||
{
|
|
||||||
int i;
|
|
||||||
outputCount = methods->count;
|
|
||||||
output = malloc(outputCount * sizeof(struct objc_method_description));
|
|
||||||
|
|
||||||
for (i=0 ; i<methods->count; i++)
|
|
||||||
{
|
|
||||||
output[i] = methods->list[i];
|
|
||||||
// HACK: the name field of the objc_method_description struct
|
|
||||||
// is supposed to be a selector, but testing reveals it is a string
|
|
||||||
output[i].name = sel_registerName((const char *) output[i].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*count = outputCount;
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Protocol **
|
Protocol **
|
||||||
protocol_copyProtocolList(Protocol * p, unsigned int *count)
|
protocol_copyProtocolList(Protocol * p, unsigned int *count)
|
||||||
{
|
{
|
||||||
Protocol **output = NULL;
|
Protocol **output = NULL;
|
||||||
unsigned int outputCount = 0;
|
unsigned int outputCount = 0;
|
||||||
struct objc_protocol_list *list;
|
struct objc_protocol_list *list;
|
||||||
|
|
||||||
for (list = p->protocol_list ; list != NULL ; list = list->next)
|
for (list = p->protocol_list; list != NULL; list = list->next)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < list->count; i++)
|
||||||
{
|
{
|
||||||
int i;
|
outputCount++;
|
||||||
for (i=0 ; i<list->count ; i++)
|
|
||||||
{
|
|
||||||
outputCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (outputCount > 0)
|
if (outputCount > 0)
|
||||||
|
{
|
||||||
|
output = malloc(outputCount * sizeof(Protocol *));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (list = p->protocol_list; list != NULL; list = list->next)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < list->count; i++)
|
||||||
{
|
{
|
||||||
output = malloc(outputCount * sizeof(Protocol *));
|
output[i] = (Protocol*)list->list[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (list = p->protocol_list ; list != NULL ; list = list->next)
|
*count = outputCount;
|
||||||
{
|
return output;
|
||||||
int i;
|
|
||||||
for (i=0 ; i<list->count ; i++)
|
|
||||||
{
|
|
||||||
output[i] = (Protocol*)list->list[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*count = outputCount;
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue