aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-11 19:42:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-11 19:44:14 +0100
commit259137d0f0600150cd783c796e4011164c44a7f0 (patch)
tree47708eb1e809eb17c1f2928656f6c6b2f0f548f7
parent728e7c9ecb1b64473412fe45caf1623e22a9204b (diff)
downloadbusybox-259137d0f0600150cd783c796e4011164c44a7f0.tar.gz
bc: convert zbc_program_op to "z" function, fix a thinko in prev commits
function old new delta zbc_program_assign 448 447 -1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index acc0b6073..be118d81d 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -5472,14 +5472,14 @@ static void bc_program_retire(BcResult *r, BcResultType t)
bc_vec_push(&G.prog.results, r);
}
-static BcStatus bc_program_op(char inst)
+static BC_STATUS zbc_program_op(char inst)
{
BcStatus s;
BcResult *opd1, *opd2, res;
BcNum *n1, *n2 = NULL;
s = zbc_program_binOpPrep(&opd1, &n1, &opd2, &n2, false);
- if (s) return s;
+ if (s) RETURN_STATUS(s);
bc_num_init_DEF_SIZE(&res.d.n);
s = BC_STATUS_SUCCESS;
@@ -5490,12 +5490,15 @@ static BcStatus bc_program_op(char inst)
if (s) goto err;
bc_program_binOpRetire(&res);
- return s;
+ RETURN_STATUS(s);
err:
bc_num_free(&res.d.n);
- return s;
+ RETURN_STATUS(s);
}
+#if ERRORS_ARE_FATAL
+# define zbc_program_op(...) (zbc_program_op(__VA_ARGS__), BC_STATUS_SUCCESS)
+#endif
static BcStatus bc_program_read(void)
{
@@ -6089,7 +6092,7 @@ static BC_STATUS zbc_program_assign(char inst)
#endif
if (left->t == BC_RESULT_CONSTANT || left->t == BC_RESULT_TEMP)
- RETURN_STATUS(("bad assignment:"
+ RETURN_STATUS(bc_error("bad assignment:"
" left side must be scale,"
" ibase, obase, last, var,"
" or array element"
@@ -6943,7 +6946,7 @@ static BcStatus bc_program_exec(void)
case BC_INST_MODULUS:
case BC_INST_PLUS:
case BC_INST_MINUS:
- s = bc_program_op(inst);
+ s = zbc_program_op(inst);
break;
case BC_INST_BOOL_NOT:
s = zbc_program_prep(&ptr, &num);