summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Misch2015-05-18 14:02:31 +0000
committerNoah Misch2015-05-18 14:02:31 +0000
commitcac18a76bb6b08f1ecc2a85e46c9d2ab82dd9d23 (patch)
tree604d66a22a7a01e6d94c79174c9369dd01fa6c6d /src
parentb0ce385032d72d6acf1e330f733013553fe6affe (diff)
Permit use of vsprintf() in PostgreSQL code.
The next commit needs it. Back-patch to 9.0 (all supported versions).
Diffstat (limited to 'src')
-rw-r--r--src/include/port.h6
-rw-r--r--src/port/snprintf.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/include/port.h b/src/include/port.h
index 71113c03944..f9b4a16c0af 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -139,6 +139,9 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
#ifdef snprintf
#undef snprintf
#endif
+#ifdef vsprintf
+#undef vsprintf
+#endif
#ifdef sprintf
#undef sprintf
#endif
@@ -154,6 +157,7 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
+extern int pg_vsprintf(char *str, const char *fmt, va_list args);
extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
@@ -167,6 +171,7 @@ extern int pg_printf(const char *fmt,...) pg_attribute_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__)
@@ -174,6 +179,7 @@ extern int pg_printf(const char *fmt,...) pg_attribute_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
diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index 166374cabd6..0c779a601fc 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -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;