* lib/mempcpy.c: Include <config.h> before <string.h>.
[gnulib.git] / lib / strftime.c
index 4a4ac06..3fce99b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
+/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C Library.
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #ifdef _LIBC
 # define HAVE_MBLEN 1
 # define HAVE_MBRLEN 1
 # define HAVE_TZSET 1
 # define MULTIBYTE_IS_FORMAT_SAFE 1
 # include "../locale/localeinfo.h"
+#else
+# include <config.h>
+# if FPRINTFTIME
+#  include "fprintftime.h"
+# endif
 #endif
 
 #include <ctype.h>
-#include <sys/types.h>         /* Some systems define `time_t' here.  */
+#include <time.h>
 
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
 #if HAVE_TZNAME && ! defined tzname
 extern char *tzname[];
 #endif
@@ -57,7 +48,7 @@ extern char *tzname[];
    conversion specifications.  The GNU C Library uses UTF8 multibyte
    encoding, which is safe for formats, but strftime.c can be used
    with other C libraries that use unsafe encodings.  */
-#define DO_MULTIBYTE (HAVE_MBLEN && HAVE_WCHAR_H && ! MULTIBYTE_IS_FORMAT_SAFE)
+#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
 
 #if DO_MULTIBYTE
 # if HAVE_MBRLEN
@@ -180,6 +171,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                                                                         \
     {                                                                        \
@@ -198,7 +195,7 @@ extern char *tzname[];
                memset_space (p, _delta);                                     \
            }                                                                 \
          f;                                                                  \
-         p += FPRINTFTIME ? 0 : _n;                                          \
+         advance (p, _n);                                                    \
        }                                                                     \
       i += _incr;                                                            \
     } while (0)