From 847e47a2b4071db9379661e193e810a9f6762abf Mon Sep 17 00:00:00 2001 From: Masahiko Sawada Date: Wed, 9 Sep 2015 11:24:45 +0900 Subject: [PATCH] Avoid the redundant declaration of the function prototypes. 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 ludia_funcs. The function prototypes are there only when the server version is 9.3 or before. --- ludia_funcs.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ludia_funcs.c b/ludia_funcs.c index de269e4..a14fb52 100644 --- a/ludia_funcs.c +++ b/ludia_funcs.c @@ -61,13 +61,20 @@ static bool escape_snippet_keyword = false; #define ISSENNAOPSCHAR(x) (*(x) == '+' || *(x) == '-' || *(x) == ' ') PG_FUNCTION_INFO_V1(pgs2snippet1); -Datum pgs2snippet1(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(pgs2norm); -Datum pgs2norm(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(pgs2textporter1); -Datum pgs2textporter1(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(pgs2seninfo); + +/* * 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 pgs2snippet1(PG_FUNCTION_ARGS); +Datum pgs2norm(PG_FUNCTION_ARGS); +Datum pgs2textporter1(PG_FUNCTION_ARGS); Datum pgs2seninfo(PG_FUNCTION_ARGS); +#endif static sen_encoding GetSennaEncoding(void); static sen_query *GetSennaQuery(char *str, size_t len); -- 2.11.0