Skip to content

Commit cac18a7

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 b0ce385 commit cac18a7

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
@@ -139,6 +139,9 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
139139
#ifdef snprintf
140140
#undef snprintf
141141
#endif
142+
#ifdef vsprintf
143+
#undef vsprintf
144+
#endif
142145
#ifdef sprintf
143146
#undef sprintf
144147
#endif
@@ -154,6 +157,7 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
154157

155158
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
156159
extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
160+
extern int pg_vsprintf(char *str, const char *fmt, va_list args);
157161
extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
158162
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
159163
extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
@@ -167,13 +171,15 @@ extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
167171
#ifdef __GNUC__
168172
#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
169173
#define snprintf(...) pg_snprintf(__VA_ARGS__)
174+
#define vsprintf(...) pg_vsprintf(__VA_ARGS__)
170175
#define sprintf(...) pg_sprintf(__VA_ARGS__)
171176
#define vfprintf(...) pg_vfprintf(__VA_ARGS__)
172177
#define fprintf(...) pg_fprintf(__VA_ARGS__)
173178
#define printf(...) pg_printf(__VA_ARGS__)
174179
#else
175180
#define vsnprintf pg_vsnprintf
176181
#define snprintf pg_snprintf
182+
#define vsprintf pg_vsprintf
177183
#define sprintf pg_sprintf
178184
#define vfprintf pg_vfprintf
179185
#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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy