* lib/strftime.c (advance): New macro.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 19 Oct 2006 07:32:18 +0000 (07:32 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 19 Oct 2006 07:32:18 +0000 (07:32 +0000)
(add): Use it to avoid adding 0 to a FILE *.  FILE can be
an incomplete type, so you can't add 0 to it.  Problem reported
by Eelco Dolstra for dietlibc.

ChangeLog
lib/strftime.c

index f86a64e5c71ff4049c13dbae25bbba130aeea389..773c3bdc3b2e481e4723b0310dec3deced360268 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lib/strftime.c (advance): New macro.
+       (add): Use it to avoid adding 0 to a FILE *.  FILE can be
+       an incomplete type, so you can't add 0 to it.  Problem reported
+       by Eelco Dolstra for dietlibc.
+
 2006-10-18  Jim Meyering  <jim@meyering.net>
 
        * lib/readutmp.c (desirable_utmp_entry): Use "bool" as the
index ffa51c0cc3f2a1aedff2a48bb582c1c48d9c0ed8..d24b4cade92c3cd34bac0b5f29aeff7176ee48cf 100644 (file)
@@ -181,6 +181,12 @@ extern char *tzname[];
 # define memset_zero(P, Len) (memset (P, '0', Len), (P) += (Len))
 #endif
 
+#if FPRINTFTIME
+# define advance(P, N)
+#else
+# define advance(P, N) ((P) += (N))
+#endif
+
 #define add(n, f)                                                            \
   do                                                                         \
     {                                                                        \
@@ -199,7 +205,7 @@ extern char *tzname[];
                memset_space (p, _delta);                                     \
            }                                                                 \
          f;                                                                  \
-         p += FPRINTFTIME ? 0 : _n;                                          \
+         advance (p, _n);                                                    \
        }                                                                     \
       i += _incr;                                                            \
     } while (0)