]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Permit use of vsprintf() in PostgreSQL code.
authorNoah Misch <noah@leadboat.com>
Mon, 18 May 2015 14:02:31 +0000 (10:02 -0400)
committerNoah Misch <noah@leadboat.com>
Mon, 18 May 2015 14:02:38 +0000 (10:02 -0400)
The next commit needs it.  Back-patch to 9.0 (all supported versions).

src/include/port.h
src/port/snprintf.c

index 74da77ca39e0c389a3829add145b1cea3e31d2bc..6bcb8ae7e81ee30920f8a7c4841ed776fb25674e 100644 (file)
@@ -161,6 +161,9 @@ extern unsigned char pg_tolower(unsigned char ch);
 #ifdef snprintf
 #undef snprintf
 #endif
+#ifdef vsprintf
+#undef vsprintf
+#endif
 #ifdef sprintf
 #undef sprintf
 #endif
@@ -179,6 +182,7 @@ extern int
 pg_snprintf(char *str, size_t count, const char *fmt,...)
 /* This extension allows gcc to check the format string */
 __attribute__((format(printf, 3, 4)));
+extern int     pg_vsprintf(char *str, const char *fmt, va_list args);
 extern int
 pg_sprintf(char *str, const char *fmt,...)
 /* This extension allows gcc to check the format string */
@@ -201,6 +205,7 @@ __attribute__((format(printf, 1, 2)));
 #ifdef __GNUC__
 #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
 #define snprintf(...)  pg_snprintf(__VA_ARGS__)
+#define vsprintf(...)  pg_vsprintf(__VA_ARGS__)
 #define sprintf(...)   pg_sprintf(__VA_ARGS__)
 #define vfprintf(...)  pg_vfprintf(__VA_ARGS__)
 #define fprintf(...)   pg_fprintf(__VA_ARGS__)
@@ -208,6 +213,7 @@ __attribute__((format(printf, 1, 2)));
 #else
 #define vsnprintf              pg_vsnprintf
 #define snprintf               pg_snprintf
+#define vsprintf               pg_vsprintf
 #define sprintf                        pg_sprintf
 #define vfprintf               pg_vfprintf
 #define fprintf                        pg_fprintf
index 5c03ea6fd2e475abe8660ff35a32aa5d528d4278..1fd91a36e8fe0acf25f681b0bf5b7674ee9f54b6 100644 (file)
@@ -99,6 +99,7 @@
 /* Prevent recursion */
 #undef vsnprintf
 #undef snprintf
+#undef vsprintf
 #undef sprintf
 #undef vfprintf
 #undef fprintf
@@ -178,7 +179,7 @@ pg_snprintf(char *str, size_t count, const char *fmt,...)
        return len;
 }
 
-static int
+int
 pg_vsprintf(char *str, const char *fmt, va_list args)
 {
        PrintfTarget target;