diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-19 19:10:40 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-19 19:10:40 +0100 |
| commit | 44dbe675ddbcffb37e98358599610b5b81ea0644 (patch) | |
| tree | 13782665a6a18a2bc55484caf36cfc820fe7ad17 /miscutils | |
| parent | ea5cad2a0dc7ebbb7de0d1d49ae2b72e6fbd163a (diff) | |
| download | busybox-w32-44dbe675ddbcffb37e98358599610b5b81ea0644.tar.gz busybox-w32-44dbe675ddbcffb37e98358599610b5b81ea0644.tar.bz2 busybox-w32-44dbe675ddbcffb37e98358599610b5b81ea0644.zip | |
bc: rename zbc_parse_string->bc_parse_pushSTR, do not emit next opcode in it
function old new delta
bc_parse_pushSTR - 73 +73
zbc_parse_stmt_possibly_auto 1638 1640 +2
zbc_parse_string 89 - -89
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 75/-89) Total: -14 bytes
text data bss dec hex filename
981377 485 7296 989158 f17e6 busybox_old
981363 485 7296 989144 f17d8 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/bc.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index c1601a3e4..6e15a8c26 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
| @@ -3504,6 +3504,18 @@ static void bc_parse_pushNUM(BcParse *p) | |||
| 3504 | bc_parse_pushIndex(p, idx); | 3504 | bc_parse_pushIndex(p, idx); |
| 3505 | } | 3505 | } |
| 3506 | 3506 | ||
| 3507 | static BC_STATUS bc_parse_pushSTR(BcParse *p) | ||
| 3508 | { | ||
| 3509 | char *str = xstrdup(p->l.t.v.v); | ||
| 3510 | |||
| 3511 | bc_parse_push(p, BC_INST_STR); | ||
| 3512 | bc_parse_pushIndex(p, G.prog.strs.len); | ||
| 3513 | bc_vec_push(&G.prog.strs, &str); | ||
| 3514 | |||
| 3515 | RETURN_STATUS(zbc_lex_next(&p->l)); | ||
| 3516 | } | ||
| 3517 | #define bc_parse_pushSTR(...) (bc_parse_pushSTR(__VA_ARGS__) COMMA_SUCCESS) | ||
| 3518 | |||
| 3507 | IF_BC(static BC_STATUS zbc_parse_stmt_or_funcdef(BcParse *p);) | 3519 | IF_BC(static BC_STATUS zbc_parse_stmt_or_funcdef(BcParse *p);) |
| 3508 | IF_DC(static BC_STATUS zdc_parse_parse(BcParse *p);) | 3520 | IF_DC(static BC_STATUS zdc_parse_parse(BcParse *p);) |
| 3509 | 3521 | ||
| @@ -3994,19 +4006,6 @@ static BC_STATUS zbc_parse_minus(BcParse *p, BcInst *prev, size_t ops_bgn, | |||
| 3994 | } | 4006 | } |
| 3995 | #define zbc_parse_minus(...) (zbc_parse_minus(__VA_ARGS__) COMMA_SUCCESS) | 4007 | #define zbc_parse_minus(...) (zbc_parse_minus(__VA_ARGS__) COMMA_SUCCESS) |
| 3996 | 4008 | ||
| 3997 | static BC_STATUS zbc_parse_string(BcParse *p, char inst) | ||
| 3998 | { | ||
| 3999 | char *str = xstrdup(p->l.t.v.v); | ||
| 4000 | |||
| 4001 | bc_parse_push(p, BC_INST_STR); | ||
| 4002 | bc_parse_pushIndex(p, G.prog.strs.len); | ||
| 4003 | bc_vec_push(&G.prog.strs, &str); | ||
| 4004 | bc_parse_push(p, inst); | ||
| 4005 | |||
| 4006 | RETURN_STATUS(zbc_lex_next(&p->l)); | ||
| 4007 | } | ||
| 4008 | #define zbc_parse_string(...) (zbc_parse_string(__VA_ARGS__) COMMA_SUCCESS) | ||
| 4009 | |||
| 4010 | static BC_STATUS zbc_parse_print(BcParse *p) | 4009 | static BC_STATUS zbc_parse_print(BcParse *p) |
| 4011 | { | 4010 | { |
| 4012 | BcStatus s; | 4011 | BcStatus s; |
| @@ -4017,12 +4016,12 @@ static BC_STATUS zbc_parse_print(BcParse *p) | |||
| 4017 | if (s) RETURN_STATUS(s); | 4016 | if (s) RETURN_STATUS(s); |
| 4018 | type = p->l.t.t; | 4017 | type = p->l.t.t; |
| 4019 | if (type == BC_LEX_STR) { | 4018 | if (type == BC_LEX_STR) { |
| 4020 | s = zbc_parse_string(p, BC_INST_PRINT_POP); | 4019 | s = bc_parse_pushSTR(p); |
| 4021 | } else { | 4020 | } else { |
| 4022 | s = zbc_parse_expr(p, 0); | 4021 | s = zbc_parse_expr(p, 0); |
| 4023 | bc_parse_push(p, BC_INST_PRINT_POP); | ||
| 4024 | } | 4022 | } |
| 4025 | if (s) RETURN_STATUS(s); | 4023 | if (s) RETURN_STATUS(s); |
| 4024 | bc_parse_push(p, BC_INST_PRINT_POP); | ||
| 4026 | if (p->l.t.t != BC_LEX_COMMA) | 4025 | if (p->l.t.t != BC_LEX_COMMA) |
| 4027 | break; | 4026 | break; |
| 4028 | } | 4027 | } |
| @@ -4472,7 +4471,8 @@ static BC_STATUS zbc_parse_stmt_possibly_auto(BcParse *p, bool auto_allowed) | |||
| 4472 | s = zbc_parse_expr(p, BC_PARSE_PRINT); | 4471 | s = zbc_parse_expr(p, BC_PARSE_PRINT); |
| 4473 | break; | 4472 | break; |
| 4474 | case BC_LEX_STR: | 4473 | case BC_LEX_STR: |
| 4475 | s = zbc_parse_string(p, BC_INST_PRINT_STR); | 4474 | s = bc_parse_pushSTR(p); |
| 4475 | bc_parse_push(p, BC_INST_PRINT_STR); | ||
| 4476 | break; | 4476 | break; |
| 4477 | case BC_LEX_KEY_BREAK: | 4477 | case BC_LEX_KEY_BREAK: |
| 4478 | case BC_LEX_KEY_CONTINUE: | 4478 | case BC_LEX_KEY_CONTINUE: |
