summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/c.h7
-rw-r--r--src/include/pg_config.h.in2
-rw-r--r--src/include/pg_config.h.win324
-rw-r--r--src/include/port.h28
-rw-r--r--src/interfaces/ecpg/ecpglib/Makefile16
-rw-r--r--src/interfaces/libpq/win32.h3
6 files changed, 36 insertions, 24 deletions
diff --git a/src/include/c.h b/src/include/c.h
index fb7361905d9..16b9f25a78c 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.191 2005/11/17 22:14:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.192 2005/12/06 02:29:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -101,9 +101,8 @@
#endif
/*
- * These strings are to be translation via xgettext. We can't
- * call gettext() because it is located in variable initialization and
- * a function call can not be used.
+ * Use this to mark strings to be translated by gettext, in places where
+ * you don't want an actual function call to occur (eg, constant tables).
*/
#define gettext_noop(x) (x)
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 06aca08d90b..b1daceeecf9 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -640,7 +640,7 @@
#undef USE_PAM
/* Use replacement snprintf() functions. */
-#undef USE_SNPRINTF
+#undef USE_REPL_SNPRINTF
/* Define to build with (Open)SSL support. (--with-openssl) */
#undef USE_SSL
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index eb308a36f59..97b9aa219cf 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -23,10 +23,6 @@
#define HAVE_RANDOM
#endif
-/* use _snprintf instead of snprintf */
-#define HAVE_DECL_SNPRINTF 1
-#define snprintf _snprintf
-
/* defines for dynamic linking on Win32 platform */
#ifdef __CYGWIN__
diff --git a/src/include/port.h b/src/include/port.h
index a61abe719fa..5f5673a99f5 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -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.84 2005/10/15 02:49:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.85 2005/12/06 02:29:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -112,7 +112,8 @@ 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
+#ifdef USE_REPL_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,...)
@@ -132,6 +133,26 @@ pg_printf(const char *fmt,...)
__attribute__((format(printf, 1, 2)));
/*
+ * Some versions of libintl try to replace printf and friends with macros;
+ * if we are doing likewise, make sure our versions win.
+ */
+#ifdef vsnprintf
+#undef vsnprintf
+#endif
+#ifdef snprintf
+#undef snprintf
+#endif
+#ifdef sprintf
+#undef sprintf
+#endif
+#ifdef fprintf
+#undef fprintf
+#endif
+#ifdef printf
+#undef printf
+#endif
+
+/*
* The GCC-specific code below prevents the __attribute__(... 'printf')
* above from being replaced, and this is required because gcc doesn't
* know anything about pg_printf.
@@ -149,7 +170,8 @@ __attribute__((format(printf, 1, 2)));
#define fprintf pg_fprintf
#define printf pg_printf
#endif
-#endif
+
+#endif /* USE_REPL_SNPRINTF */
/* Portable prompt handling */
extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile
index deaf695d97b..9de4b003e41 100644
--- a/src/interfaces/ecpg/ecpglib/Makefile
+++ b/src/interfaces/ecpg/ecpglib/Makefile
@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.34 2005/11/30 12:49:49 meskes Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.35 2005/12/06 02:29:04 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -21,11 +21,12 @@ override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
-# Need to recomple any libpgport object files
-LIBS := $(patsubst -lpgport,, $(LIBS))
+# Need to recompile any libpgport object files
+LIBS := $(filter-out -lpgport, $(LIBS))
OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
- connect.o misc.o path.o exec.o
+ connect.o misc.o path.o exec.o \
+ $(filter snprintf.o, $(LIBOBJS))
SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \
$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
@@ -45,10 +46,7 @@ include $(top_srcdir)/src/Makefile.shlib
# necessarily use the same object files as the backend uses. Instead,
# symlink the source files in here and build our own object file.
-path.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
-
-exec.c: % : $(top_srcdir)/src/port/%
+path.c exec.c snprintf.c: % : $(top_srcdir)/src/port/%
rm -f $@ && $(LN_S) $< .
path.o: path.c $(top_builddir)/src/port/pg_config_paths.h
@@ -64,7 +62,7 @@ installdirs:
uninstall: uninstall-lib
clean distclean maintainer-clean: clean-lib
- rm -f $(OBJS) path.c exec.c
+ rm -f $(OBJS) path.c exec.c snprintf.c
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
diff --git a/src/interfaces/libpq/win32.h b/src/interfaces/libpq/win32.h
index 14f1a7e09e4..f3c61c798ff 100644
--- a/src/interfaces/libpq/win32.h
+++ b/src/interfaces/libpq/win32.h
@@ -16,9 +16,6 @@
#define write(a,b,c) _write(a,b,c)
#endif
-#define vsnprintf(a,b,c,d) _vsnprintf(a,b,c,d)
-#define snprintf _snprintf
-
#undef EAGAIN /* doesn't apply on sockets */
#undef EINTR
#define EINTR WSAEINTR