Suppress a warning that some versions of gcc emit about %x in strftime.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 11 Jul 2007 23:15:38 +0000 (23:15 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 11 Jul 2007 23:15:38 +0000 (23:15 +0000)
Per suggestion from Alvaro.

src/bin/initdb/initdb.c

index 71e3b4588dfcbbc66b75efa018b8f44737a25c50..796e07c65c8355c74dc8f63e73cf889637d2d1b7 100644 (file)
@@ -2155,6 +2155,13 @@ escape_quotes(const char *src)
        return result;
 }
 
+/* Hack to suppress a warning about %x from some versions of gcc */
+static inline size_t
+my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
+{
+       return strftime(s, max, fmt, tm);
+}
+
 /*
  * Determine likely date order from locale
  */
@@ -2184,7 +2191,7 @@ locale_date_order(const char *locale)
        testtime.tm_mon = 10;           /* November, should come out as "11" */
        testtime.tm_year = 133;         /* 2033 */
 
-       res = strftime(buf, sizeof(buf), "%x", &testtime);
+       res = my_strftime(buf, sizeof(buf), "%x", &testtime);
 
        setlocale(LC_TIME, save);
        free(save);