From 99eea89dbe31fbd78d08a56e53f5bc272bbcd064 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 31 Jul 2017 12:10:36 -0400 Subject: 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 --- src/pl/plperl/plperl.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/pl/plperl/plperl.h') 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 */ -- cgit v1.2.3