aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/c.h8
-rw-r--r--src/include/pg_config.h.in17
-rw-r--r--src/include/pg_config.h.win3217
-rw-r--r--src/include/port.h8
-rw-r--r--src/interfaces/ecpg/compatlib/Makefile3
-rw-r--r--src/interfaces/ecpg/ecpglib/Makefile4
-rw-r--r--src/interfaces/ecpg/pgtypeslib/Makefile4
-rw-r--r--src/interfaces/libpq/Makefile4
-rw-r--r--src/pl/plperl/plperl.h5
-rw-r--r--src/pl/plpython/plpython.h5
-rw-r--r--src/port/Makefile3
-rw-r--r--src/port/README2
12 files changed, 17 insertions, 63 deletions
diff --git a/src/include/c.h b/src/include/c.h
index 13c794d8eaa..25d7d6036d4 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1147,14 +1147,6 @@ typedef union PGAlignedXLogBlock
* standard C library.
*/
-#if !HAVE_DECL_SNPRINTF
-extern int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
-#endif
-
-#if !HAVE_DECL_VSNPRINTF
-extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
-#endif
-
#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
extern int fdatasync(int fildes);
#endif
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index e576831a715..7cabcd1e753 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -166,10 +166,6 @@
don't. */
#undef HAVE_DECL_RTLD_NOW
-/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_SNPRINTF
-
/* Define to 1 if you have the declaration of `strlcat', and to 0 if you
don't. */
#undef HAVE_DECL_STRLCAT
@@ -194,10 +190,6 @@
don't. */
#undef HAVE_DECL_SYS_SIGLIST
-/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
- don't. */
-#undef HAVE_DECL_VSNPRINTF
-
/* Define to 1 if you have the `dlopen' function. */
#undef HAVE_DLOPEN
@@ -510,9 +502,6 @@
/* Define to 1 if you have the `shm_open' function. */
#undef HAVE_SHM_OPEN
-/* Define to 1 if you have the `snprintf' function. */
-#undef HAVE_SNPRINTF
-
/* Define to 1 if you have spinlocks. */
#undef HAVE_SPINLOCKS
@@ -715,9 +704,6 @@
/* Define to 1 if you have the <uuid/uuid.h> header file. */
#undef HAVE_UUID_UUID_H
-/* Define to 1 if you have the `vsnprintf' function. */
-#undef HAVE_VSNPRINTF
-
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
@@ -926,9 +912,6 @@
/* Define to 1 to build with PAM support. (--with-pam) */
#undef USE_PAM
-/* Use replacement snprintf() functions. */
-#undef USE_REPL_SNPRINTF
-
/* Define to 1 to use software CRC-32C implementation (slicing-by-8). */
#undef USE_SLICING_BY_8_CRC32C
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index 536f06c38cb..45d47e996a0 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -135,10 +135,6 @@
don't. */
#define HAVE_DECL_RTLD_NOW 0
-/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
- don't. */
-#define HAVE_DECL_SNPRINTF 1
-
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
don't. */
#define HAVE_DECL_STRNLEN 1
@@ -151,10 +147,6 @@
don't. */
#define HAVE_DECL_STRTOULL 1
-/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
- don't. */
-#define HAVE_DECL_VSNPRINTF 1
-
/* Define to 1 if you have the `dlopen' function. */
/* #undef HAVE_DLOPEN */
@@ -376,9 +368,6 @@
/* Define to 1 if you have the `setsid' function. */
/* #undef HAVE_SETSID */
-/* Define to 1 if you have the `snprintf' function. */
-/* #undef HAVE_SNPRINTF */
-
/* Define to 1 if you have spinlocks. */
#define HAVE_SPINLOCKS 1
@@ -556,9 +545,6 @@
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
-/* Define to 1 if you have the `vsnprintf' function. */
-#define HAVE_VSNPRINTF 1
-
/* Define to 1 if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1
@@ -715,9 +701,6 @@
/* Define to 1 to build with PAM support. (--with-pam) */
/* #undef USE_PAM */
-/* Use replacement snprintf() functions. */
-#define USE_REPL_SNPRINTF 1
-
/* Define to 1 to use software CRC-32C implementation (slicing-by-8). */
#if (_MSC_VER < 1500)
#define USE_SLICING_BY_8_CRC32C 1
diff --git a/src/include/port.h b/src/include/port.h
index abbe1ad9a1a..597d05e5534 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -134,7 +134,12 @@ extern unsigned char pg_tolower(unsigned char ch);
extern unsigned char pg_ascii_toupper(unsigned char ch);
extern unsigned char pg_ascii_tolower(unsigned char ch);
-#ifdef USE_REPL_SNPRINTF
+/*
+ * Beginning in v12, we always replace snprintf() and friends with our own
+ * implementation. This symbol is no longer consulted by the core code,
+ * but keep it defined anyway in case any extensions are looking at it.
+ */
+#define USE_REPL_SNPRINTF 1
/*
* Versions of libintl >= 0.13 try to replace printf() and friends with
@@ -187,7 +192,6 @@ extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
#define fprintf pg_fprintf
#define printf pg_printf
#endif
-#endif /* USE_REPL_SNPRINTF */
/* Replace strerror() with our own, somewhat more robust wrapper */
extern char *pg_strerror(int errnum);
diff --git a/src/interfaces/ecpg/compatlib/Makefile b/src/interfaces/ecpg/compatlib/Makefile
index b7bd1629027..e07a7fa8134 100644
--- a/src/interfaces/ecpg/compatlib/Makefile
+++ b/src/interfaces/ecpg/compatlib/Makefile
@@ -31,7 +31,8 @@ SHLIB_EXPORTS = exports.txt
# Need to recompile any libpgport object files
LIBS := $(filter-out -lpgport, $(LIBS))
-OBJS= informix.o strerror.o $(filter snprintf.o strnlen.o, $(LIBOBJS)) $(WIN32RES)
+OBJS= informix.o snprintf.o strerror.o \
+ $(filter strnlen.o, $(LIBOBJS)) $(WIN32RES)
PKG_CONFIG_REQUIRES_PRIVATE = libecpg libpgtypes
diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile
index 005d25a2bcd..b381623f18e 100644
--- a/src/interfaces/ecpg/ecpglib/Makefile
+++ b/src/interfaces/ecpg/ecpglib/Makefile
@@ -26,8 +26,8 @@ override CFLAGS += $(PTHREAD_CFLAGS)
LIBS := $(filter-out -lpgport, $(LIBS))
OBJS= execute.o typename.o descriptor.o sqlda.o data.o error.o prepare.o memory.o \
- connect.o misc.o path.o pgstrcasecmp.o strerror.o \
- $(filter snprintf.o strlcpy.o strnlen.o win32setlocale.o isinf.o, $(LIBOBJS)) \
+ connect.o misc.o path.o pgstrcasecmp.o snprintf.o strerror.o \
+ $(filter strlcpy.o strnlen.o win32setlocale.o isinf.o, $(LIBOBJS)) \
$(WIN32RES)
# thread.c is needed only for non-WIN32 implementation of path.c
diff --git a/src/interfaces/ecpg/pgtypeslib/Makefile b/src/interfaces/ecpg/pgtypeslib/Makefile
index 18b2402d0f3..15d7f336640 100644
--- a/src/interfaces/ecpg/pgtypeslib/Makefile
+++ b/src/interfaces/ecpg/pgtypeslib/Makefile
@@ -30,8 +30,8 @@ SHLIB_LINK += $(filter -lm, $(LIBS))
SHLIB_EXPORTS = exports.txt
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
- pgstrcasecmp.o strerror.o \
- $(filter rint.o snprintf.o strnlen.o, $(LIBOBJS)) \
+ pgstrcasecmp.o snprintf.o strerror.o \
+ $(filter rint.o strnlen.o, $(LIBOBJS)) \
string.o \
$(WIN32RES)
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 8324f4f057d..a106088a9ff 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -36,9 +36,9 @@ OBJS= fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-l
libpq-events.o
# libpgport C files we always use
OBJS += chklocale.o inet_net_ntop.o noblock.o pgstrcasecmp.o pqsignal.o \
- strerror.o thread.o
+ snprintf.o strerror.o thread.o
# libpgport C files that are needed if identified by configure
-OBJS += $(filter crypt.o getaddrinfo.o getpeereid.o inet_aton.o open.o system.o snprintf.o strlcpy.o strnlen.o win32error.o win32setlocale.o, $(LIBOBJS))
+OBJS += $(filter crypt.o getaddrinfo.o getpeereid.o inet_aton.o open.o system.o strlcpy.o strnlen.o win32error.o win32setlocale.o, $(LIBOBJS))
ifeq ($(enable_strong_random), yes)
OBJS += pg_strong_random.o
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index e6241f03ea0..f8888a451ec 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -29,11 +29,8 @@
* Sometimes perl carefully scribbles on our *printf macros.
* So we undefine them here and redefine them after it's done its dirty deed.
*/
-
-#ifdef USE_REPL_SNPRINTF
#undef snprintf
#undef vsnprintf
-#endif
/*
* ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
@@ -99,7 +96,6 @@
#endif
/* put back our snprintf and vsnprintf */
-#ifdef USE_REPL_SNPRINTF
#ifdef snprintf
#undef snprintf
#endif
@@ -113,7 +109,6 @@
#define vsnprintf pg_vsnprintf
#define snprintf pg_snprintf
#endif /* __GNUC__ */
-#endif /* USE_REPL_SNPRINTF */
/* perl version and platform portability */
#define NEED_eval_pv
diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h
index 6cc323a568d..aefbfc2f82b 100644
--- a/src/pl/plpython/plpython.h
+++ b/src/pl/plpython/plpython.h
@@ -33,11 +33,8 @@
* Sometimes python carefully scribbles on our *printf macros.
* So we undefine them here and redefine them after it's done its dirty deed.
*/
-
-#ifdef USE_REPL_SNPRINTF
#undef snprintf
#undef vsnprintf
-#endif
#if defined(_MSC_VER) && defined(_DEBUG)
/* Python uses #pragma to bring in a non-default libpython on VC++ if
@@ -124,7 +121,6 @@ typedef int Py_ssize_t;
#include <eval.h>
/* put back our snprintf and vsnprintf */
-#ifdef USE_REPL_SNPRINTF
#ifdef snprintf
#undef snprintf
#endif
@@ -138,7 +134,6 @@ typedef int Py_ssize_t;
#define vsnprintf pg_vsnprintf
#define snprintf pg_snprintf
#endif /* __GNUC__ */
-#endif /* USE_REPL_SNPRINTF */
/*
* Used throughout, and also by the Python 2/3 porting layer, so it's easier to
diff --git a/src/port/Makefile b/src/port/Makefile
index b3a10ba014f..a2ee8e2d6d0 100644
--- a/src/port/Makefile
+++ b/src/port/Makefile
@@ -33,7 +33,8 @@ LIBS += $(PTHREAD_LIBS)
OBJS = $(LIBOBJS) $(PG_CRC32C_OBJS) chklocale.o erand48.o inet_net_ntop.o \
noblock.o path.o pgcheckdir.o pgmkdirp.o pgsleep.o \
pgstrcasecmp.o pqsignal.o \
- qsort.o qsort_arg.o quotes.o sprompt.o strerror.o tar.o thread.o
+ qsort.o qsort_arg.o quotes.o snprintf.o sprompt.o strerror.o \
+ tar.o thread.o
ifeq ($(enable_strong_random), yes)
OBJS += pg_strong_random.o
diff --git a/src/port/README b/src/port/README
index 4ae96da0158..c446b46e26e 100644
--- a/src/port/README
+++ b/src/port/README
@@ -18,7 +18,7 @@ and adding infrastructure to recompile the object files:
OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
connect.o misc.o path.o exec.o \
- $(filter snprintf.o, $(LIBOBJS))
+ $(filter strlcat.o, $(LIBOBJS))
The problem is that there is no testing of which object files need to be
added, but missing functions usually show up when linking user