Pádraig Brady wrote: > Updated patch attached. > > Note caching the abbreviated months like this speeds `ls -l` > up by around 10% which is nice, though not that important > as ls output is mainly for processing by humans.
eep, previous patch had a few buglets... diff --git a/src/ls.c b/src/ls.c index 74ee2ca..91426da 100644 --- a/src/ls.c +++ b/src/ls.c @@ -3378,10 +3378,10 @@ align_nstrftime (char *src, size_t size, char const *fmt, struct tm const *tm, { const char *nfmt = fmt; char *rpl_fmt = NULL; - if (required_mon_width) + char *pb = NULL; + if (required_mon_width && (pb = strstr (fmt, "%b"))) { - rpl_fmt = xmalloc (strlen (fmt) + MAX_MON_WIDTH - 2 + 1); - char *pb = strstr (fmt, "%b"); + rpl_fmt = xmalloc (strlen (fmt) -2 + sizeof (abmon[0])); char *pfmt = rpl_fmt; nfmt = rpl_fmt; _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils