aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-10-08 19:15:55 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-10-08 19:15:55 -0400
commit7767aadd94cd252a12fa00f6122ad4dd10455791 (patch)
tree45e9ef585c1a9023ddb78995b76782b4d61e282d /src/pl/plperl/plperl.h
parent82ff0cc91d9840d1c56ca1beed58bedfde3da9a3 (diff)
downloadpostgresql-7767aadd94cd252a12fa00f6122ad4dd10455791.tar.gz
postgresql-7767aadd94cd252a12fa00f6122ad4dd10455791.zip
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.
Diffstat (limited to 'src/pl/plperl/plperl.h')
-rw-r--r--src/pl/plperl/plperl.h40
1 files changed, 35 insertions, 5 deletions
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index 2b733546c37..12fbad97873 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -29,8 +29,14 @@
* Sometimes perl carefully scribbles on our *printf macros.
* So we undefine them here and redefine them after it's done its dirty deed.
*/
-#undef snprintf
#undef vsnprintf
+#undef snprintf
+#undef vsprintf
+#undef sprintf
+#undef vfprintf
+#undef fprintf
+#undef vprintf
+#undef printf
/*
* ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
@@ -89,21 +95,45 @@
#undef socket
#undef stat
#undef unlink
-#undef vfprintf
#endif
#include "XSUB.h"
#endif
-/* put back our snprintf and vsnprintf */
+/* put back our *printf macros ... this must match src/include/port.h */
+#ifdef vsnprintf
+#undef vsnprintf
+#endif
#ifdef snprintf
#undef snprintf
#endif
-#ifdef vsnprintf
-#undef vsnprintf
+#ifdef vsprintf
+#undef vsprintf
+#endif
+#ifdef sprintf
+#undef sprintf
+#endif
+#ifdef vfprintf
+#undef vfprintf
#endif
+#ifdef fprintf
+#undef fprintf
+#endif
+#ifdef vprintf
+#undef vprintf
+#endif
+#ifdef printf
+#undef printf
+#endif
+
#define vsnprintf pg_vsnprintf
#define snprintf pg_snprintf
+#define vsprintf pg_vsprintf
+#define sprintf pg_sprintf
+#define vfprintf pg_vfprintf
+#define fprintf pg_fprintf
+#define vprintf pg_vprintf
+#define printf(...) pg_printf(__VA_ARGS__)
/* perl version and platform portability */
#define NEED_eval_pv