aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-21 22:43:53 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-21 22:43:53 +0100
commit8287b1c869564ad90c0b8fac64551bfef4f6eee0 (patch)
tree99a077af7b40cc84b86e7defa97465096cfeb541 /miscutils
parente8e7bda63aeefb17b59718baca592246e24d04df (diff)
downloadbusybox-w32-8287b1c869564ad90c0b8fac64551bfef4f6eee0.tar.gz
busybox-w32-8287b1c869564ad90c0b8fac64551bfef4f6eee0.tar.bz2
busybox-w32-8287b1c869564ad90c0b8fac64551bfef4f6eee0.zip
bc: remove unnecessary initializations
function old new delta zdc_program_asciify 403 395 -8 zbc_program_print 691 683 -8 zbc_program_exec 4079 4068 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-27) Total: -27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/bc.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 58e3bcb52..cf620f8ec 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -5058,6 +5058,7 @@ static BcVec* bc_program_search(char *id, bool var)
5058 return bc_vec_item(v, ptr->idx); 5058 return bc_vec_item(v, ptr->idx);
5059} 5059}
5060 5060
5061// 'num' need not be initialized on entry
5061static BC_STATUS zbc_program_num(BcResult *r, BcNum **num, bool hex) 5062static BC_STATUS zbc_program_num(BcResult *r, BcNum **num, bool hex)
5062{ 5063{
5063 switch (r->t) { 5064 switch (r->t) {
@@ -5082,12 +5083,10 @@ static BC_STATUS zbc_program_num(BcResult *r, BcNum **num, bool hex)
5082 hex = hex && len == 1; 5083 hex = hex && len == 1;
5083 base_t = hex ? 16 : G.prog.ib_t; 5084 base_t = hex ? 16 : G.prog.ib_t;
5084 s = zbc_num_parse(&r->d.n, str, base_t); 5085 s = zbc_num_parse(&r->d.n, str, base_t);
5085
5086 if (s) { 5086 if (s) {
5087 bc_num_free(&r->d.n); 5087 bc_num_free(&r->d.n);
5088 RETURN_STATUS(s); 5088 RETURN_STATUS(s);
5089 } 5089 }
5090
5091 *num = &r->d.n; 5090 *num = &r->d.n;
5092 r->t = BC_RESULT_TEMP; 5091 r->t = BC_RESULT_TEMP;
5093 break; 5092 break;
@@ -5566,7 +5565,6 @@ static BC_STATUS zbc_program_print(char inst, size_t idx)
5566 RETURN_STATUS(bc_error_stack_has_too_few_elements()); 5565 RETURN_STATUS(bc_error_stack_has_too_few_elements());
5567 5566
5568 r = bc_vec_item_rev(&G.prog.results, idx); 5567 r = bc_vec_item_rev(&G.prog.results, idx);
5569 num = NULL; // is this NULL necessary?
5570 s = zbc_program_num(r, &num, false); 5568 s = zbc_program_num(r, &num, false);
5571 if (s) RETURN_STATUS(s); 5569 if (s) RETURN_STATUS(s);
5572 5570
@@ -6203,7 +6201,6 @@ static BC_STATUS zdc_program_asciify(void)
6203 RETURN_STATUS(bc_error_stack_has_too_few_elements()); 6201 RETURN_STATUS(bc_error_stack_has_too_few_elements());
6204 r = bc_vec_top(&G.prog.results); 6202 r = bc_vec_top(&G.prog.results);
6205 6203
6206 num = NULL; // TODO: is this NULL needed?
6207 s = zbc_program_num(r, &num, false); 6204 s = zbc_program_num(r, &num, false);
6208 if (s) RETURN_STATUS(s); 6205 if (s) RETURN_STATUS(s);
6209 6206
@@ -6268,7 +6265,6 @@ static BC_STATUS zdc_program_printStream(void)
6268 RETURN_STATUS(bc_error_stack_has_too_few_elements()); 6265 RETURN_STATUS(bc_error_stack_has_too_few_elements());
6269 r = bc_vec_top(&G.prog.results); 6266 r = bc_vec_top(&G.prog.results);
6270 6267
6271 n = NULL; // is this needed?
6272 s = zbc_program_num(r, &n, false); 6268 s = zbc_program_num(r, &n, false);
6273 if (s) RETURN_STATUS(s); 6269 if (s) RETURN_STATUS(s);
6274 6270