Commit
86d78ef in PostgreSQL caused the compiler to report
the following warning when compiling pg_bigm on PostgreSQL 12
or later. This commit fixes it.
warning: inline function 'bigmstrcmp' declared but never defined [enabled by default]
To suppress the compiler warning, this commit gets rid of
"extern inline" declaration for bigmstrcmp() and moves its definition
into the header file as "static inline" function.
Back-patch to pg_bigm 1.0. Since pg_bigm 1.1 and 1.0 don't support
PostgreSQL 12 or later, basically this commit doesn't need
to be back-patch to 1.1 and 1.0. But we do that because making
the code look similar in all branches for the ease of future
maintenance.
Author: Torikoshi Atsushi
Reviewed-by: Fujii Masao
Discussion: https://osdn.net/projects/pgbigm/lists/archive/hackers/2020-February/000327.html
#define BIGMSIZE sizeof(bigm)
-extern inline int bigmstrcmp(char *arg1, int len1, char *arg2, int len2);
+static inline int
+bigmstrcmp(char *arg1, int len1, char *arg2, int len2)
+{
+ int i;
+ int len = Min(len1, len2);
+
+ for (i = 0; i < len; i++, arg1++, arg2++)
+ {
+ if (*arg1 == *arg2)
+ continue;
+ if (*arg1 < *arg2)
+ return -1;
+ else
+ return 1;
+ }
+
+ return (len1 == len2) ? 0 : ((len1 < len2) ? -1 : 1);
+}
+
#define CMPBIGM(a,b) ( bigmstrcmp(((bigm *)a)->str, ((bigm *)a)->bytelen, ((bigm *)b)->str, ((bigm *)b)->bytelen) )
#define CPBIGM(bptr, s, len) do { \
PG_RETURN_TEXT_P(result);
}
-inline int
-bigmstrcmp(char *arg1, int len1, char *arg2, int len2)
-{
- int i;
- int len = Min(len1, len2);
-
- for (i = 0; i < len; i++, arg1++, arg2++)
- {
- if (*arg1 == *arg2)
- continue;
- if (*arg1 < *arg2)
- return -1;
- else
- return 1;
- }
-
- return (len1 == len2) ? 0 : ((len1 < len2) ? -1 : 1);
-}
-
Datum
bigmtextcmp(PG_FUNCTION_ARGS)
{