Tom wrote:

It's there to declare struct timeval, and I'm fairly certain that diking
it out of the header would break things on some platforms. Where does
Windows define struct timeval?


struct timeval is defined in winsock.h under vc6.
I'm checking for _MSC_VER now.

Agreed. We define FRONTEND when compiling libpq. Please test for that
and send another patch.


elog.h is included in postgres.h, which is included in many src/port/*.c. Many of them are pretty straight, not requiring any backend specific stuff, so the attached patch will change postgres.h to c.h for most of them.

Regards,
Andreas

Index: include/libpq/libpq-be.h
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/include/libpq/libpq-be.h,v
retrieving revision 1.45
diff -u -r1.45 libpq-be.h
--- include/libpq/libpq-be.h    21 May 2004 05:08:04 -0000      1.45
+++ include/libpq/libpq-be.h    20 Jun 2004 09:19:54 -0000
@@ -18,7 +18,12 @@
 #ifndef LIBPQ_BE_H
 #define LIBPQ_BE_H
 
+#if _MSC_VER > 0
+/* struct timeval is declared in winsock.h */
+#else
 #include <sys/time.h>
+#endif
+
 
 #ifdef USE_SSL
 #include <openssl/ssl.h>
Index: port/getopt.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/getopt.c,v
retrieving revision 1.5
diff -u -r1.5 getopt.c
--- port/getopt.c       4 Aug 2003 00:43:33 -0000       1.5
+++ port/getopt.c       20 Jun 2004 09:19:55 -0000
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  */
 
-#include "postgres.h"
+#include "c.h"
 
 
 #if defined(LIBC_SCCS) && !defined(lint)
Index: port/getrusage.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/getrusage.c,v
retrieving revision 1.4
diff -u -r1.4 getrusage.c
--- port/getrusage.c    29 Nov 2003 19:52:13 -0000      1.4
+++ port/getrusage.c    20 Jun 2004 09:19:55 -0000
@@ -16,7 +16,7 @@
 #include <stdio.h>
 #include <errno.h>
 
-#include "postgres.h"
+#include "c.h"
 #include "rusagestub.h"
 
 /* This code works on:
Index: port/gettimeofday.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/gettimeofday.c,v
retrieving revision 1.4
diff -u -r1.4 gettimeofday.c
--- port/gettimeofday.c 21 May 2004 05:08:05 -0000      1.4
+++ port/gettimeofday.c 20 Jun 2004 09:19:55 -0000
@@ -23,7 +23,7 @@
  * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  */
 
-#include "postgres.h"
+#include "c.h"
 
 #include <sys/time.h>
 
Index: port/kill.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/kill.c,v
retrieving revision 1.1
diff -u -r1.1 kill.c
--- port/kill.c 27 May 2004 13:08:57 -0000      1.1
+++ port/kill.c 20 Jun 2004 09:19:55 -0000
@@ -14,7 +14,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "postgres.h"
+#include "c.h"
 
 #ifdef WIN32
 /* signal sending */
Index: port/noblock.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/noblock.c,v
retrieving revision 1.1
diff -u -r1.1 noblock.c
--- port/noblock.c      10 Mar 2004 21:12:49 -0000      1.1
+++ port/noblock.c      20 Jun 2004 09:19:55 -0000
@@ -12,7 +12,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "postgres.h"
+#include "c.h"
 
 #include <sys/types.h>
 #include <fcntl.h>
Index: port/pgsleep.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/pgsleep.c,v
retrieving revision 1.3
diff -u -r1.3 pgsleep.c
--- port/pgsleep.c      12 Apr 2004 16:19:18 -0000      1.3
+++ port/pgsleep.c      20 Jun 2004 09:19:56 -0000
@@ -10,7 +10,7 @@
  *
  *-------------------------------------------------------------------------
  */
-#include "postgres.h"
+#include "c.h"
 
 #include <unistd.h>
 #include <sys/time.h>
Index: port/pgstrcasecmp.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/pgstrcasecmp.c,v
retrieving revision 1.1
diff -u -r1.1 pgstrcasecmp.c
--- port/pgstrcasecmp.c 7 May 2004 00:24:59 -0000       1.1
+++ port/pgstrcasecmp.c 20 Jun 2004 09:19:56 -0000
@@ -20,7 +20,7 @@
  *
  *-------------------------------------------------------------------------
  */
-#include "postgres.h"
+#include "c.h"
 
 #include <ctype.h>
 
Index: port/pipe.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/pipe.c,v
retrieving revision 1.5
diff -u -r1.5 pipe.c
--- port/pipe.c 11 Jun 2004 03:48:35 -0000      1.5
+++ port/pipe.c 20 Jun 2004 09:19:56 -0000
@@ -15,7 +15,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "postgres.h"
+#include "c.h"
 
 #ifdef WIN32
 int
Index: port/sprompt.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/sprompt.c,v
retrieving revision 1.5
diff -u -r1.5 sprompt.c
--- port/sprompt.c      19 Apr 2004 17:42:59 -0000      1.5
+++ port/sprompt.c      20 Jun 2004 09:19:56 -0000
@@ -26,7 +26,7 @@
  *
  * Returns a malloc()'ed string with the input (w/o trailing newline).
  */
-#include "postgres.h"
+#include "c.h"
 
 #ifdef HAVE_TERMIOS_H
 #include <termios.h>
Index: port/thread.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/port/thread.c,v
retrieving revision 1.22
diff -u -r1.22 thread.c
--- port/thread.c       8 Jun 2004 01:45:50 -0000       1.22
+++ port/thread.c       20 Jun 2004 09:19:56 -0000
@@ -12,7 +12,7 @@
  *-------------------------------------------------------------------------
  */
 
-#include "postgres.h"
+#include "c.h"
 
 #include <sys/types.h>
 #include <errno.h>
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to