aboutsummaryrefslogtreecommitdiff
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
parent44a99ca61716f9846756c3d0cd434bfe8192339e (diff)
downloadbusybox-047154472ac41ddf45ed57d9bc294fbf9057cbad.tar.gz
bc: shrink bc_program_add_fn()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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)
p->func = bc_program_func(fidx);
}
-static size_t bc_program_add_fn(void)
+static void bc_program_add_fn(void)
{
- size_t idx;
+ //size_t idx;
BcFunc f;
bc_func_init(&f);
- idx = G.prog.fns.len;
+ //idx = G.prog.fns.len;
bc_vec_push(&G.prog.fns, &f);
- return idx;
+ //return idx;
}
#if ENABLE_BC
@@ -7035,10 +7035,11 @@ static void bc_program_init(void)
bc_vec_init(&G.prog.fns, sizeof(BcFunc), bc_func_free);
IF_BC(bc_vec_init(&G.prog.fn_map, sizeof(BcId), bc_id_free);)
-//TODO: with "", dc_strings.dc enters infinite loop, ??!
if (IS_BC) {
- IF_BC(bc_program_addFunc(xstrdup("(m)"))); // func #0: main
- IF_BC(bc_program_addFunc(xstrdup("(r)"))); // func #1: for read()
+ // Names are chosen simply to never match
+ // a valid function name (and be short)
+ IF_BC(bc_program_addFunc(xstrdup(""))); // func #0: main
+ IF_BC(bc_program_addFunc(xstrdup(""))); // func #1: for read()
} else {
bc_program_add_fn();
bc_program_add_fn();