aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-19 20:05:50 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-19 20:05:50 +0100
commiteaa3b00002e23e2ecccade3e06790dd524e7b662 (patch)
tree9cc10f93ae359246d072f43a10476cabebdfe6e1
parent408b7d45f638dd163fc38d12d08ef94403412c90 (diff)
downloadbusybox-w32-eaa3b00002e23e2ecccade3e06790dd524e7b662.tar.gz
busybox-w32-eaa3b00002e23e2ecccade3e06790dd524e7b662.tar.bz2
busybox-w32-eaa3b00002e23e2ecccade3e06790dd524e7b662.zip
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>
-rw-r--r--miscutils/bc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 7fcf00aa9..c59d5a2b5 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -3624,13 +3624,11 @@ static size_t bc_program_addFunc(char *name)
3624 idx = entry_ptr->idx; 3624 idx = entry_ptr->idx;
3625 3625
3626 if (!inserted) { 3626 if (!inserted) {
3627 // There is already a function with this name.
3628 // It'll be redefined now, clear old definition.
3627 BcFunc *func = bc_program_func(entry_ptr->idx); 3629 BcFunc *func = bc_program_func(entry_ptr->idx);
3628 3630 bc_func_free(func);
3629 // We need to reset these, so the function can be repopulated. 3631 bc_func_init(func);
3630 func->nparams = 0;
3631 bc_vec_pop_all(&func->autos);
3632 bc_vec_pop_all(&func->code);
3633 bc_vec_pop_all(&func->labels);
3634 } else { 3632 } else {
3635 bc_func_init(&f); 3633 bc_func_init(&f);
3636 bc_vec_push(&G.prog.fns, &f); 3634 bc_vec_push(&G.prog.fns, &f);