diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-18 14:11:35 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-18 14:11:35 +0100 |
commit | a199cc95b726df7023c19fa5130a3b55287e43a2 (patch) | |
tree | b676d52d6349b1a5a3a7a643829456f933098f2a | |
parent | 07597cd35dfbdc7597d3b2b8ecf797016a996576 (diff) | |
download | busybox-a199cc95b726df7023c19fa5130a3b55287e43a2.tar.gz |
bc: shrink zdc_parse_expr()
function old new delta
zdc_parse_expr 656 653 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/bc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index be198a5fb..a5fcaf3bc 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -4947,24 +4947,29 @@ static BC_STATUS zdc_parse_token(BcParse *p, BcLexType t, uint8_t flags) static BC_STATUS zdc_parse_expr(BcParse *p, uint8_t flags) { - BcStatus s = BC_STATUS_SUCCESS; - BcInst inst; BcLexType t; - for (t = p->l.t.t; !s && t != BC_LEX_EOF; t = p->l.t.t) { - inst = dc_parse_insts[t]; + for (;;) { + BcInst inst; + BcStatus s; + + t = p->l.t.t; + if (t == BC_LEX_EOF) break; + inst = dc_parse_insts[t]; if (inst != BC_INST_INVALID) { bc_parse_push(p, inst); s = zbc_lex_next(&p->l); - } else + } else { s = zdc_parse_token(p, t, flags); + } + if (s) RETURN_STATUS(s); } - if (!s && p->l.t.t == BC_LEX_EOF && (flags & BC_PARSE_NOCALL)) + if (flags & BC_PARSE_NOCALL) bc_parse_push(p, BC_INST_POP_EXEC); - RETURN_STATUS(s); + RETURN_STATUS(BC_STATUS_SUCCESS); } #define zdc_parse_expr(...) (zdc_parse_expr(__VA_ARGS__) COMMA_SUCCESS) |