Reduce code duplication.
[gnulib.git] / lib / strptime.c
index 9373b45..a8791cf 100644 (file)
 
 #ifndef _LIBC
 # include <config.h>
-# include "strptime.h"
 #endif
 
+#include <time.h>
+
 #include <assert.h>
 #include <ctype.h>
 #ifdef _LIBC
@@ -27,7 +28,6 @@
 #endif
 #include <limits.h>
 #include <string.h>
-#include <time.h>
 #include <stdbool.h>
 
 #ifdef _LIBC
@@ -35,7 +35,6 @@
 #endif
 
 #ifndef _LIBC
-# include "time_r.h"
 enum ptime_locale_status { not, loc, raw };
 #endif
 
@@ -669,13 +668,16 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
             specify hours.  If fours digits are used, minutes are
             also specified.  */
          {
+           bool neg;
+           int n;
+
            val = 0;
            while (*rp == ' ')
              ++rp;
            if (*rp != '+' && *rp != '-')
              return NULL;
-           bool neg = *rp++ == '-';
-           int n = 0;
+           neg = *rp++ == '-';
+           n = 0;
            while (n < 4 && *rp >= '0' && *rp <= '9')
              {
                val = val * 10 + *rp++ - '0';