From 2405ad659e2596b17c88e7b950c086159d06cc6e Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 19 Jan 2007 21:24:17 +0000 Subject: ls: use get_cached_username/groupname --- coreutils/ls.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'coreutils') diff --git a/coreutils/ls.c b/coreutils/ls.c index ae28f64..ff0831d 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -291,7 +291,7 @@ static void dfree(struct dnode **dnp, int nfiles) free(dnp); /* free the array holding the dnode pointers */ } #else -#define dfree(...) do {} while (0) +#define dfree(...) ((void)0) #endif static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) @@ -375,7 +375,7 @@ static void dnsort(struct dnode **dn, int size) qsort(dn, size, sizeof(*dn), sortcmp); } #else -#define dnsort(dn, size) do {} while (0) +#define dnsort(dn, size) ((void)0) #endif @@ -541,9 +541,6 @@ static int list_single(struct dnode *dn) { int i, column = 0; -#if ENABLE_FEATURE_LS_USERNAME - char scratch[16]; -#endif #if ENABLE_FEATURE_LS_TIMESTAMPS char *filetime; time_t ttime, age; @@ -584,10 +581,9 @@ static int list_single(struct dnode *dn) break; case LIST_ID_NAME: #if ENABLE_FEATURE_LS_USERNAME - bb_getpwuid(scratch, dn->dstat.st_uid, sizeof(scratch)); - printf("%-8.8s ", scratch); - bb_getgrgid(scratch, dn->dstat.st_gid, sizeof(scratch)); - printf("%-8.8s", scratch); + printf("%-8.8s %-8.8s", + get_cached_username(dn->dstat.st_uid), + get_cached_groupname(dn->dstat.st_gid)); column += 17; break; #endif -- cgit v1.1