diff options
author | Denys Vlasenko | 2021-09-17 01:13:58 +0200 |
---|---|---|
committer | Denys Vlasenko | 2021-09-17 01:18:31 +0200 |
commit | 59ac467dc6429a48522ef7fbe40fcd819563e49a (patch) | |
tree | 4b6af971b0ffc516294ff35ba7b5c1e99c6eadae /coreutils/stat.c | |
parent | 4958c18134eb7ad169cdaf22a9ad957ad4f4858c (diff) | |
download | busybox-59ac467dc6429a48522ef7fbe40fcd819563e49a.zip busybox-59ac467dc6429a48522ef7fbe40fcd819563e49a.tar.gz |
libbb: eliminate a static data array in bb_mode_string()
function old new delta
print_stat 861 869 +8
header_verbose_list_ar 73 77 +4
display_single 975 979 +4
header_verbose_list 237 239 +2
bb_mode_string 124 115 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 18/-9) Total: 9 bytes
text data bss dec hex filename
1043136 559 5052 1048747 1000ab busybox_old
1043153 559 5020 1048732 10009c busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/stat.c')
-rw-r--r-- | coreutils/stat.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c index a839346..2c2909e 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -339,7 +339,8 @@ static void FAST_FUNC print_stat(char *pformat, const char m, strcat(pformat, "lo"); printf(pformat, (unsigned long) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO))); } else if (m == 'A') { - printfs(pformat, bb_mode_string(statbuf->st_mode)); + char modestr[12]; + printfs(pformat, bb_mode_string(modestr, statbuf->st_mode)); } else if (m == 'f') { strcat(pformat, "lx"); printf(pformat, (unsigned long) statbuf->st_mode); @@ -702,6 +703,7 @@ static bool do_stat(const char *filename, const char *format) bb_putchar('\n'); # endif } else { + char modestr[12]; char *linkname = NULL; struct passwd *pw_ent; struct group *gw_ent; @@ -736,7 +738,7 @@ static bool do_stat(const char *filename, const char *format) bb_putchar('\n'); printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n", (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)), - bb_mode_string(statbuf.st_mode), + bb_mode_string(modestr, statbuf.st_mode), (unsigned long) statbuf.st_uid, (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN", (unsigned long) statbuf.st_gid, |