aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/hstore_plperl/hstore_plperl.c4
-rw-r--r--contrib/jsonb_plperl/jsonb_plperl.c3
-rw-r--r--src/pl/plperl/SPI.xs3
-rw-r--r--src/pl/plperl/Util.xs4
-rw-r--r--src/pl/plperl/plperl.c3
-rw-r--r--src/pl/plperl/plperl.h15
6 files changed, 17 insertions, 15 deletions
diff --git a/contrib/hstore_plperl/hstore_plperl.c b/contrib/hstore_plperl/hstore_plperl.c
index 61b5557421c..1316b0500be 100644
--- a/contrib/hstore_plperl/hstore_plperl.c
+++ b/contrib/hstore_plperl/hstore_plperl.c
@@ -1,11 +1,9 @@
#include "postgres.h"
-#undef _
-
#include "fmgr.h"
+#include "hstore/hstore.h"
#include "plperl.h"
#include "plperl_helpers.h"
-#include "hstore/hstore.h"
PG_MODULE_MAGIC;
diff --git a/contrib/jsonb_plperl/jsonb_plperl.c b/contrib/jsonb_plperl/jsonb_plperl.c
index 79c5f57d8fd..b26723a9589 100644
--- a/contrib/jsonb_plperl/jsonb_plperl.c
+++ b/contrib/jsonb_plperl/jsonb_plperl.c
@@ -2,9 +2,6 @@
#include <math.h>
-/* Defined by Perl */
-#undef _
-
#include "fmgr.h"
#include "plperl.h"
#include "plperl_helpers.h"
diff --git a/src/pl/plperl/SPI.xs b/src/pl/plperl/SPI.xs
index b98c547e8be..b2db3bd6949 100644
--- a/src/pl/plperl/SPI.xs
+++ b/src/pl/plperl/SPI.xs
@@ -10,9 +10,6 @@
/* this must be first: */
#include "postgres.h"
-/* Defined by Perl */
-#undef _
-
/* perl stuff */
#define PG_NEED_PERL_XSUB_H
#include "plperl.h"
diff --git a/src/pl/plperl/Util.xs b/src/pl/plperl/Util.xs
index 686513d2e8d..47eba594155 100644
--- a/src/pl/plperl/Util.xs
+++ b/src/pl/plperl/Util.xs
@@ -12,13 +12,11 @@
/* this must be first: */
#include "postgres.h"
+
#include "fmgr.h"
#include "utils/builtins.h"
#include "utils/bytea.h" /* for byteain & byteaout */
-/* Defined by Perl */
-#undef _
-
/* perl stuff */
#define PG_NEED_PERL_XSUB_H
#include "plperl.h"
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 5cb3a447291..2db13d30308 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -7,9 +7,6 @@
#include "postgres.h"
-/* Defined by Perl */
-#undef _
-
/* system stuff */
#include <ctype.h>
#include <fcntl.h>
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index 09a77dc0b7b..e94a4c345bd 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -39,6 +39,11 @@
#undef printf
/*
+ * Perl scribbles on the "_" macro too.
+ */
+#undef _
+
+/*
* ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
* __inline__. Translate to something MSVC recognizes. Also, perl.h sometimes
* defines isnan, so undefine it here and put back the definition later if
@@ -140,6 +145,16 @@
#define vprintf pg_vprintf
#define printf(...) pg_printf(__VA_ARGS__)
+/*
+ * Put back "_" too; but rather than making it just gettext() as the core
+ * code does, make it dgettext() so that the right things will happen in
+ * loadable modules (if they've set up TEXTDOMAIN correctly). Note that
+ * we can't just set TEXTDOMAIN here, because this file is used by more
+ * extensions than just PL/Perl itself.
+ */
+#undef _
+#define _(x) dgettext(TEXTDOMAIN, x)
+
/* put back the definition of isnan if needed */
#ifdef _MSC_VER
#ifndef isnan