mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Define snprintf() to call pg_snprintf() so our own snprintf-like
implementation doesn't export out via libpq and get used by a user application.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.70 2005/02/27 00:53:29 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.71 2005/03/11 17:20:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -107,6 +107,26 @@ extern int pg_strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
extern unsigned char pg_toupper(unsigned char ch);
|
||||
extern unsigned char pg_tolower(unsigned char ch);
|
||||
|
||||
#ifdef USE_SNPRINTF
|
||||
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||
extern int pg_snprintf(char *str, size_t count, const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string */
|
||||
__attribute__((format(printf, 3, 4)));
|
||||
extern int pg_printf(const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string */
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
|
||||
#define snprintf(...) pg_snprintf(__VA_ARGS__)
|
||||
#define printf(...) pg_printf(__VA_ARGS__)
|
||||
#else
|
||||
#define vsnprintf pg_vsnprintf
|
||||
#define snprintf pg_snprintf
|
||||
#define printf pg_printf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Portable prompt handling */
|
||||
extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
|
||||
|
||||
|
Reference in New Issue
Block a user