use auto_string() where appropriate to kill a few statics

Custom linker script 'busybox_ldscript' found, using it
function                                             old     new   delta
static.str                                             4       -      -4
static.passwd                                          4       0      -4
bb_ask                                               322     311     -11
ether_print                                           63      47     -16
UNSPEC_print                                          82      66     -16
INET_sprint                                           59      38     -21
INET6_sprint                                          54      30     -24
make_human_readable_str                              292     235     -57
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/7 up/down: 0/-153)           Total: -153 bytes
   text	   data	    bss	    dec	    hex	filename
 939880	    992	  17480	 958352	  e9f90	busybox_old
 939736	    992	  17456	 958184	  e9ee8	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2015-10-09 18:16:40 +02:00
parent e52da5570e
commit 02859aaeb2
4 changed files with 18 additions and 40 deletions

View File

@@ -1,7 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
* Ask for a password
* I use a static buffer in this function. Plan accordingly.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
@@ -23,8 +22,8 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt)
{
/* Was static char[BIGNUM] */
enum { sizeof_passwd = 128 };
static char *passwd;
char *passwd;
char *ret;
int i;
struct sigaction sa, oldsa;
@@ -62,8 +61,7 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt)
alarm(timeout);
}
if (!passwd)
passwd = xmalloc(sizeof_passwd);
passwd = auto_string(xmalloc(sizeof_passwd));
ret = passwd;
i = 0;
while (1) {