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