changeset 7524:066fb9a1e386

* 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.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 19 Oct 2006 07:32:18 +0000
parents 02a028c7f4ba
children 6a1cfd0adbc1
files ChangeLog lib/strftime.c
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -181,6 +181,12 @@
 # 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 @@
 		memset_space (p, _delta);				      \
 	    }								      \
 	  f;								      \
-	  p += FPRINTFTIME ? 0 : _n;					      \
+	  advance (p, _n);						      \
 	}								      \
       i += _incr;							      \
     } while (0)