diff options
-rw-r--r-- | miscutils/bc.c | 15 |
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) | |||
5472 | bc_vec_push(&G.prog.results, r); | 5472 | bc_vec_push(&G.prog.results, r); |
5473 | } | 5473 | } |
5474 | 5474 | ||
5475 | static BcStatus bc_program_op(char inst) | 5475 | static BC_STATUS zbc_program_op(char inst) |
5476 | { | 5476 | { |
5477 | BcStatus s; | 5477 | BcStatus s; |
5478 | BcResult *opd1, *opd2, res; | 5478 | BcResult *opd1, *opd2, res; |
5479 | BcNum *n1, *n2 = NULL; | 5479 | BcNum *n1, *n2 = NULL; |
5480 | 5480 | ||
5481 | s = zbc_program_binOpPrep(&opd1, &n1, &opd2, &n2, false); | 5481 | s = zbc_program_binOpPrep(&opd1, &n1, &opd2, &n2, false); |
5482 | if (s) return s; | 5482 | if (s) RETURN_STATUS(s); |
5483 | bc_num_init_DEF_SIZE(&res.d.n); | 5483 | bc_num_init_DEF_SIZE(&res.d.n); |
5484 | 5484 | ||
5485 | s = BC_STATUS_SUCCESS; | 5485 | s = BC_STATUS_SUCCESS; |
@@ -5490,12 +5490,15 @@ static BcStatus bc_program_op(char inst) | |||
5490 | if (s) goto err; | 5490 | if (s) goto err; |
5491 | bc_program_binOpRetire(&res); | 5491 | bc_program_binOpRetire(&res); |
5492 | 5492 | ||
5493 | return s; | 5493 | RETURN_STATUS(s); |
5494 | 5494 | ||
5495 | err: | 5495 | err: |
5496 | bc_num_free(&res.d.n); | 5496 | bc_num_free(&res.d.n); |
5497 | return s; | 5497 | RETURN_STATUS(s); |
5498 | } | 5498 | } |
5499 | #if ERRORS_ARE_FATAL | ||
5500 | # define zbc_program_op(...) (zbc_program_op(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
5501 | #endif | ||
5499 | 5502 | ||
5500 | static BcStatus bc_program_read(void) | 5503 | static BcStatus bc_program_read(void) |
5501 | { | 5504 | { |
@@ -6089,7 +6092,7 @@ static BC_STATUS zbc_program_assign(char inst) | |||
6089 | #endif | 6092 | #endif |
6090 | 6093 | ||
6091 | if (left->t == BC_RESULT_CONSTANT || left->t == BC_RESULT_TEMP) | 6094 | if (left->t == BC_RESULT_CONSTANT || left->t == BC_RESULT_TEMP) |
6092 | RETURN_STATUS(("bad assignment:" | 6095 | RETURN_STATUS(bc_error("bad assignment:" |
6093 | " left side must be scale," | 6096 | " left side must be scale," |
6094 | " ibase, obase, last, var," | 6097 | " ibase, obase, last, var," |
6095 | " or array element" | 6098 | " or array element" |
@@ -6943,7 +6946,7 @@ static BcStatus bc_program_exec(void) | |||
6943 | case BC_INST_MODULUS: | 6946 | case BC_INST_MODULUS: |
6944 | case BC_INST_PLUS: | 6947 | case BC_INST_PLUS: |
6945 | case BC_INST_MINUS: | 6948 | case BC_INST_MINUS: |
6946 | s = bc_program_op(inst); | 6949 | s = zbc_program_op(inst); |
6947 | break; | 6950 | break; |
6948 | case BC_INST_BOOL_NOT: | 6951 | case BC_INST_BOOL_NOT: |
6949 | s = zbc_program_prep(&ptr, &num); | 6952 | s = zbc_program_prep(&ptr, &num); |