OSDN Git Service

Avoid the redundant declaration of the function prototypes.
authorMasaoFujii <masao.fujii@gmail.com>
Thu, 5 Feb 2015 10:24:14 +0000 (19:24 +0900)
committerMasaoFujii <masao.fujii@gmail.com>
Thu, 5 Feb 2015 10:25:47 +0000 (19:25 +0900)
When the server version is 9.4 or later, PG_FUNCTION_INFO_V1 macro
always creates the prototype of its given function, so we avoid
declaring the prototypes of all the global functions for pg_bigm.
IOW, the function prototypes are there only when the server version
is 9.3 or before.

This commit is inspired by the change of pg_trgm:
e7128e8dbb305059c30ec085461297e619bcbff4

Back-patch to 1.1 where 9.4 is supported.

Beena Emerson

bigm_gin.c
bigm_op.c

index 2c87e86..9858966 100644 (file)
 
 
 PG_FUNCTION_INFO_V1(gin_extract_value_bigm);
-Datum          gin_extract_value_bigm(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(gin_extract_query_bigm);
-Datum          gin_extract_query_bigm(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(gin_bigm_consistent);
-Datum          gin_bigm_consistent(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(gin_bigm_compare_partial);
-Datum          gin_bigm_compare_partial(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(pg_gin_pending_stats);
+
+/*
+ * The function prototypes are created as a part of PG_FUNCTION_INFO_V1
+ * macro since 9.4, and hence the declaration of the function prototypes
+ * here is necessary only for 9.3 or before.
+ */
+#if PG_VERSION_NUM < 90400
+Datum          gin_extract_value_bigm(PG_FUNCTION_ARGS);
+Datum          gin_extract_query_bigm(PG_FUNCTION_ARGS);
+Datum          gin_bigm_consistent(PG_FUNCTION_ARGS);
+Datum          gin_bigm_compare_partial(PG_FUNCTION_ARGS);
 Datum          pg_gin_pending_stats(PG_FUNCTION_ARGS);
+#endif
 
 Datum
 gin_extract_value_bigm(PG_FUNCTION_ARGS)
index 8556740..6b1c1a9 100644 (file)
--- a/bigm_op.c
+++ b/bigm_op.c
@@ -33,19 +33,23 @@ double      bigm_similarity_limit = 0.3;
 char   *bigm_last_update = NULL;
 
 PG_FUNCTION_INFO_V1(show_bigm);
-Datum          show_bigm(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(bigmtextcmp);
-Datum          bigmtextcmp(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(likequery);
-Datum          likequery(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(bigm_similarity);
-Datum          bigm_similarity(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(bigm_similarity_op);
+
+/*
+ * The function prototypes are created as a part of PG_FUNCTION_INFO_V1
+ * macro since 9.4, and hence the declaration of the function prototypes
+ * here is necessary only for 9.3 or before.
+ */
+#if PG_VERSION_NUM < 90400
+Datum          show_bigm(PG_FUNCTION_ARGS);
+Datum          bigmtextcmp(PG_FUNCTION_ARGS);
+Datum          likequery(PG_FUNCTION_ARGS);
+Datum          bigm_similarity(PG_FUNCTION_ARGS);
 Datum          bigm_similarity_op(PG_FUNCTION_ARGS);
+#endif
 
 void           _PG_init(void);
 void           _PG_fini(void);