mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Fix omissions in snprintf.c's coverage of standard *printf functions.
A warning on a NetBSD box revealed to me that pg_waldump/compat.c is using vprintf(), which snprintf.c did not provide coverage for. This is not good if we want to have uniform *printf behavior, and it's pretty silly to omit when it's a one-line function. I also noted that snprintf.c has pg_vsprintf() but for some reason it was not exposed to the outside world, creating another way in which code might accidentally invoke the platform *printf family. Let's just make sure that we replace all eight of the POSIX-standard printf family. Also, upgrade plperl.h and plpython.h to make sure that they do their undefine/redefine rain dance for all eight, not some random maybe-sufficient subset thereof.
This commit is contained in:
@ -102,9 +102,11 @@
|
||||
/* Prevent recursion */
|
||||
#undef vsnprintf
|
||||
#undef snprintf
|
||||
#undef vsprintf
|
||||
#undef sprintf
|
||||
#undef vfprintf
|
||||
#undef fprintf
|
||||
#undef vprintf
|
||||
#undef printf
|
||||
|
||||
/*
|
||||
@ -208,7 +210,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;
|
||||
@ -270,6 +272,12 @@ pg_fprintf(FILE *stream, const char *fmt,...)
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
pg_vprintf(const char *fmt, va_list args)
|
||||
{
|
||||
return pg_vfprintf(stdout, fmt, args);
|
||||
}
|
||||
|
||||
int
|
||||
pg_printf(const char *fmt,...)
|
||||
{
|
||||
|
Reference in New Issue
Block a user