diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-16 21:21:27 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-16 21:21:27 +0100 |
commit | 741563312805fa99fc9588c3673eff4a219d5e9f (patch) | |
tree | cdb7bf6e4a0e76730b0d00973b8a38b45c9149d2 | |
parent | 5d18f6be90a940f80c3b7238dc7a8b42a41f55bd (diff) | |
download | busybox-w32-741563312805fa99fc9588c3673eff4a219d5e9f.tar.gz busybox-w32-741563312805fa99fc9588c3673eff4a219d5e9f.tar.bz2 busybox-w32-741563312805fa99fc9588c3673eff4a219d5e9f.zip |
bc: preparation to stop using p->exits when parsing if()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/bc.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 9f40a551e..ad716fac3 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -4141,15 +4141,17 @@ static BC_STATUS zbc_parse_if(BcParse *p) | |||
4141 | 4141 | ||
4142 | dbg_lex("%s:%d in if after stmt: p->l.t.t:%d", __func__, __LINE__, p->l.t.t); | 4142 | dbg_lex("%s:%d in if after stmt: p->l.t.t:%d", __func__, __LINE__, p->l.t.t); |
4143 | if (p->l.t.t == BC_LEX_KEY_ELSE) { | 4143 | if (p->l.t.t == BC_LEX_KEY_ELSE) { |
4144 | BcInstPtr ip2; | ||
4145 | |||
4144 | s = zbc_lex_next_and_skip_NLINE(&p->l); | 4146 | s = zbc_lex_next_and_skip_NLINE(&p->l); |
4145 | if (s) RETURN_STATUS(s); | 4147 | if (s) RETURN_STATUS(s); |
4146 | 4148 | ||
4147 | ip.idx = p->func->labels.len; | 4149 | ip2.idx = p->func->labels.len; |
4148 | ip.func = ip.len = 0; | 4150 | ip2.func = ip.len = 0; |
4149 | 4151 | ||
4150 | dbg_lex("%s:%d after if() body: BC_INST_JUMP to %d", __func__, __LINE__, ip.idx); | 4152 | dbg_lex("%s:%d after if() body: BC_INST_JUMP to %d", __func__, __LINE__, ip.idx); |
4151 | bc_parse_push(p, BC_INST_JUMP); | 4153 | bc_parse_push(p, BC_INST_JUMP); |
4152 | bc_parse_pushIndex(p, ip.idx); | 4154 | bc_parse_pushIndex(p, ip2.idx); |
4153 | 4155 | ||
4154 | ipp = bc_vec_top(&p->exits); | 4156 | ipp = bc_vec_top(&p->exits); |
4155 | label = bc_vec_item(&p->func->labels, ipp->idx); | 4157 | label = bc_vec_item(&p->func->labels, ipp->idx); |
@@ -4157,8 +4159,8 @@ static BC_STATUS zbc_parse_if(BcParse *p) | |||
4157 | *label = p->func->code.len; | 4159 | *label = p->func->code.len; |
4158 | bc_vec_pop(&p->exits); | 4160 | bc_vec_pop(&p->exits); |
4159 | 4161 | ||
4160 | bc_vec_push(&p->exits, &ip); | 4162 | bc_vec_push(&p->exits, &ip2); |
4161 | bc_vec_push(&p->func->labels, &ip.idx); | 4163 | bc_vec_push(&p->func->labels, &ip2.idx); |
4162 | 4164 | ||
4163 | s = zbc_parse_stmt(p); | 4165 | s = zbc_parse_stmt(p); |
4164 | if (s) RETURN_STATUS(s); | 4166 | if (s) RETURN_STATUS(s); |