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>
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 @@
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 @@
}
#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 @@
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 @@
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: