summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan2006-01-08 22:27:52 +0000
committerAndrew Dunstan2006-01-08 22:27:52 +0000
commitc3a9e988b01f7bcf853b8640bf7a542e43aafe60 (patch)
tree1004d1d12fb930678269d2452db87e2672bd47bb
parent6b8446b5717959c89e428e48aa0ae3cd4b757582 (diff)
Rationalise perl header inclusions via a common include file, which also
declares routines in plperl.c and spi_internal.c used in other files. Along the way, also stop perl from hijacking stdio and other stuff on Windows.
-rw-r--r--src/pl/plperl/SPI.xs7
-rw-r--r--src/pl/plperl/plperl.c13
-rw-r--r--src/pl/plperl/plperl.h49
-rw-r--r--src/pl/plperl/spi_internal.c4
-rw-r--r--src/pl/plperl/spi_internal.h22
5 files changed, 53 insertions, 42 deletions
diff --git a/src/pl/plperl/SPI.xs b/src/pl/plperl/SPI.xs
index 8d14f093b7..9d3dc39c75 100644
--- a/src/pl/plperl/SPI.xs
+++ b/src/pl/plperl/SPI.xs
@@ -4,12 +4,7 @@
#undef _
/* perl stuff */
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-#include "ppport.h"
-
-#include "spi_internal.h"
+#include "plperl.h"
/*
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 776394e152..46cad70178 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -60,18 +60,7 @@
extern DLLIMPORT bool check_function_bodies;
/* perl stuff */
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-#include "ppport.h"
-#include "spi_internal.h"
-
-/* just in case these symbols aren't provided */
-#ifndef pTHX_
-#define pTHX_
-#define pTHX void
-#endif
-
+#include "plperl.h"
/**********************************************************************
* The information we cache about loaded procedures
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
new file mode 100644
index 0000000000..0c3329a32e
--- /dev/null
+++ b/src/pl/plperl/plperl.h
@@ -0,0 +1,49 @@
+/*-------------------------------------------------------------------------
+ *
+ * plperl.h
+ * Common include file for PL/Perl files
+ *
+ * This should be included _AFTER_ postgres.h and system include files
+ *
+ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1995, Regents of the University of California
+ *
+ * $PostgreSQL:$
+ */
+
+#ifndef PL_PERL_H
+#define PL_PERL_H
+
+/* stop perl headers from hijacking stdio and other stuff on Windows */
+#ifdef WIN32
+#define WIN32IO_IS_STDIO
+#endif
+
+/* required for perl API */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include "ppport.h"
+
+/* just in case these symbols aren't provided */
+#ifndef pTHX_
+#define pTHX_
+#define pTHX void
+#endif
+
+/* routines from spi_internal.c */
+int spi_DEBUG(void);
+int spi_LOG(void);
+int spi_INFO(void);
+int spi_NOTICE(void);
+int spi_WARNING(void);
+int spi_ERROR(void);
+
+/* routines from plperl.c */
+HV *plperl_spi_exec(char *, int);
+void plperl_return_next(SV *);
+SV *plperl_spi_query(char *);
+SV *plperl_spi_fetchrow(char *);
+
+
+#endif /* PL_PERL_H */
diff --git a/src/pl/plperl/spi_internal.c b/src/pl/plperl/spi_internal.c
index c022d7d9e5..7ca771da83 100644
--- a/src/pl/plperl/spi_internal.c
+++ b/src/pl/plperl/spi_internal.c
@@ -8,8 +8,8 @@
/* Defined by Perl */
#undef _
-#include "spi_internal.h"
-
+/* perl stuff */
+#include "plperl.h"
int
spi_DEBUG(void)
diff --git a/src/pl/plperl/spi_internal.h b/src/pl/plperl/spi_internal.h
deleted file mode 100644
index 4d2c407ee1..0000000000
--- a/src/pl/plperl/spi_internal.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-#include "ppport.h"
-
-int spi_DEBUG(void);
-
-int spi_LOG(void);
-
-int spi_INFO(void);
-
-int spi_NOTICE(void);
-
-int spi_WARNING(void);
-
-int spi_ERROR(void);
-
-/* this is actually in plperl.c */
-HV *plperl_spi_exec(char *, int);
-void plperl_return_next(SV *);
-SV *plperl_spi_query(char *);
-SV *plperl_spi_fetchrow(char *);