aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-07-31 12:10:36 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-07-31 12:10:36 -0400
commit30a5c8bfbd7bec07385c7d40305b06385d700b3f (patch)
tree381cfc1b2b298e28d7e6fc5c100ba9bbf33c8fe2 /src/pl/plperl/plperl.h
parentd38e706ff149eb0937502cc0be27645e70bbfec6 (diff)
downloadpostgresql-30a5c8bfbd7bec07385c7d40305b06385d700b3f.tar.gz
postgresql-30a5c8bfbd7bec07385c7d40305b06385d700b3f.zip
PL/Perl portability fix: avoid including XSUB.h in plperl.c.
Back-patch of commit bebe174bb4462ef079a1d7eeafb82ff969f160a4, which see for more info. Patch by me, with some help from Ashutosh Sharma Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
Diffstat (limited to 'src/pl/plperl/plperl.h')
-rw-r--r--src/pl/plperl/plperl.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index 0146d60a116..a4593cac371 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -24,7 +24,7 @@
#ifdef isnan
#undef isnan
#endif
-#endif
+#endif /* WIN32 */
/*
* Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
@@ -43,10 +43,22 @@
#endif
-/* required for perl API */
+/*
+ * Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code
+ * can compile against MULTIPLICITY Perl builds without including XSUB.h.
+ */
+#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
+
+/*
+ * We want to include XSUB.h only within .xs files, because on some platforms
+ * it undesirably redefines a lot of libc functions. But it must appear
+ * before ppport.h, so use a #define flag to control inclusion here.
+ */
+#ifdef PG_NEED_PERL_XSUB_H
#include "XSUB.h"
+#endif
/* put back our snprintf and vsnprintf */
#ifdef USE_REPL_SNPRINTF
@@ -106,5 +118,6 @@ SV *plperl_spi_query_prepared(char *, int, SV **);
void plperl_spi_freeplan(char *);
void plperl_spi_cursor_close(char *);
char *plperl_sv_to_literal(SV *, char *);
+void plperl_util_elog(int level, SV *msg);
#endif /* PL_PERL_H */