summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2018-12-19 19:10:40 +0100
committerDenys Vlasenko2018-12-19 19:10:40 +0100
commit44dbe675ddbcffb37e98358599610b5b81ea0644 (patch)
tree13782665a6a18a2bc55484caf36cfc820fe7ad17
parentea5cad2a0dc7ebbb7de0d1d49ae2b72e6fbd163a (diff)
downloadbusybox-44dbe675ddbcffb37e98358599610b5b81ea0644.zip
busybox-44dbe675ddbcffb37e98358599610b5b81ea0644.tar.gz
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>
-rw-r--r--miscutils/bc.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index c1601a3..6e15a8c 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -3504,6 +3504,18 @@ static void bc_parse_pushNUM(BcParse *p)
bc_parse_pushIndex(p, idx);
}
+static BC_STATUS bc_parse_pushSTR(BcParse *p)
+{
+ char *str = xstrdup(p->l.t.v.v);
+
+ bc_parse_push(p, BC_INST_STR);
+ bc_parse_pushIndex(p, G.prog.strs.len);
+ bc_vec_push(&G.prog.strs, &str);
+
+ RETURN_STATUS(zbc_lex_next(&p->l));
+}
+#define bc_parse_pushSTR(...) (bc_parse_pushSTR(__VA_ARGS__) COMMA_SUCCESS)
+
IF_BC(static BC_STATUS zbc_parse_stmt_or_funcdef(BcParse *p);)
IF_DC(static BC_STATUS zdc_parse_parse(BcParse *p);)
@@ -3994,19 +4006,6 @@ static BC_STATUS zbc_parse_minus(BcParse *p, BcInst *prev, size_t ops_bgn,
}
#define zbc_parse_minus(...) (zbc_parse_minus(__VA_ARGS__) COMMA_SUCCESS)
-static BC_STATUS zbc_parse_string(BcParse *p, char inst)
-{
- char *str = xstrdup(p->l.t.v.v);
-
- bc_parse_push(p, BC_INST_STR);
- bc_parse_pushIndex(p, G.prog.strs.len);
- bc_vec_push(&G.prog.strs, &str);
- bc_parse_push(p, inst);
-
- RETURN_STATUS(zbc_lex_next(&p->l));
-}
-#define zbc_parse_string(...) (zbc_parse_string(__VA_ARGS__) COMMA_SUCCESS)
-
static BC_STATUS zbc_parse_print(BcParse *p)
{
BcStatus s;
@@ -4017,12 +4016,12 @@ static BC_STATUS zbc_parse_print(BcParse *p)
if (s) RETURN_STATUS(s);
type = p->l.t.t;
if (type == BC_LEX_STR) {
- s = zbc_parse_string(p, BC_INST_PRINT_POP);
+ s = bc_parse_pushSTR(p);
} else {
s = zbc_parse_expr(p, 0);
- bc_parse_push(p, BC_INST_PRINT_POP);
}
if (s) RETURN_STATUS(s);
+ bc_parse_push(p, BC_INST_PRINT_POP);
if (p->l.t.t != BC_LEX_COMMA)
break;
}
@@ -4472,7 +4471,8 @@ static BC_STATUS zbc_parse_stmt_possibly_auto(BcParse *p, bool auto_allowed)
s = zbc_parse_expr(p, BC_PARSE_PRINT);
break;
case BC_LEX_STR:
- s = zbc_parse_string(p, BC_INST_PRINT_STR);
+ s = bc_parse_pushSTR(p);
+ bc_parse_push(p, BC_INST_PRINT_STR);
break;
case BC_LEX_KEY_BREAK:
case BC_LEX_KEY_CONTINUE: