aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-22 03:38:52 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-22 03:38:52 +0100
commit514967df5e5ef21873dc2f8a303e892e3f200ea4 (patch)
tree51b0ff63af8bbebf1d6a24affa6311c44c45930d
parentf093e3df2df46f026d5c3f053a6095b5c72387ac (diff)
downloadbusybox-514967df5e5ef21873dc2f8a303e892e3f200ea4.tar.gz
bc: zcommon_parse_expr() has only one user, fold it in
function old new delta zbc_program_exec 4021 4046 +25 zdc_parse_expr 589 586 -3 zcommon_parse_expr 28 - -28 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 25/-31) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 1c47fba1d..4d252cc97 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -4986,6 +4986,7 @@ static BC_STATUS zdc_parse_expr(BcParse *p)
BcStatus s;
t = p->l.t.t;
+ dbg_lex("%s:%d G.prs.l.t.t:%d", __func__, __LINE__, G.prs.l.t.t);
if (t == BC_LEX_EOF) break;
inst = dc_parse_insts[t];
@@ -5009,6 +5010,7 @@ static BC_STATUS zdc_parse_parse(BcParse *p)
{
BcStatus s;
+ dbg_lex_enter("%s:%d entered", __func__, __LINE__);
if (p->l.t.t == BC_LEX_EOF)
s = bc_error("end of file");
else
@@ -5019,22 +5021,13 @@ static BC_STATUS zdc_parse_parse(BcParse *p)
s = BC_STATUS_FAILURE;
}
+ dbg_lex_done("%s:%d done", __func__, __LINE__);
RETURN_STATUS(s);
}
#define zdc_parse_parse(...) (zdc_parse_parse(__VA_ARGS__) COMMA_SUCCESS)
#endif // ENABLE_DC
-static BC_STATUS zcommon_parse_expr(BcParse *p)
-{
- if (IS_BC) {
- IF_BC(RETURN_STATUS(zbc_parse_expr(p, 0)));
- } else {
- IF_DC(RETURN_STATUS(zdc_parse_expr(p)));
- }
-}
-#define zcommon_parse_expr(...) (zcommon_parse_expr(__VA_ARGS__) COMMA_SUCCESS)
-
static BcVec* bc_program_search(char *id, bool var)
{
BcId e, *ptr;
@@ -5239,7 +5232,11 @@ static BC_STATUS zbc_program_read(void)
s = zbc_parse_text_init(&parse, buf.v);
if (s) goto exec_err;
- s = zcommon_parse_expr(&parse);
+ if (IS_BC) {
+ IF_BC(s = zbc_parse_expr(&parse, 0));
+ } else {
+ IF_DC(s = zdc_parse_expr(&parse));
+ }
if (s) goto exec_err;
if (parse.l.t.t != BC_LEX_NLINE && parse.l.t.t != BC_LEX_EOF) {
@@ -6367,7 +6364,7 @@ static BC_STATUS zdc_program_execStr(char *code, size_t *bgn, bool cond)
str = *bc_program_str(sidx);
s = zbc_parse_text_init(&prs, str);
if (s) goto err;
- s = zcommon_parse_expr(&prs);
+ s = zdc_parse_expr(&prs);
if (s) goto err;
if (prs.l.t.t != BC_LEX_EOF) {
s = bc_error_bad_expression();