inpcom.c, abstraction, free_function()

This commit is contained in:
rlar
2013-05-18 23:24:13 +02:00
parent 5892a65b23
commit 7e84a75ff7
+17 -8
View File
@@ -2750,6 +2750,19 @@ find_function(char *name)
} }
static void
free_function(struct function *fcn)
{
int i;
tfree(fcn->name);
tfree(fcn->macro);
for (i = 0; i < fcn->num_parameters; i++)
tfree(fcn->params[i]);
}
static void static void
inp_get_func_from_line(char *line) inp_get_func_from_line(char *line)
{ {
@@ -3059,7 +3072,7 @@ static void
inp_expand_macros_in_deck(struct line *deck) inp_expand_macros_in_deck(struct line *deck)
{ {
struct line *c = deck; struct line *c = deck;
int prev_num_functions = 0, i, j; int prev_num_functions = 0, i;
while (c != NULL) { while (c != NULL) {
if (*c->li_line == '*') { if (*c->li_line == '*') {
@@ -3074,13 +3087,9 @@ inp_expand_macros_in_deck(struct line *deck)
} }
if (ciprefix(".ends", c->li_line)) { if (ciprefix(".ends", c->li_line)) {
if (prev_num_functions != num_functions) { if (prev_num_functions != num_functions) {
for (i = prev_num_functions; i < num_functions; i++) { for (i = prev_num_functions; i < num_functions; i++)
tfree(functions[i].name); free_function(& functions[i]);
tfree(functions[i].macro); num_functions = prev_num_functions;
for (j = 0; j < functions[i].num_parameters; j++)
tfree(functions[i].params[j]);
num_functions = prev_num_functions;
}
} }
} }