fix several silly mistakes

This commit is contained in:
Bill Currie 2002-06-06 21:51:47 +00:00
parent 4314885b5b
commit 8aa98c0d20
3 changed files with 8 additions and 5 deletions

View file

@ -58,7 +58,8 @@ typedef struct {
int num_statements; int num_statements;
int statements_size; int statements_size;
struct function_s *function_list; struct function_s *func_head;
struct function_s **func_tail;
dfunction_t *functions; dfunction_t *functions;
int num_functions; int num_functions;

View file

@ -168,8 +168,8 @@ new_function (void)
function_t *f; function_t *f;
f = calloc (1, sizeof (function_t)); f = calloc (1, sizeof (function_t));
f->next = pr.function_list; *pr.func_tail = f;
pr.function_list = f; pr.func_tail = &f->next;
return f; return f;
} }

View file

@ -192,7 +192,7 @@ WriteData (int crc)
progs.ofs_functions = ftell (h); progs.ofs_functions = ftell (h);
progs.numfunctions = pr.num_functions; progs.numfunctions = pr.num_functions;
pr.functions = malloc (pr.num_functions * sizeof (dfunction_t)); pr.functions = malloc (pr.num_functions * sizeof (dfunction_t));
for (i = 0, f = pr.function_list; f; i++, f = f->next) { for (i = 1, f = pr.func_head; f; i++, f = f->next) {
pr.functions[i].first_statement = pr.functions[i].first_statement =
LittleLong (f->dfunc->first_statement); LittleLong (f->dfunc->first_statement);
pr.functions[i].parm_start = LittleLong (f->dfunc->parm_start); pr.functions[i].parm_start = LittleLong (f->dfunc->parm_start);
@ -200,6 +200,7 @@ WriteData (int crc)
pr.functions[i].s_file = LittleLong (f->dfunc->s_file); pr.functions[i].s_file = LittleLong (f->dfunc->s_file);
pr.functions[i].numparms = LittleLong (f->dfunc->numparms); pr.functions[i].numparms = LittleLong (f->dfunc->numparms);
pr.functions[i].locals = LittleLong (f->dfunc->locals); pr.functions[i].locals = LittleLong (f->dfunc->locals);
memcpy (pr.functions[i].parm_size, f->dfunc->parm_size, MAX_PARMS);
} }
SafeWrite (h, pr.functions, pr.num_functions * sizeof (dfunction_t)); SafeWrite (h, pr.functions, pr.num_functions * sizeof (dfunction_t));
} }
@ -305,6 +306,7 @@ PR_BeginCompilation (void)
{ {
pr.num_globals = RESERVED_OFS; pr.num_globals = RESERVED_OFS;
pr.def_tail = &pr.def_head; pr.def_tail = &pr.def_head;
pr.func_tail = &pr.func_head;
pr_error_count = 0; pr_error_count = 0;
} }
@ -375,7 +377,7 @@ qboolean PR_FinishCompilation (void)
PR_RelocateRefs (def); PR_RelocateRefs (def);
} }
for (f = pr.function_list; f; f = f->next) { for (f = pr.func_head; f; f = f->next) {
if (f->builtin) if (f->builtin)
continue; continue;
if (f->def->locals > num_localdefs) { if (f->def->locals > num_localdefs) {