aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-12 22:48:19 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-12 22:48:19 +0100
commit19f110751d333bc4ddb74b8d23b25516d649986c (patch)
treec86b988ecea0064ab84fec5b43b0cd9f12e095ec
parent8a89247e0a82b328958e010be5da4c815f9121be (diff)
downloadbusybox-w32-19f110751d333bc4ddb74b8d23b25516d649986c.tar.gz
busybox-w32-19f110751d333bc4ddb74b8d23b25516d649986c.tar.bz2
busybox-w32-19f110751d333bc4ddb74b8d23b25516d649986c.zip
bc: convert two more functions to "z" logic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 9809fa72f..1bf3e373e 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -7060,7 +7060,7 @@ err:
7060# define zbc_vm_file(...) (zbc_vm_file(__VA_ARGS__), BC_STATUS_SUCCESS) 7060# define zbc_vm_file(...) (zbc_vm_file(__VA_ARGS__), BC_STATUS_SUCCESS)
7061#endif 7061#endif
7062 7062
7063static BcStatus bc_vm_stdin(void) 7063static BC_STATUS zbc_vm_stdin(void)
7064{ 7064{
7065 BcStatus s; 7065 BcStatus s;
7066 BcVec buf, buffer; 7066 BcVec buf, buffer;
@@ -7148,8 +7148,11 @@ static BcStatus bc_vm_stdin(void)
7148 7148
7149 bc_vec_free(&buf); 7149 bc_vec_free(&buf);
7150 bc_vec_free(&buffer); 7150 bc_vec_free(&buffer);
7151 return s; 7151 RETURN_STATUS(s);
7152} 7152}
7153#if ERRORS_ARE_FATAL
7154# define zbc_vm_stdin(...) (zbc_vm_stdin(__VA_ARGS__), BC_STATUS_SUCCESS)
7155#endif
7153 7156
7154#if ENABLE_BC 7157#if ENABLE_BC
7155static const char bc_lib[] = { 7158static const char bc_lib[] = {
@@ -7328,7 +7331,7 @@ static const char bc_lib[] = {
7328}; 7331};
7329#endif // ENABLE_BC 7332#endif // ENABLE_BC
7330 7333
7331static BcStatus bc_vm_exec(void) 7334static BC_STATUS zbc_vm_exec(void)
7332{ 7335{
7333 BcStatus s; 7336 BcStatus s;
7334 size_t i; 7337 size_t i;
@@ -7341,14 +7344,14 @@ static BcStatus bc_vm_exec(void)
7341# define DEBUG_LIB 0 7344# define DEBUG_LIB 0
7342 bc_lex_file(&G.prs.l); 7345 bc_lex_file(&G.prs.l);
7343 s = zbc_parse_text(&G.prs, bc_lib); 7346 s = zbc_parse_text(&G.prs, bc_lib);
7344 if (DEBUG_LIB && s) return s; 7347 if (DEBUG_LIB && s) RETURN_STATUS(s);
7345 7348
7346 while (G.prs.l.t.t != BC_LEX_EOF) { 7349 while (G.prs.l.t.t != BC_LEX_EOF) {
7347 ERROR_RETURN(s =) G.prs.parse(&G.prs); 7350 ERROR_RETURN(s =) G.prs.parse(&G.prs);
7348 if (DEBUG_LIB && s) return s; 7351 if (DEBUG_LIB && s) RETURN_STATUS(s);
7349 } 7352 }
7350 s = zbc_program_exec(); 7353 s = zbc_program_exec();
7351 if (DEBUG_LIB && s) return s; 7354 if (DEBUG_LIB && s) RETURN_STATUS(s);
7352 } 7355 }
7353#endif 7356#endif
7354 7357
@@ -7359,17 +7362,20 @@ static BcStatus bc_vm_exec(void)
7359 // Debug config, non-interactive mode: 7362 // Debug config, non-interactive mode:
7360 // return all the way back to main. 7363 // return all the way back to main.
7361 // Non-debug builds do not come here, they exit. 7364 // Non-debug builds do not come here, they exit.
7362 return s; 7365 RETURN_STATUS(s);
7363 } 7366 }
7364 7367
7365 if (IS_BC || (option_mask32 & BC_FLAG_I)) 7368 if (IS_BC || (option_mask32 & BC_FLAG_I))
7366 s = bc_vm_stdin(); 7369 s = zbc_vm_stdin();
7367 7370
7368 if (!s && !BC_PARSE_CAN_EXEC(&G.prs)) 7371 if (!s && !BC_PARSE_CAN_EXEC(&G.prs))
7369 s = zbc_vm_process(""); 7372 s = zbc_vm_process("");
7370 7373
7371 return s; 7374 RETURN_STATUS(s);
7372} 7375}
7376#if ERRORS_ARE_FATAL
7377# define zbc_vm_exec(...) (zbc_vm_exec(__VA_ARGS__), BC_STATUS_SUCCESS)
7378#endif
7373 7379
7374#if ENABLE_FEATURE_CLEAN_UP 7380#if ENABLE_FEATURE_CLEAN_UP
7375static void bc_program_free(void) 7381static void bc_program_free(void)
@@ -7499,7 +7505,7 @@ static int bc_vm_init(const char *env_len)
7499 7505
7500static BcStatus bc_vm_run(void) 7506static BcStatus bc_vm_run(void)
7501{ 7507{
7502 BcStatus st = bc_vm_exec(); 7508 BcStatus st = zbc_vm_exec();
7503#if ENABLE_FEATURE_CLEAN_UP 7509#if ENABLE_FEATURE_CLEAN_UP
7504 if (G_exiting) // it was actually "halt" or "quit" 7510 if (G_exiting) // it was actually "halt" or "quit"
7505 st = EXIT_SUCCESS; 7511 st = EXIT_SUCCESS;