summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2004-09-27 23:24:45 +0000
committerBruce Momjian2004-09-27 23:24:45 +0000
commite1c8b37afb5669542272585245b0706fcad174da (patch)
tree66a2fef74da786dd1f0636f038c639bd6fce94b2
parente0170510062d49ca79666e944803272b4dd5f711 (diff)
Add new macro as shorthand for MS VC and Borland C++:
+ #if defined(_MSC_VER) || defined(__BORLANDC__) + #define WIN32_CLIENT_ONLY + #endif
-rw-r--r--src/backend/libpq/ip.c8
-rw-r--r--src/backend/utils/mb/encnames.c4
-rw-r--r--src/bin/psql/print.c4
-rw-r--r--src/include/c.h8
-rw-r--r--src/include/getaddrinfo.h4
-rw-r--r--src/include/port.h11
-rw-r--r--src/include/port/win32.h4
-rw-r--r--src/interfaces/libpq/fe-misc.c4
-rw-r--r--src/port/getaddrinfo.c4
-rw-r--r--src/port/inet_aton.c4
-rw-r--r--src/port/thread.c4
11 files changed, 31 insertions, 28 deletions
diff --git a/src/backend/libpq/ip.c b/src/backend/libpq/ip.c
index 78a63728544..74bcda8eb1b 100644
--- a/src/backend/libpq/ip.c
+++ b/src/backend/libpq/ip.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.28 2004/08/29 05:06:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.29 2004/09/27 23:24:30 momjian Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <[email protected]>, Linux Based Systems Design
@@ -20,8 +20,7 @@
/* This is intended to be used in both frontend and backend, so use c.h */
#include "c.h"
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
-
+#ifndef WIN32_CLIENT_ONLY
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
@@ -34,8 +33,7 @@
#endif
#include <arpa/inet.h>
#include <sys/file.h>
-#endif /* !defined(_MSC_VER) &&
- * !defined(__BORLANDC__) */
+#endif
#include "libpq/ip.h"
diff --git a/src/backend/utils/mb/encnames.c b/src/backend/utils/mb/encnames.c
index 634861a2053..a3260fd61c4 100644
--- a/src/backend/utils/mb/encnames.c
+++ b/src/backend/utils/mb/encnames.c
@@ -2,7 +2,7 @@
* Encoding names and routines for work with it. All
* in this file is shared bedween FE and BE.
*
- * $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.19 2004/09/17 21:59:57 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.20 2004/09/27 23:24:33 momjian Exp $
*/
#ifdef FRONTEND
#include "postgres_fe.h"
@@ -13,7 +13,7 @@
#include "utils/builtins.h"
#endif
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
#endif
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index f4347252690..ede51f2f136 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.51 2004/08/29 05:06:54 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.52 2004/09/27 23:24:35 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -12,7 +12,7 @@
#include <math.h>
#include <signal.h>
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
#endif
diff --git a/src/include/c.h b/src/include/c.h
index fcdf6b404be..861b11ce0d2 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.176 2004/09/27 22:11:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.177 2004/09/27 23:24:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,6 +54,10 @@
#include "pg_config_manual.h" /* must be after pg_config.h */
#if !defined(WIN32) && !defined(__CYGWIN__)
#include "pg_config_os.h" /* must be before any system header files */
+#else
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#define WIN32_CLIENT_ONLY
+#endif
#endif
#include "postgres_ext.h"
@@ -76,7 +80,7 @@
#endif
#if defined(WIN32) || defined(__CYGWIN__)
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
/* We have to redefine some system functions after they are included above */
#include "pg_config_os.h"
#else
diff --git a/src/include/getaddrinfo.h b/src/include/getaddrinfo.h
index 893e7106c78..f4bc4410ce5 100644
--- a/src/include/getaddrinfo.h
+++ b/src/include/getaddrinfo.h
@@ -15,14 +15,14 @@
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.12 2003/11/29 22:40:53 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.13 2004/09/27 23:24:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef GETADDRINFO_H
#define GETADDRINFO_H
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
#include <sys/socket.h>
#include <netdb.h>
#endif
diff --git a/src/include/port.h b/src/include/port.h
index 2c789fe4b3f..e60bc60f02d 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -6,16 +6,17 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/port.h,v 1.62 2004/09/27 20:37:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.63 2004/09/27 23:24:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
/* for thread.c */
#include <pwd.h>
#include <netdb.h>
#endif
+
#include <ctype.h>
/* non-blocking */
@@ -169,7 +170,7 @@ extern int pgunlink(const char *path);
extern int pgsymlink(const char *oldpath, const char *newpath);
/* Include this first so later includes don't see these defines */
-#ifdef _MSC_VER
+#ifdef WIN32_CLIENT_ONLY
#include <io.h>
#endif
@@ -183,7 +184,7 @@ extern bool rmtree(char *path, bool rmtopdir);
#ifdef WIN32
/* open() replacement to allow delete of held files */
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
extern int win32_open(const char *, int,...);
#define open(a,b,...) win32_open(a,b,##__VA_ARGS__)
@@ -242,7 +243,7 @@ extern double rint(double x);
#endif
#ifndef HAVE_INET_ATON
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
diff --git a/src/include/port/win32.h b/src/include/port/win32.h
index b2ebdd4e3ff..7c85043e705 100644
--- a/src/include/port/win32.h
+++ b/src/include/port/win32.h
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.33 2004/09/14 03:50:17 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.34 2004/09/27 23:24:40 momjian Exp $ */
/* undefine and redefine after #include */
#undef mkdir
@@ -31,7 +31,7 @@
#define DLLIMPORT __declspec (dllimport)
#endif
-#elif defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) /* not CYGWIN or MingW */
+#elif defined(WIN32_CLIENT_ONLY)
#if defined(_DLL)
#define DLLIMPORT __declspec (dllexport)
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index 212f7a63cd4..12022dc9dac 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.110 2004/08/29 05:07:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.111 2004/09/27 23:24:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,7 +34,7 @@
#include <signal.h>
#include <time.h>
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c
index 906e1610807..59da098f85a 100644
--- a/src/port/getaddrinfo.c
+++ b/src/port/getaddrinfo.c
@@ -12,7 +12,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.12 2003/11/29 19:52:13 pgsql Exp $
+ * $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.13 2004/09/27 23:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,7 +20,7 @@
/* This is intended to be used in both frontend and backend, so use c.h */
#include "c.h"
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
diff --git a/src/port/inet_aton.c b/src/port/inet_aton.c
index 9b099cc549b..521e61dcf99 100644
--- a/src/port/inet_aton.c
+++ b/src/port/inet_aton.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.6 2003/11/29 22:41:31 pgsql Exp $
+/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.7 2004/09/27 23:24:45 momjian Exp $
*
* This inet_aton() function was taken from the GNU C library and
* incorporated into Postgres for those systems which do not have this
@@ -44,7 +44,7 @@
#include "c.h"
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifndef WIN32_CLIENT_ONLY
#include <netinet/in.h>
#include <ctype.h>
#endif
diff --git a/src/port/thread.c b/src/port/thread.c
index 96610f9f5a0..f950e419a14 100644
--- a/src/port/thread.c
+++ b/src/port/thread.c
@@ -7,7 +7,7 @@
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/port/thread.c,v 1.25 2004/08/29 05:07:02 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/thread.c,v 1.26 2004/09/27 23:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@
#include <sys/types.h>
#include <errno.h>
-#if defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__))
+#ifdef WIN32_CLIENT_ONLY
#undef ERROR
#else
#include <pwd.h>