gzip: pacify clang
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 7 Mar 2016 00:47:22 +0000 (16:47 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 7 Mar 2016 00:47:53 +0000 (16:47 -0800)
* 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

diff --git a/gzip.c b/gzip.c
index 1618f19c5e148597f6af9c1916af22aa1bc4af3b..61b19fb0038ed0402b441467115326502e0fc5b9 100644 (file)
--- 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 ("??? ?? ??:?? ");