From: Paul Eggert Date: Mon, 7 Mar 2016 00:47:22 +0000 (-0800) Subject: gzip: pacify clang X-Git-Tag: v1.7~11 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=8d506e2b4b308b159daa010a9ee8227e23eb9138;p=debian%2Fgzip 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 --- 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 ("??? ?? ??:?? ");