bc: simplify zdc_parse_string()
function old new delta bc_program_index 64 66 +2 zdc_parse_expr 671 656 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-15) Total: -13 bytes text data bss dec hex filename 981667 485 7296 989448 f1908 busybox_old 981655 485 7296 989436 f18fc busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@ -4798,8 +4798,6 @@ static BC_STATUS zbc_parse_expr(BcParse *p, uint8_t flags, BcParseNext next)
|
|||||||
|
|
||||||
#if ENABLE_DC
|
#if ENABLE_DC
|
||||||
|
|
||||||
#define DC_PARSE_BUF_LEN ((int) (sizeof(uint32_t) * CHAR_BIT))
|
|
||||||
|
|
||||||
static BC_STATUS zdc_parse_register(BcParse *p)
|
static BC_STATUS zdc_parse_register(BcParse *p)
|
||||||
{
|
{
|
||||||
BcStatus s;
|
BcStatus s;
|
||||||
@ -4816,11 +4814,11 @@ static BC_STATUS zdc_parse_register(BcParse *p)
|
|||||||
|
|
||||||
static BC_STATUS zdc_parse_string(BcParse *p)
|
static BC_STATUS zdc_parse_string(BcParse *p)
|
||||||
{
|
{
|
||||||
char *str, *name, b[DC_PARSE_BUF_LEN + 1];
|
char *str, *name;
|
||||||
size_t idx, len = G.prog.strs.len;
|
size_t idx, len = G.prog.strs.len;
|
||||||
|
|
||||||
sprintf(b, "%0*zu", DC_PARSE_BUF_LEN, len);
|
//why pad to 32 zeros??
|
||||||
name = xstrdup(b);
|
name = xasprintf("%032lu", (unsigned long)len);
|
||||||
|
|
||||||
str = xstrdup(p->l.t.v.v);
|
str = xstrdup(p->l.t.v.v);
|
||||||
bc_parse_push(p, BC_INST_STR);
|
bc_parse_push(p, BC_INST_STR);
|
||||||
|
Reference in New Issue
Block a user