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:
rfm 2011-12-16 07:28:05 +00:00
parent ee3f0b14a0
commit c471992651

View file

@ -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];
@ -1182,22 +1181,29 @@ 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; int i;
for (i=0 ; i<list->count ; i++)
for (i = 0; i < list->count; i++)
{ {
if (strcmp(list->list[i]->protocol_name, p2->protocol_name) == 0) if (strcmp(list->list[i]->protocol_name, p2->protocol_name) == 0)
{ {
@ -1212,19 +1218,22 @@ BOOL protocol_conformsToProtocol(Protocol *p1, Protocol *p2)
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; for (protocols = cls->protocols;
protocols != NULL ; protocols = protocols->next) protocols != NULL; protocols = protocols->next)
{ {
int i; int i;
for (i=0 ; i<protocols->count ; i++)
for (i = 0; i < protocols->count; i++)
{ {
Protocol *p1 = (Protocol*)protocols->list[i]; Protocol *p1 = (Protocol*)protocols->list[i];
if (strcmp(p1->protocol_name, protocol->protocol_name) == 0) if (strcmp(p1->protocol_name, protocol->protocol_name) == 0)
{ {
return YES; return YES;
@ -1235,7 +1244,7 @@ BOOL class_conformsToProtocol(Class cls, Protocol *protocol)
} }
} }
} }
cls = cls ->super_class; cls = cls->super_class;
} }
return NO; return NO;
} }
@ -1246,7 +1255,7 @@ 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)
{ {
@ -1263,14 +1272,14 @@ protocol_copyMethodDescriptionList(Protocol * p,
methods = p->class_methods; methods = p->class_methods;
} }
if (methods != NULL) if (methods != NULL)
{ {
int i; int i;
outputCount = methods->count; outputCount = methods->count;
output = malloc(outputCount * sizeof(struct objc_method_description)); output = malloc(outputCount * sizeof(struct objc_method_description));
for (i=0 ; i<methods->count; i++) for (i = 0; i < methods->count; i++)
{ {
output[i] = methods->list[i]; output[i] = methods->list[i];
// HACK: the name field of the objc_method_description struct // HACK: the name field of the objc_method_description struct
@ -1290,10 +1299,11 @@ protocol_copyProtocolList(Protocol * p, unsigned int *count)
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; int i;
for (i=0 ; i<list->count ; i++)
for (i = 0; i < list->count; i++)
{ {
outputCount++; outputCount++;
} }
@ -1304,10 +1314,11 @@ protocol_copyProtocolList(Protocol * p, unsigned int *count)
output = malloc(outputCount * sizeof(Protocol *)); output = malloc(outputCount * sizeof(Protocol *));
} }
for (list = p->protocol_list ; list != NULL ; list = list->next) for (list = p->protocol_list; list != NULL; list = list->next)
{ {
int i; int i;
for (i=0 ; i<list->count ; i++)
for (i = 0; i < list->count; i++)
{ {
output[i] = (Protocol*)list->list[i]; output[i] = (Protocol*)list->list[i];
} }