>From 06b1a911a8b949cb1ea0226e9c2e8dfe2464fafe Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 6 Mar 2016 16:47:22 -0800 Subject: [PATCH] gzip: pacify clang * gzip.c (do_list): Use 2D array of char for month abbreviations, as this is clearer anyway, and it pacifies Clang. Problem reported by Assaf Gordon in: http://bugs.gnu.org/22900#40 --- gzip.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gzip.c b/gzip.c index 1618f19..61b19fb 100644 --- a/gzip.c +++ b/gzip.c @@ -1762,12 +1762,13 @@ local void do_list(ifd, method) if (verbose) { + static char const month_abbr[][4] + = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; struct tm *tm = localtime (&time_stamp.tv_sec); printf ("%5s %08lx ", methods[method], crc); if (tm) - printf ("%s%3d %02d:%02d ", - ("Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec" - + 4 * tm->tm_mon), + printf ("%s%3d %02d:%02d ", month_abbr[tm->tm_mon], tm->tm_mday, tm->tm_hour, tm->tm_min); else printf ("??? ?? ??:?? "); -- 2.5.0