Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 05c4d8f

Browse files
committed
Suppress a warning that some versions of gcc emit about %x in strftime.
Per suggestion from Alvaro.
1 parent 31013db commit 05c4d8f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/bin/initdb/initdb.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.137 2007/05/31 15:13:03 petere Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.138 2007/07/11 23:15:38 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -2155,6 +2155,13 @@ escape_quotes(const char *src)
21552155
return result;
21562156
}
21572157

2158+
/* Hack to suppress a warning about %x from some versions of gcc */
2159+
static inline size_t
2160+
my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
2161+
{
2162+
return strftime(s, max, fmt, tm);
2163+
}
2164+
21582165
/*
21592166
* Determine likely date order from locale
21602167
*/
@@ -2184,7 +2191,7 @@ locale_date_order(const char *locale)
21842191
testtime.tm_mon = 10; /* November, should come out as "11" */
21852192
testtime.tm_year = 133; /* 2033 */
21862193

2187-
res = strftime(buf, sizeof(buf), "%x", &testtime);
2194+
res = my_strftime(buf, sizeof(buf), "%x", &testtime);
21882195

21892196
setlocale(LC_TIME, save);
21902197
free(save);

0 commit comments

Comments
 (0)