Content-Length: 340439 | pFad | http://github.com/postgrespro/postgres/commit/b544dcdad219cbd14837b149f63e3703952c992f

3E Permit use of vsprintf() in PostgreSQL code. · postgrespro/postgres@b544dcd · GitHub
Skip to content

Commit b544dcd

Browse files
committed
Permit use of vsprintf() in PostgreSQL code.
The next commit needs it. Back-patch to 9.0 (all supported versions).
1 parent 6675ab5 commit b544dcd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/include/port.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
168168
#ifdef snprintf
169169
#undef snprintf
170170
#endif
171+
#ifdef vsprintf
172+
#undef vsprintf
173+
#endif
171174
#ifdef sprintf
172175
#undef sprintf
173176
#endif
@@ -186,6 +189,7 @@ extern int
186189
pg_snprintf(char *str, size_t count, const char *fmt,...)
187190
/* This extension allows gcc to check the format string */
188191
__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
192+
extern int pg_vsprintf(char *str, const char *fmt, va_list args);
189193
extern int
190194
pg_sprintf(char *str, const char *fmt,...)
191195
/* This extension allows gcc to check the format string */
@@ -208,13 +212,15 @@ __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
208212
#ifdef __GNUC__
209213
#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
210214
#define snprintf(...) pg_snprintf(__VA_ARGS__)
215+
#define vsprintf(...) pg_vsprintf(__VA_ARGS__)
211216
#define sprintf(...) pg_sprintf(__VA_ARGS__)
212217
#define vfprintf(...) pg_vfprintf(__VA_ARGS__)
213218
#define fprintf(...) pg_fprintf(__VA_ARGS__)
214219
#define printf(...) pg_printf(__VA_ARGS__)
215220
#else
216221
#define vsnprintf pg_vsnprintf
217222
#define snprintf pg_snprintf
223+
#define vsprintf pg_vsprintf
218224
#define sprintf pg_sprintf
219225
#define vfprintf pg_vfprintf
220226
#define fprintf pg_fprintf

src/port/snprintf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
/* Prevent recursion */
100100
#undef vsnprintf
101101
#undef snprintf
102+
#undef vsprintf
102103
#undef sprintf
103104
#undef vfprintf
104105
#undef fprintf
@@ -178,7 +179,7 @@ pg_snprintf(char *str, size_t count, const char *fmt,...)
178179
return len;
179180
}
180181

181-
static int
182+
int
182183
pg_vsprintf(char *str, const char *fmt, va_list args)
183184
{
184185
PrintfTarget target;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/b544dcdad219cbd14837b149f63e3703952c992f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy