aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-14 23:41:33 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-14 23:41:33 +0100
commitf10f17f8d3ee77c469fc57634a458e8a45aeb681 (patch)
treeb580c3ac7835c8f87c57cece58da7f9b9abf781a
parent0154d78738da5f56c09665e804d94fdcd31cb081 (diff)
downloadbusybox-w32-f10f17f8d3ee77c469fc57634a458e8a45aeb681.tar.gz
busybox-w32-f10f17f8d3ee77c469fc57634a458e8a45aeb681.tar.bz2
busybox-w32-f10f17f8d3ee77c469fc57634a458e8a45aeb681.zip
bc: drop zbc_parse_endBody() bool parameter, move its code to caller which uses it
function old new delta zbc_parse_stmt 1456 1479 +23 zbc_parse_body 103 101 -2 zbc_parse_endBody 326 292 -34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 23/-36) Total: -13 bytes text data bss dec hex filename 979893 485 7296 987674 f121a busybox_old 979880 485 7296 987661 f120d busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 9a501a25e..4024a08df 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -4046,23 +4046,13 @@ static BC_STATUS zbc_parse_return(BcParse *p)
4046# define zbc_parse_return(...) (zbc_parse_return(__VA_ARGS__), BC_STATUS_SUCCESS) 4046# define zbc_parse_return(...) (zbc_parse_return(__VA_ARGS__), BC_STATUS_SUCCESS)
4047#endif 4047#endif
4048 4048
4049static BC_STATUS zbc_parse_endBody(BcParse *p, bool brace) 4049static BC_STATUS zbc_parse_endBody(BcParse *p)
4050{ 4050{
4051 BcStatus s = BC_STATUS_SUCCESS; 4051 BcStatus s = BC_STATUS_SUCCESS;
4052 4052
4053 if (p->flags.len <= 1 || (brace && p->nbraces == 0)) 4053 if (p->flags.len <= 1)
4054 RETURN_STATUS(bc_error_bad_token()); 4054 RETURN_STATUS(bc_error_bad_token());
4055 4055
4056 if (brace) {
4057 if (p->l.t.t != BC_LEX_RBRACE)
4058 RETURN_STATUS(bc_error_bad_token());
4059 if (!p->nbraces)
4060 RETURN_STATUS(bc_error_bad_token());
4061 --p->nbraces;
4062 s = zbc_lex_next(&p->l);
4063 if (s) RETURN_STATUS(s);
4064 }
4065
4066 if (BC_PARSE_IF(p)) { 4056 if (BC_PARSE_IF(p)) {
4067 uint8_t *flag_ptr; 4057 uint8_t *flag_ptr;
4068 4058
@@ -4523,7 +4513,7 @@ static BC_STATUS zbc_parse_body(BcParse *p, bool brace)
4523 else { 4513 else {
4524 dbg_lex("%s:%d !BC_PARSE_FLAG_FUNC_INNER", __func__, __LINE__); 4514 dbg_lex("%s:%d !BC_PARSE_FLAG_FUNC_INNER", __func__, __LINE__);
4525 s = zbc_parse_stmt(p); 4515 s = zbc_parse_stmt(p);
4526 if (!s && !brace) s = zbc_parse_endBody(p, false); 4516 if (!s && !brace) s = zbc_parse_endBody(p);
4527 } 4517 }
4528 4518
4529 dbg_lex_done("%s:%d done", __func__, __LINE__); 4519 dbg_lex_done("%s:%d done", __func__, __LINE__);
@@ -4598,7 +4588,12 @@ static BC_STATUS zbc_parse_stmt(BcParse *p)
4598 while (!s && p->l.t.t == BC_LEX_SCOLON) s = zbc_lex_next(&p->l); 4588 while (!s && p->l.t.t == BC_LEX_SCOLON) s = zbc_lex_next(&p->l);
4599 break; 4589 break;
4600 case BC_LEX_RBRACE: 4590 case BC_LEX_RBRACE:
4601 s = zbc_parse_endBody(p, true); 4591 if (p->nbraces == 0)
4592 RETURN_STATUS(bc_error_bad_token());
4593 --p->nbraces;
4594 s = zbc_lex_next(&p->l);
4595 if (!s)
4596 s = zbc_parse_endBody(p);
4602 break; 4597 break;
4603 case BC_LEX_STR: 4598 case BC_LEX_STR:
4604 s = zbc_parse_string(p, BC_INST_PRINT_STR); 4599 s = zbc_parse_string(p, BC_INST_PRINT_STR);