bc: shorten bc_program_addFunc()
function old new delta bc_func_init - 50 +50 bc_program_addFunc 201 138 -63 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 50/-63) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
408b7d45f6
commit
eaa3b00002
@ -3624,13 +3624,11 @@ static size_t bc_program_addFunc(char *name)
|
|||||||
idx = entry_ptr->idx;
|
idx = entry_ptr->idx;
|
||||||
|
|
||||||
if (!inserted) {
|
if (!inserted) {
|
||||||
|
// There is already a function with this name.
|
||||||
|
// It'll be redefined now, clear old definition.
|
||||||
BcFunc *func = bc_program_func(entry_ptr->idx);
|
BcFunc *func = bc_program_func(entry_ptr->idx);
|
||||||
|
bc_func_free(func);
|
||||||
// We need to reset these, so the function can be repopulated.
|
bc_func_init(func);
|
||||||
func->nparams = 0;
|
|
||||||
bc_vec_pop_all(&func->autos);
|
|
||||||
bc_vec_pop_all(&func->code);
|
|
||||||
bc_vec_pop_all(&func->labels);
|
|
||||||
} else {
|
} else {
|
||||||
bc_func_init(&f);
|
bc_func_init(&f);
|
||||||
bc_vec_push(&G.prog.fns, &f);
|
bc_vec_push(&G.prog.fns, &f);
|
||||||
|
Loading…
Reference in New Issue
Block a user