aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-18 14:11:35 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-18 14:11:35 +0100
commita199cc95b726df7023c19fa5130a3b55287e43a2 (patch)
treeb676d52d6349b1a5a3a7a643829456f933098f2a
parent07597cd35dfbdc7597d3b2b8ecf797016a996576 (diff)
downloadbusybox-w32-a199cc95b726df7023c19fa5130a3b55287e43a2.tar.gz
busybox-w32-a199cc95b726df7023c19fa5130a3b55287e43a2.tar.bz2
busybox-w32-a199cc95b726df7023c19fa5130a3b55287e43a2.zip
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.c19
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)
4947 4947
4948static BC_STATUS zdc_parse_expr(BcParse *p, uint8_t flags) 4948static BC_STATUS zdc_parse_expr(BcParse *p, uint8_t flags)
4949{ 4949{
4950 BcStatus s = BC_STATUS_SUCCESS;
4951 BcInst inst;
4952 BcLexType t; 4950 BcLexType t;
4953 4951
4954 for (t = p->l.t.t; !s && t != BC_LEX_EOF; t = p->l.t.t) { 4952 for (;;) {
4955 inst = dc_parse_insts[t]; 4953 BcInst inst;
4954 BcStatus s;
4955
4956 t = p->l.t.t;
4957 if (t == BC_LEX_EOF) break;
4956 4958
4959 inst = dc_parse_insts[t];
4957 if (inst != BC_INST_INVALID) { 4960 if (inst != BC_INST_INVALID) {
4958 bc_parse_push(p, inst); 4961 bc_parse_push(p, inst);
4959 s = zbc_lex_next(&p->l); 4962 s = zbc_lex_next(&p->l);
4960 } else 4963 } else {
4961 s = zdc_parse_token(p, t, flags); 4964 s = zdc_parse_token(p, t, flags);
4965 }
4966 if (s) RETURN_STATUS(s);
4962 } 4967 }
4963 4968
4964 if (!s && p->l.t.t == BC_LEX_EOF && (flags & BC_PARSE_NOCALL)) 4969 if (flags & BC_PARSE_NOCALL)
4965 bc_parse_push(p, BC_INST_POP_EXEC); 4970 bc_parse_push(p, BC_INST_POP_EXEC);
4966 4971
4967 RETURN_STATUS(s); 4972 RETURN_STATUS(BC_STATUS_SUCCESS);
4968} 4973}
4969#define zdc_parse_expr(...) (zdc_parse_expr(__VA_ARGS__) COMMA_SUCCESS) 4974#define zdc_parse_expr(...) (zdc_parse_expr(__VA_ARGS__) COMMA_SUCCESS)
4970 4975