diff options
author | Denys Vlasenko | 2018-12-18 17:14:34 +0100 |
---|---|---|
committer | Denys Vlasenko | 2018-12-18 17:14:34 +0100 |
commit | 7b30bc0222fa5f4e539a36a15ceb7b6e413cafd2 (patch) | |
tree | 00ca5c12625e968dd19ba1a643c470eea4e5c979 | |
parent | d340143247f9b3aff486a2a6a4dc1e11ab8c8f86 (diff) | |
download | busybox-7b30bc0222fa5f4e539a36a15ceb7b6e413cafd2.zip busybox-7b30bc0222fa5f4e539a36a15ceb7b6e413cafd2.tar.gz |
bc: shrink bc_program_pushVar()
function old new delta
bc_program_pushVar 203 198 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/bc.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 566808e..40bb299 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -5718,31 +5718,25 @@ static BC_STATUS bc_program_pushVar(char *code, size_t *bgn, r.d.id.name = name; #if ENABLE_DC - { + if (pop || copy) { BcVec *v = bc_program_search(name, true); BcNum *num = bc_vec_top(v); - if (pop || copy) { - if (!BC_PROG_STACK(v, 2 - copy)) { - free(name); - RETURN_STATUS(bc_error_stack_has_too_few_elements()); - } - - free(name); - name = NULL; - - if (!BC_PROG_STR(num)) { - r.t = BC_RESULT_TEMP; - - bc_num_init_DEF_SIZE(&r.d.n); - bc_num_copy(&r.d.n, num); - } else { - r.t = BC_RESULT_STR; - r.d.id.idx = num->rdx; - } + free(name); + if (!BC_PROG_STACK(v, 2 - copy)) { + RETURN_STATUS(bc_error_stack_has_too_few_elements()); + } - if (!copy) bc_vec_pop(v); + if (!BC_PROG_STR(num)) { + r.t = BC_RESULT_TEMP; + bc_num_init_DEF_SIZE(&r.d.n); + bc_num_copy(&r.d.n, num); + } else { + r.t = BC_RESULT_STR; + r.d.id.idx = num->rdx; } + + if (!copy) bc_vec_pop(v); } #endif // ENABLE_DC |