aboutsummaryrefslogtreecommitdiff
path: root/miscutils/bc.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-21 00:10:26 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-21 00:10:26 +0100
commit047154472ac41ddf45ed57d9bc294fbf9057cbad (patch)
tree7866ce31c1c8df808572949f62823d864294cb6a /miscutils/bc.c
parent44a99ca61716f9846756c3d0cd434bfe8192339e (diff)
downloadbusybox-w32-047154472ac41ddf45ed57d9bc294fbf9057cbad.tar.gz
busybox-w32-047154472ac41ddf45ed57d9bc294fbf9057cbad.tar.bz2
busybox-w32-047154472ac41ddf45ed57d9bc294fbf9057cbad.zip
bc: shrink bc_program_add_fn()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r--miscutils/bc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index e05191717..d37417f11 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -3606,14 +3606,14 @@ static void bc_parse_create(BcParse *p, size_t fidx)
3606 p->func = bc_program_func(fidx); 3606 p->func = bc_program_func(fidx);
3607} 3607}
3608 3608
3609static size_t bc_program_add_fn(void) 3609static void bc_program_add_fn(void)
3610{ 3610{
3611 size_t idx; 3611 //size_t idx;
3612 BcFunc f; 3612 BcFunc f;
3613 bc_func_init(&f); 3613 bc_func_init(&f);
3614 idx = G.prog.fns.len; 3614 //idx = G.prog.fns.len;
3615 bc_vec_push(&G.prog.fns, &f); 3615 bc_vec_push(&G.prog.fns, &f);
3616 return idx; 3616 //return idx;
3617} 3617}
3618 3618
3619#if ENABLE_BC 3619#if ENABLE_BC
@@ -7035,10 +7035,11 @@ static void bc_program_init(void)
7035 bc_vec_init(&G.prog.fns, sizeof(BcFunc), bc_func_free); 7035 bc_vec_init(&G.prog.fns, sizeof(BcFunc), bc_func_free);
7036 IF_BC(bc_vec_init(&G.prog.fn_map, sizeof(BcId), bc_id_free);) 7036 IF_BC(bc_vec_init(&G.prog.fn_map, sizeof(BcId), bc_id_free);)
7037 7037
7038//TODO: with "", dc_strings.dc enters infinite loop, ??!
7039 if (IS_BC) { 7038 if (IS_BC) {
7040 IF_BC(bc_program_addFunc(xstrdup("(m)"))); // func #0: main 7039 // Names are chosen simply to never match
7041 IF_BC(bc_program_addFunc(xstrdup("(r)"))); // func #1: for read() 7040 // a valid function name (and be short)
7041 IF_BC(bc_program_addFunc(xstrdup(""))); // func #0: main
7042 IF_BC(bc_program_addFunc(xstrdup(""))); // func #1: for read()
7042 } else { 7043 } else {
7043 bc_program_add_fn(); 7044 bc_program_add_fn();
7044 bc_program_add_fn(); 7045 bc_program_add_fn();