aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-16 19:47:40 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-16 19:47:40 +0100
commit563d93c9a4e2a784dfbec6703c572fb88eb99332 (patch)
treeea3f51b2ff14f2aced5f723564dfb92a90658c14
parenta50576a415a9b5d384a28c9bd4b55a4df2974248 (diff)
downloadbusybox-w32-563d93c9a4e2a784dfbec6703c572fb88eb99332.tar.gz
busybox-w32-563d93c9a4e2a784dfbec6703c572fb88eb99332.tar.bz2
busybox-w32-563d93c9a4e2a784dfbec6703c572fb88eb99332.zip
bc: simplify zbc_parse_break_or_continue(), logic is the same
function old new delta zbc_parse_stmt_possibly_auto 2259 2224 -35 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-35) Total: -35 bytes text data bss dec hex filename 982218 485 7296 989999 f1b2f busybox_old 982183 485 7296 989964 f1b0c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 9ce6ab667..8aaeeaf9f 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -4358,20 +4358,19 @@ static BC_STATUS zbc_parse_break_or_continue(BcParse *p, BcLexType type)
4358{ 4358{
4359 BcStatus s; 4359 BcStatus s;
4360 size_t i; 4360 size_t i;
4361 BcInstPtr *ip;
4362 4361
4363 if (type == BC_LEX_KEY_BREAK) { 4362 if (type == BC_LEX_KEY_BREAK) {
4364 if (p->exits.len == 0) RETURN_STATUS(bc_error_bad_token()); 4363 BcInstPtr *ipp;
4365
4366 i = p->exits.len - 1;
4367 ip = bc_vec_item(&p->exits, i);
4368
4369 while (!ip->func && i < p->exits.len)
4370 ip = bc_vec_item(&p->exits, i--);
4371 if (i >= p->exits.len && !ip->func)
4372 RETURN_STATUS(bc_error_bad_token());
4373 4364
4374 i = ip->idx; 4365 i = p->exits.len;
4366 for (;;) {
4367 if (i == 0) // none of the enclosing blocks is a loop
4368 RETURN_STATUS(bc_error_bad_token());
4369 ipp = bc_vec_item(&p->exits, --i);
4370 if (ipp->func != 0)
4371 break;
4372 }
4373 i = ipp->idx;
4375 } 4374 }
4376 else 4375 else
4377 i = *((size_t *) bc_vec_top(&p->conds)); 4376 i = *((size_t *) bc_vec_top(&p->conds));