Created
August 30, 2017 11:23
-
-
Save danielgustafsson/b30dfbc1adabc5d14616e0ea7f29466d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 7e0973e51969c110f753e77395f5fa538a20e493 Mon Sep 17 00:00:00 2001 | |
From: Daniel Gustafsson <daniel@yesql.se> | |
Date: Wed, 30 Aug 2017 13:13:21 +0200 | |
Subject: [PATCH] Defualt to post-8.1 coding convention for PG_MODULE_MAGIC | |
PG_MODULE_MAGIC has been around since 8.2, with 8.1 long since in | |
EOL. Default to avoiding the #ifdef test for the macro and instead | |
turn the documentation around that it may be needed, instead of | |
saying it can be omitted. Also remove the last remaining #ifdef | |
tests in the code. | |
--- | |
contrib/citext/citext.c | 2 -- | |
doc/src/sgml/plhandler.sgml | 2 -- | |
doc/src/sgml/spi.sgml | 2 -- | |
doc/src/sgml/xfunc.sgml | 17 ++++++++--------- | |
src/test/regress/regress.c | 2 -- | |
5 files changed, 8 insertions(+), 17 deletions(-) | |
diff --git a/contrib/citext/citext.c b/contrib/citext/citext.c | |
index 04f604b15f..0ba47828ba 100644 | |
--- a/contrib/citext/citext.c | |
+++ b/contrib/citext/citext.c | |
@@ -9,9 +9,7 @@ | |
#include "utils/formatting.h" | |
#include "utils/varlena.h" | |
-#ifdef PG_MODULE_MAGIC | |
PG_MODULE_MAGIC; | |
-#endif | |
/* | |
* ==================== | |
diff --git a/doc/src/sgml/plhandler.sgml b/doc/src/sgml/plhandler.sgml | |
index 57a2a05ed2..2573e67743 100644 | |
--- a/doc/src/sgml/plhandler.sgml | |
+++ b/doc/src/sgml/plhandler.sgml | |
@@ -108,9 +108,7 @@ | |
#include "catalog/pg_proc.h" | |
#include "catalog/pg_type.h" | |
-#ifdef PG_MODULE_MAGIC | |
PG_MODULE_MAGIC; | |
-#endif | |
PG_FUNCTION_INFO_V1(plsample_call_handler); | |
diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml | |
index 86be87c0fd..d04b5a2125 100644 | |
--- a/doc/src/sgml/spi.sgml | |
+++ b/doc/src/sgml/spi.sgml | |
@@ -4352,9 +4352,7 @@ INSERT INTO a SELECT * FROM a; | |
#include "executor/spi.h" | |
#include "utils/builtins.h" | |
-#ifdef PG_MODULE_MAGIC | |
PG_MODULE_MAGIC; | |
-#endif | |
int64 execq(text *sql, int cnt); | |
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml | |
index cd6dd840ba..3ee3924acc 100644 | |
--- a/doc/src/sgml/xfunc.sgml | |
+++ b/doc/src/sgml/xfunc.sgml | |
@@ -1762,17 +1762,20 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision | |
write this in one (and only one) of the module source files, after having | |
included the header <filename>fmgr.h</>: | |
+<programlisting> | |
+PG_MODULE_MAGIC; | |
+</programlisting> | |
+ | |
+ If the code needs to compile against pre-8.2 | |
+ <productname>PostgreSQL</productname> releases, test for the magic block | |
+ with <literal>#ifdef</> before including: | |
+ | |
<programlisting> | |
#ifdef PG_MODULE_MAGIC | |
PG_MODULE_MAGIC; | |
#endif | |
</programlisting> | |
- The <literal>#ifdef</> test can be omitted if the code doesn't | |
- need to compile against pre-8.2 <productname>PostgreSQL</productname> | |
- releases. | |
- </para> | |
- | |
<para> | |
After it is used for the first time, a dynamically loaded object | |
file is retained in memory. Future calls in the same session to | |
@@ -2214,9 +2217,7 @@ PG_FUNCTION_INFO_V1(funcname); | |
#include "fmgr.h" | |
#include "utils/geo_decls.h" | |
-#ifdef PG_MODULE_MAGIC | |
PG_MODULE_MAGIC; | |
-#endif | |
/* by value */ | |
@@ -2554,9 +2555,7 @@ SELECT name, c_overpaid(emp, 1500) AS overpaid | |
#include "postgres.h" | |
#include "executor/executor.h" /* for GetAttributeByName() */ | |
-#ifdef PG_MODULE_MAGIC | |
PG_MODULE_MAGIC; | |
-#endif | |
PG_FUNCTION_INFO_V1(c_overpaid); | |
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c | |
index 3d33b36e66..734947cc98 100644 | |
--- a/src/test/regress/regress.c | |
+++ b/src/test/regress/regress.c | |
@@ -46,9 +46,7 @@ | |
extern PATH *poly2path(POLYGON *poly); | |
extern void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2); | |
-#ifdef PG_MODULE_MAGIC | |
PG_MODULE_MAGIC; | |
-#endif | |
/* | |
-- | |
2.14.1.145.gb3622a4ee | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment