bc: p->exits.func is never zero, do not check for that

function                                             old     new   delta
zbc_parse_stmt_possibly_auto                        1978    1967     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-11)             Total: -11 bytes
   text	   data	    bss	    dec	    hex	filename
 981948	    485	   7296	 989729	  f1a21	busybox_old
 981937	    485	   7296	 989718	  f1a16	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-12-16 23:18:28 +01:00
parent de24e9d366
commit 8e7686e457

View File

@ -4232,7 +4232,6 @@ static BC_STATUS zbc_parse_for(BcParse *p)
BcInstPtr ip; BcInstPtr ip;
size_t *label; size_t *label;
size_t cond_idx, exit_idx, body_idx, update_idx; size_t cond_idx, exit_idx, body_idx, update_idx;
size_t n;
dbg_lex("%s:%d p->l.t.t:%d", __func__, __LINE__, p->l.t.t); dbg_lex("%s:%d p->l.t.t:%d", __func__, __LINE__, p->l.t.t);
s = zbc_lex_next(&p->l); s = zbc_lex_next(&p->l);
@ -4305,16 +4304,10 @@ static BC_STATUS zbc_parse_for(BcParse *p)
s = zbc_parse_stmt_fail_if_bare_NLINE(p, false, "for"); s = zbc_parse_stmt_fail_if_bare_NLINE(p, false, "for");
if (s) RETURN_STATUS(s); if (s) RETURN_STATUS(s);
n = *((size_t *) bc_vec_top(&p->conds));
bc_parse_push(p, BC_INST_JUMP);
bc_parse_pushIndex(p, n);
label = bc_vec_top(&p->conds);
//TODO: commonalize? //TODO: commonalize?
dbg_lex("%s:%d BC_INST_JUMP to %d", __func__, __LINE__, *label); dbg_lex("%s:%d BC_INST_JUMP to %d", __func__, __LINE__, update_idx);
bc_parse_push(p, BC_INST_JUMP); bc_parse_push(p, BC_INST_JUMP);
bc_parse_pushIndex(p, *label); bc_parse_pushIndex(p, update_idx);
label = bc_vec_item(&p->func->labels, ip.idx); label = bc_vec_item(&p->func->labels, ip.idx);
dbg_lex("%s:%d rewriting label: %d -> %d", __func__, __LINE__, *label, p->func->code.len); dbg_lex("%s:%d rewriting label: %d -> %d", __func__, __LINE__, *label, p->func->code.len);
@ -4337,18 +4330,13 @@ static BC_STATUS zbc_parse_break_or_continue(BcParse *p, BcLexType type)
if (type == BC_LEX_KEY_BREAK) { if (type == BC_LEX_KEY_BREAK) {
BcInstPtr *ipp; BcInstPtr *ipp;
i = p->exits.len; if (p->exits.len == 0) // none of the enclosing blocks is a loop
for (;;) { RETURN_STATUS(bc_error_bad_token());
if (i == 0) // none of the enclosing blocks is a loop ipp = bc_vec_top(&p->exits);
RETURN_STATUS(bc_error_bad_token());
ipp = bc_vec_item(&p->exits, --i);
if (ipp->func != 0)
break;
}
i = ipp->idx; i = ipp->idx;
} } else {
else
i = *((size_t *) bc_vec_top(&p->conds)); i = *((size_t *) bc_vec_top(&p->conds));
}
bc_parse_push(p, BC_INST_JUMP); bc_parse_push(p, BC_INST_JUMP);
bc_parse_pushIndex(p, i); bc_parse_pushIndex(p, i);