Fix style issues in sctracker.c.

This commit is contained in:
David Anderson 2014-08-19 22:17:10 -07:00
parent 5cf2475e2e
commit 385d3708a3

View File

@ -18,13 +18,10 @@ structarg_t *pstructs_getarg(pstruct_t *pstruct, const char *member)
{
int i;
for (i=0; i<pstruct->argcount; i++)
{
for (i=0; i<pstruct->argcount; i++) {
if (strcmp(pstruct->args[i]->name, member) == 0)
{
return pstruct->args[i];
}
}
return NULL;
}
@ -36,8 +33,7 @@ pstruct_t *pstructs_add(const char *name)
memset(p, 0, sizeof(pstruct_t));
strcpy(p->name, name);
if (!firststruct)
{
if (!firststruct) {
firststruct = p;
laststruct = p;
} else {
@ -53,12 +49,9 @@ void pstructs_free()
pstruct_t *p, *next;
p = firststruct;
while (p)
{
while (p) {
while (p->argcount--)
{
free(p->args[p->argcount]);
}
free(p->args);
next = p->next;
free(p);
@ -72,12 +65,9 @@ pstruct_t *pstructs_find(const char *name)
{
pstruct_t *p = firststruct;
while (p)
{
while (p) {
if (strcmp(p->name, name) == 0)
{
return p;
}
p = p->next;
}
@ -89,10 +79,8 @@ structarg_t *pstructs_addarg(pstruct_t *pstruct, const structarg_t *arg)
structarg_t *newarg;
int i;
for (i=0; i<pstruct->argcount; i++)
{
if (strcmp(pstruct->args[i]->name, arg->name) == 0)
{
for (i=0; i<pstruct->argcount; i++) {
if (strcmp(pstruct->args[i]->name, arg->name) == 0) {
/* Don't allow dup names */
return NULL;
}
@ -102,8 +90,7 @@ structarg_t *pstructs_addarg(pstruct_t *pstruct, const structarg_t *arg)
memcpy(newarg, arg, sizeof(structarg_t));
if (pstruct->argcount == 0)
{
if (pstruct->argcount == 0) {
pstruct->args = (structarg_t **)malloc(sizeof(structarg_t *) * 1);
} else {
pstruct->args = (structarg_t **)realloc(
@ -123,12 +110,10 @@ void funcenums_free()
funcenum_t *e, *next;
e = firstenum;
while (e)
{
while (e) {
functag_t *tag, *nexttag;
tag = e->first;
while (tag)
{
while (tag) {
nexttag = tag->next;
free(tag);
tag = nexttag;
@ -146,12 +131,9 @@ funcenum_t *funcenums_find_byval(int value)
{
funcenum_t *e = firstenum;
while (e)
{
while (e) {
if (e->value == value)
{
return e;
}
e = e->next;
}
@ -164,8 +146,7 @@ funcenum_t *funcenums_add(const char *name)
memset(e, 0, sizeof(funcenum_t));
if (firstenum == NULL)
{
if (firstenum == NULL) {
firstenum = e;
lastenum = e;
} else {
@ -187,8 +168,7 @@ functag_t *functags_add(funcenum_t *en, functag_t *src)
t->next = NULL;
if (en->first == NULL)
{
if (en->first == NULL) {
en->first = t;
en->last = t;
} else {
@ -318,16 +298,13 @@ void _heap_freeusage(memuse_list_t *heap, int dofree)
{
memuse_t *cur=heap->head;
memuse_t *tmp;
while (cur)
{
if (cur->type == MEMUSE_STATIC)
{
while (cur) {
if (cur->type == MEMUSE_STATIC) {
modheap((-1)*cur->size*sizeof(cell));
} else {
modheap_i();
}
if (dofree)
{
if (dofree) {
tmp=cur->prev;
free(cur);
cur=tmp;
@ -336,9 +313,7 @@ void _heap_freeusage(memuse_list_t *heap, int dofree)
}
}
if (dofree)
{
heap->head=NULL;
}
}
void _stack_genusage(memuse_list_t *stack, int dofree)