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
commit99eea89dbe31fbd78d08a56e53f5bc272bbcd064 (patch)
treead6a98150808f264a38e3ed067c49cb6db75f510 /src/pl/plperl/plperl.h
parentd90d5a1f7a77a23732c910d2fdda036589940834 (diff)
downloadpostgresql-99eea89dbe31fbd78d08a56e53f5bc272bbcd064.tar.gz
postgresql-99eea89dbe31fbd78d08a56e53f5bc272bbcd064.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 813d4401bbb..56b41ed1cc0 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
@@ -99,5 +111,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 */