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:
@@ -89,13 +89,9 @@ struct in6_ifreq {
|
||||
/* Display an Internet socket address. */
|
||||
static const char* FAST_FUNC INET_sprint(struct sockaddr *sap, int numeric)
|
||||
{
|
||||
static char *buff; /* defaults to NULL */
|
||||
|
||||
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
|
||||
return "[NONE SET]";
|
||||
free(buff);
|
||||
buff = INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00);
|
||||
return buff;
|
||||
return auto_string(INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00));
|
||||
}
|
||||
|
||||
#ifdef UNUSED_AND_BUGGY
|
||||
@@ -171,13 +167,9 @@ static const struct aftype inet_aftype = {
|
||||
/* dirty! struct sockaddr usually doesn't suffer for inet6 addresses, fst. */
|
||||
static const char* FAST_FUNC INET6_sprint(struct sockaddr *sap, int numeric)
|
||||
{
|
||||
static char *buff;
|
||||
|
||||
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
|
||||
return "[NONE SET]";
|
||||
free(buff);
|
||||
buff = INET6_rresolve((struct sockaddr_in6 *) sap, numeric);
|
||||
return buff;
|
||||
return auto_string(INET6_rresolve((struct sockaddr_in6 *) sap, numeric));
|
||||
}
|
||||
|
||||
#ifdef UNUSED
|
||||
@@ -223,13 +215,11 @@ static const struct aftype inet6_aftype = {
|
||||
/* Display an UNSPEC address. */
|
||||
static char* FAST_FUNC UNSPEC_print(unsigned char *ptr)
|
||||
{
|
||||
static char *buff;
|
||||
|
||||
char *buff;
|
||||
char *pos;
|
||||
unsigned int i;
|
||||
|
||||
if (!buff)
|
||||
buff = xmalloc(sizeof(struct sockaddr) * 3 + 1);
|
||||
buff = auto_string(xmalloc(sizeof(struct sockaddr) * 3 + 1));
|
||||
pos = buff;
|
||||
for (i = 0; i < sizeof(struct sockaddr); i++) {
|
||||
/* careful -- not every libc's sprintf returns # bytes written */
|
||||
@@ -712,14 +702,12 @@ static const struct hwtype loop_hwtype = {
|
||||
/* Display an Ethernet address in readable format. */
|
||||
static char* FAST_FUNC ether_print(unsigned char *ptr)
|
||||
{
|
||||
static char *buff;
|
||||
|
||||
free(buff);
|
||||
char *buff;
|
||||
buff = xasprintf("%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
(ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
|
||||
(ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)
|
||||
);
|
||||
return buff;
|
||||
return auto_string(buff);
|
||||
}
|
||||
|
||||
static const struct hwtype ether_hwtype = {
|
||||
|
Reference in New Issue
Block a user