aboutsummaryrefslogtreecommitdiff
path: root/miscutils/bc.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-01-04 00:34:52 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2019-01-04 00:35:31 +0100
commit377cc97b193204595d00a0b8d0d2b52c2d596586 (patch)
treebf9bad79188a49165f4957020255a2bf3d682719 /miscutils/bc.c
parent02c3d7a1c9ea82a8babf49f8a5305ec942b56dfa (diff)
downloadbusybox-w32-377cc97b193204595d00a0b8d0d2b52c2d596586.tar.gz
busybox-w32-377cc97b193204595d00a0b8d0d2b52c2d596586.tar.bz2
busybox-w32-377cc97b193204595d00a0b8d0d2b52c2d596586.zip
bc: eliminate struct BcInstPtr::results_len_before_call, it is redundant
function old new delta zbc_program_call 332 318 -14 zxc_program_exec 4147 4087 -60 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-74) Total: -74 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/bc.c')
-rw-r--r--miscutils/bc.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 0bbd53a65..ec3560c2b 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -378,7 +378,6 @@ typedef struct BcResult {
378typedef struct BcInstPtr { 378typedef struct BcInstPtr {
379 size_t func; 379 size_t func;
380 size_t inst_idx; 380 size_t inst_idx;
381 IF_BC(size_t results_len_before_call;)
382} BcInstPtr; 381} BcInstPtr;
383 382
384typedef enum BcLexType { 383typedef enum BcLexType {
@@ -5311,7 +5310,6 @@ static BC_STATUS zxc_program_read(void)
5311 5310
5312 ip.func = BC_PROG_READ; 5311 ip.func = BC_PROG_READ;
5313 ip.inst_idx = 0; 5312 ip.inst_idx = 0;
5314 IF_BC(ip.results_len_before_call = G.prog.results.len;)
5315 bc_vec_push(&G.prog.exestack, &ip); 5313 bc_vec_push(&G.prog.exestack, &ip);
5316 5314
5317 exec_err: 5315 exec_err:
@@ -5971,7 +5969,6 @@ static BC_STATUS zbc_program_call(char *code, size_t *idx)
5971 RETURN_STATUS(bc_error_fmt("function has %u parameters, but called with %u", func->nparams, nparams)); 5969 RETURN_STATUS(bc_error_fmt("function has %u parameters, but called with %u", func->nparams, nparams));
5972 } 5970 }
5973 ip.inst_idx = 0; 5971 ip.inst_idx = 0;
5974 ip.results_len_before_call = G.prog.results.len - nparams;
5975 5972
5976 for (i = 0; i < nparams; ++i) { 5973 for (i = 0; i < nparams; ++i) {
5977 BcResult *arg; 5974 BcResult *arg;
@@ -6019,11 +6016,6 @@ static BC_STATUS zbc_program_return(char inst)
6019 size_t i; 6016 size_t i;
6020 BcInstPtr *ip = bc_vec_top(&G.prog.exestack); 6017 BcInstPtr *ip = bc_vec_top(&G.prog.exestack);
6021 6018
6022#if SANITY_CHECKS
6023 if (!STACK_HAS_EQUAL_OR_MORE_THAN(&G.prog.results, ip->results_len_before_call + (inst == XC_INST_RET)))
6024 RETURN_STATUS(bc_error_stack_has_too_few_elements());
6025#endif
6026
6027 if (inst == XC_INST_RET) { 6019 if (inst == XC_INST_RET) {
6028 BcStatus s; 6020 BcStatus s;
6029 BcNum *num; 6021 BcNum *num;
@@ -6033,6 +6025,7 @@ static BC_STATUS zbc_program_return(char inst)
6033 if (s) RETURN_STATUS(s); 6025 if (s) RETURN_STATUS(s);
6034 bc_num_init(&res.d.n, num->len); 6026 bc_num_init(&res.d.n, num->len);
6035 bc_num_copy(&res.d.n, num); 6027 bc_num_copy(&res.d.n, num);
6028 bc_vec_pop(&G.prog.results);
6036 //} else if (f->void_func) { 6029 //} else if (f->void_func) {
6037 //prepare "void" result in res 6030 //prepare "void" result in res
6038 } else { 6031 } else {
@@ -6040,8 +6033,6 @@ static BC_STATUS zbc_program_return(char inst)
6040 //bc_num_zero(&res.d.n); - already is 6033 //bc_num_zero(&res.d.n); - already is
6041 } 6034 }
6042 res.t = XC_RESULT_TEMP; 6035 res.t = XC_RESULT_TEMP;
6043
6044 bc_vec_npop(&G.prog.results, G.prog.results.len - ip->results_len_before_call);
6045 bc_vec_push(&G.prog.results, &res); 6036 bc_vec_push(&G.prog.results, &res);
6046 6037
6047 bc_vec_pop(&G.prog.exestack); 6038 bc_vec_pop(&G.prog.exestack);