diff options
author | Denys Vlasenko | 2015-10-09 18:16:40 +0200 |
---|---|---|
committer | Denys Vlasenko | 2015-10-09 18:16:40 +0200 |
commit | 02859aaeb29fb83167364291f1ce26b54c23803b (patch) | |
tree | 93a30e982b81e3bde6af8800bcd0c8f3f0080f52 /miscutils | |
parent | e52da5570eb93d6cb2950e55c48bd22edb5a9f18 (diff) | |
download | busybox-02859aaeb29fb83167364291f1ce26b54c23803b.zip busybox-02859aaeb29fb83167364291f1ce26b54c23803b.tar.gz |
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>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/devfsd.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 5a6aec6..9256567 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -1142,19 +1142,19 @@ static void signal_handler(int sig) static const char *get_variable(const char *variable, void *info) { - static char sbuf[sizeof(int)*3 + 2]; /* sign and NUL */ static char *hostname; struct get_variable_info *gv_info = info; const char *field_names[] = { - "hostname", "mntpt", "devpath", "devname", - "uid", "gid", "mode", hostname, mount_point, - gv_info->devpath, gv_info->devname, NULL + "hostname", "mntpt", "devpath", "devname", "uid", "gid", "mode", + NULL, mount_point, gv_info->devpath, gv_info->devname, NULL }; int i; if (!hostname) hostname = safe_gethostname(); + field_names[7] = hostname; + /* index_in_str_array returns i>=0 */ i = index_in_str_array(field_names, variable); @@ -1164,12 +1164,11 @@ static const char *get_variable(const char *variable, void *info) return field_names[i + 7]; if (i == 4) - sprintf(sbuf, "%u", gv_info->info->uid); - else if (i == 5) - sprintf(sbuf, "%u", gv_info->info->gid); - else if (i == 6) - sprintf(sbuf, "%o", gv_info->info->mode); - return sbuf; + return auto_string(xasprintf("%u", gv_info->info->uid)); + if (i == 5) + return auto_string(xasprintf("%u", gv_info->info->gid)); + /* i == 6 */ + return auto_string(xasprintf("%o", gv_info->info->mode)); } /* End Function get_variable */ static void service(struct stat statbuf, char *path) |