diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-16 23:24:25 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-16 23:24:25 +0100 |
| commit | 266aa000126dcbb9e1c93306165f433a167bb50a (patch) | |
| tree | 493b3f1230dfbf0ea54d4abda4b8c20045ecd667 /miscutils | |
| parent | 8e7686e4577ac7b07845d16fd95a39a4ce0af3c1 (diff) | |
| download | busybox-w32-266aa000126dcbb9e1c93306165f433a167bb50a.tar.gz busybox-w32-266aa000126dcbb9e1c93306165f433a167bb50a.tar.bz2 busybox-w32-266aa000126dcbb9e1c93306165f433a167bb50a.zip | |
bc: store only index in p->exits, it's the only thing used there
function old new delta
zbc_parse_stmt_possibly_auto 1967 1964 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3) Total: -3 bytes
text data bss dec hex filename
981937 485 7296 989718 f1a16 busybox_old
981934 485 7296 989715 f1a13 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/bc.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index ca14c1ba7..979d5113d 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
| @@ -3642,7 +3642,7 @@ static void bc_parse_create(BcParse *p, size_t func) | |||
| 3642 | memset(p, 0, sizeof(BcParse)); | 3642 | memset(p, 0, sizeof(BcParse)); |
| 3643 | 3643 | ||
| 3644 | bc_lex_init(&p->l); | 3644 | bc_lex_init(&p->l); |
| 3645 | bc_vec_init(&p->exits, sizeof(BcInstPtr), NULL); | 3645 | bc_vec_init(&p->exits, sizeof(size_t), NULL); |
| 3646 | bc_vec_init(&p->conds, sizeof(size_t), NULL); | 3646 | bc_vec_init(&p->conds, sizeof(size_t), NULL); |
| 3647 | bc_vec_init(&p->ops, sizeof(BcLexType), NULL); | 3647 | bc_vec_init(&p->ops, sizeof(BcLexType), NULL); |
| 3648 | 3648 | ||
| @@ -4192,7 +4192,7 @@ static BC_STATUS zbc_parse_while(BcParse *p) | |||
| 4192 | ip.func = 1; | 4192 | ip.func = 1; |
| 4193 | ip.len = 0; | 4193 | ip.len = 0; |
| 4194 | 4194 | ||
| 4195 | bc_vec_push(&p->exits, &ip); | 4195 | bc_vec_push(&p->exits, &ip.idx); |
| 4196 | bc_vec_push(&p->func->labels, &ip.idx); | 4196 | bc_vec_push(&p->func->labels, &ip.idx); |
| 4197 | 4197 | ||
| 4198 | s = zbc_parse_expr(p, BC_PARSE_REL, bc_parse_next_rel); | 4198 | s = zbc_parse_expr(p, BC_PARSE_REL, bc_parse_next_rel); |
| @@ -4294,7 +4294,7 @@ static BC_STATUS zbc_parse_for(BcParse *p) | |||
| 4294 | ip.func = 1; | 4294 | ip.func = 1; |
| 4295 | ip.len = 0; | 4295 | ip.len = 0; |
| 4296 | 4296 | ||
| 4297 | bc_vec_push(&p->exits, &ip); | 4297 | bc_vec_push(&p->exits, &ip.idx); |
| 4298 | bc_vec_push(&p->func->labels, &ip.idx); | 4298 | bc_vec_push(&p->func->labels, &ip.idx); |
| 4299 | 4299 | ||
| 4300 | // for(...)<newline>stmt is accepted as well | 4300 | // for(...)<newline>stmt is accepted as well |
| @@ -4328,14 +4328,11 @@ static BC_STATUS zbc_parse_break_or_continue(BcParse *p, BcLexType type) | |||
| 4328 | size_t i; | 4328 | size_t i; |
| 4329 | 4329 | ||
| 4330 | if (type == BC_LEX_KEY_BREAK) { | 4330 | if (type == BC_LEX_KEY_BREAK) { |
| 4331 | BcInstPtr *ipp; | ||
| 4332 | |||
| 4333 | if (p->exits.len == 0) // none of the enclosing blocks is a loop | 4331 | if (p->exits.len == 0) // none of the enclosing blocks is a loop |
| 4334 | RETURN_STATUS(bc_error_bad_token()); | 4332 | RETURN_STATUS(bc_error_bad_token()); |
| 4335 | ipp = bc_vec_top(&p->exits); | 4333 | i = *(size_t*)bc_vec_top(&p->exits); |
| 4336 | i = ipp->idx; | ||
| 4337 | } else { | 4334 | } else { |
| 4338 | i = *((size_t *) bc_vec_top(&p->conds)); | 4335 | i = *(size_t*)bc_vec_top(&p->conds); |
| 4339 | } | 4336 | } |
| 4340 | 4337 | ||
| 4341 | bc_parse_push(p, BC_INST_JUMP); | 4338 | bc_parse_push(p, BC_INST_JUMP); |
