OSDN Git Service

Add the news about the release of RPM files.
[pgbigm/pg_bigm.git] / bigm.h
diff --git a/bigm.h b/bigm.h
index 526ea90..aa01aa8 100644 (file)
--- a/bigm.h
+++ b/bigm.h
@@ -1,7 +1,8 @@
 /*-------------------------------------------------------------------------
  *
+ * Portions Copyright (c) 2017-2020, pg_bigm Development Group
+ * Portions Copyright (c) 2013-2016, NTT DATA Corporation
  * Portions Copyright (c) 2004-2012, PostgreSQL Global Development Group
- * Portions Copyright (c) 2013-2015, NTT DATA Corporation
  *
  * Changelog:
  *      2013/01/09
@@ -21,6 +22,7 @@
 extern bool bigm_enable_recheck;
 extern int     bigm_gin_key_limit;
 extern double bigm_similarity_limit;
+extern char    *bigm_last_update;
 
 /* options */
 #define LPADDING               1
@@ -33,7 +35,7 @@ extern double bigm_similarity_limit;
 typedef struct
 {
        bool            pmatch;                 /* partial match is required? */
-       int                     bytelen;                /* byte length of bi-gram string */
+       int8            bytelen;                /* byte length of bi-gram string */
 
        /*
         * Bi-gram string; we assume here that the maximum bytes for a character
@@ -44,7 +46,25 @@ typedef struct
 
 #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 {              \