diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-02-18 11:29:07 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-02-18 11:29:07 +0100 |
commit | 0cb981c5e2f1a955e72dd9d3d2fad075dc9d0da6 (patch) | |
tree | 76ae63be112b20d74b5fcdfd53e16604ec735797 /coreutils | |
parent | 70e30e8eec7f202cb584449e4c7a9176d57d980d (diff) | |
download | busybox-w32-0cb981c5e2f1a955e72dd9d3d2fad075dc9d0da6.tar.gz busybox-w32-0cb981c5e2f1a955e72dd9d3d2fad075dc9d0da6.tar.bz2 busybox-w32-0cb981c5e2f1a955e72dd9d3d2fad075dc9d0da6.zip |
ls: trivial code shrink
function old new delta
display_single 914 893 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index a30422a8c..366758351 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -566,12 +566,12 @@ static NOINLINE unsigned display_single(const struct dnode *dn) | |||
566 | #if ENABLE_FEATURE_LS_TIMESTAMPS | 566 | #if ENABLE_FEATURE_LS_TIMESTAMPS |
567 | if (G.all_fmt & (LIST_FULLTIME|LIST_DATE_TIME)) { | 567 | if (G.all_fmt & (LIST_FULLTIME|LIST_DATE_TIME)) { |
568 | char *filetime; | 568 | char *filetime; |
569 | time_t ttime = dn->dn_mtime; | 569 | time_t *ttime = &dn->dn_mtime; |
570 | if (G.all_fmt & TIME_ACCESS) | 570 | if (G.all_fmt & TIME_ACCESS) |
571 | ttime = dn->dn_atime; | 571 | ttime = &dn->dn_atime; |
572 | if (G.all_fmt & TIME_CHANGE) | 572 | if (G.all_fmt & TIME_CHANGE) |
573 | ttime = dn->dn_ctime; | 573 | ttime = &dn->dn_ctime; |
574 | filetime = ctime(&ttime); | 574 | filetime = ctime(ttime); |
575 | /* filetime's format: "Wed Jun 30 21:49:08 1993\n" */ | 575 | /* filetime's format: "Wed Jun 30 21:49:08 1993\n" */ |
576 | if (G.all_fmt & LIST_FULLTIME) { /* -e */ | 576 | if (G.all_fmt & LIST_FULLTIME) { /* -e */ |
577 | /* Note: coreutils 8.4 ls --full-time prints: | 577 | /* Note: coreutils 8.4 ls --full-time prints: |
@@ -580,7 +580,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn) | |||
580 | column += printf("%.24s ", filetime); | 580 | column += printf("%.24s ", filetime); |
581 | } else { /* LIST_DATE_TIME */ | 581 | } else { /* LIST_DATE_TIME */ |
582 | /* G.current_time_t ~== time(NULL) */ | 582 | /* G.current_time_t ~== time(NULL) */ |
583 | time_t age = G.current_time_t - ttime; | 583 | time_t age = G.current_time_t - *ttime; |
584 | if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) { | 584 | if (age < 3600L * 24 * 365 / 2 && age > -15 * 60) { |
585 | /* less than 6 months old */ | 585 | /* less than 6 months old */ |
586 | /* "mmm dd hh:mm " */ | 586 | /* "mmm dd hh:mm " */ |