aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/bc.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 5f1baf431..9f05cad0c 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -6526,7 +6526,7 @@ static void bc_program_stackLen(void)
6526 bc_vec_push(&G.prog.results, &res); 6526 bc_vec_push(&G.prog.results, &res);
6527} 6527}
6528 6528
6529static BcStatus bc_program_asciify(void) 6529static BC_STATUS zbc_program_asciify(void)
6530{ 6530{
6531 BcStatus s; 6531 BcStatus s;
6532 BcResult *r, res; 6532 BcResult *r, res;
@@ -6536,12 +6536,12 @@ static BcStatus bc_program_asciify(void)
6536 unsigned long val; 6536 unsigned long val;
6537 6537
6538 if (!BC_PROG_STACK(&G.prog.results, 1)) 6538 if (!BC_PROG_STACK(&G.prog.results, 1))
6539 return bc_error_stack_has_too_few_elements(); 6539 RETURN_STATUS(bc_error_stack_has_too_few_elements());
6540 r = bc_vec_top(&G.prog.results); 6540 r = bc_vec_top(&G.prog.results);
6541 6541
6542 num = NULL; // TODO: is this NULL needed? 6542 num = NULL; // TODO: is this NULL needed?
6543 s = zbc_program_num(r, &num, false); 6543 s = zbc_program_num(r, &num, false);
6544 if (s) return s; 6544 if (s) RETURN_STATUS(s);
6545 6545
6546 if (BC_PROG_NUM(r, num)) { 6546 if (BC_PROG_NUM(r, num)) {
6547 6547
@@ -6572,7 +6572,6 @@ static BcStatus bc_program_asciify(void)
6572 bc_program_addFunc(str2, &idx); 6572 bc_program_addFunc(str2, &idx);
6573 6573
6574 if (idx != len + BC_PROG_REQ_FUNCS) { 6574 if (idx != len + BC_PROG_REQ_FUNCS) {
6575
6576 for (idx = 0; idx < G.prog.strs.len; ++idx) { 6575 for (idx = 0; idx < G.prog.strs.len; ++idx) {
6577 if (strcmp(*bc_program_str(idx), str) == 0) { 6576 if (strcmp(*bc_program_str(idx), str) == 0) {
6578 len = idx; 6577 len = idx;
@@ -6590,12 +6589,15 @@ static BcStatus bc_program_asciify(void)
6590 bc_vec_pop(&G.prog.results); 6589 bc_vec_pop(&G.prog.results);
6591 bc_vec_push(&G.prog.results, &res); 6590 bc_vec_push(&G.prog.results, &res);
6592 6591
6593 return BC_STATUS_SUCCESS; 6592 RETURN_STATUS(BC_STATUS_SUCCESS);
6594 6593
6595num_err: 6594num_err:
6596 bc_num_free(&n); 6595 bc_num_free(&n);
6597 return s; 6596 RETURN_STATUS(s);
6598} 6597}
6598#if ERRORS_ARE_FATAL
6599# define zbc_program_asciify(...) (zbc_program_asciify(__VA_ARGS__), BC_STATUS_SUCCESS)
6600#endif
6599 6601
6600static BC_STATUS zbc_program_printStream(void) 6602static BC_STATUS zbc_program_printStream(void)
6601{ 6603{
@@ -6984,7 +6986,7 @@ static BcStatus bc_program_exec(void)
6984 break; 6986 break;
6985 } 6987 }
6986 case BC_INST_ASCIIFY: 6988 case BC_INST_ASCIIFY:
6987 s = bc_program_asciify(); 6989 s = zbc_program_asciify();
6988 break; 6990 break;
6989 case BC_INST_PRINT_STREAM: 6991 case BC_INST_PRINT_STREAM:
6990 s = zbc_program_printStream(); 6992 s = zbc_program_printStream();