Fix compiler warnings master
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 8 Nov 2021 11:49:14 +0000 (14:49 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 8 Nov 2021 11:49:14 +0000 (14:49 +0300)
smlar.c
smlar_gin.c
smlar_gist.c

diff --git a/smlar.c b/smlar.c
index ce7e2ad..ca0651f 100644 (file)
--- a/smlar.c
+++ b/smlar.c
@@ -30,6 +30,10 @@ PG_MODULE_MAGIC;
 #define SNAPSHOT SnapshotNow
 #endif
 
+#if PG_VERSION_NUM >= 130000
+#define heap_open(r, l)                        table_open((r), (l))
+#define heap_close(r, l)               table_close((r), (l))
+#endif
 
 static Oid
 getDefaultOpclass(Oid amoid, Oid typid)
@@ -522,6 +526,7 @@ Array2SimpleArrayU(ProcTypeInfo info, ArrayType *a, void *cache)
                                                {
                                                        case TF_LOG:
                                                                s->df[i] = (1.0 + log( s->df[i] ));
+                                                               /* FALLTHROUGH */
                                                        case TF_N:
                                                                s->df[i] *= stat->idf;
                                                                break;
index ec095f6..4164fa4 100644 (file)
@@ -5,7 +5,11 @@
 #include "fmgr.h"
 #include "access/gin.h"
 #include "access/skey.h"
+#if PG_VERSION_NUM < 130000
 #include "access/tuptoaster.h"
+#else
+#include "access/heaptoast.h"
+#endif
 
 PG_FUNCTION_INFO_V1(smlararrayextract);
 Datum smlararrayextract(PG_FUNCTION_ARGS);
index b1d9073..480d744 100644 (file)
@@ -3,7 +3,11 @@
 #include "fmgr.h"
 #include "access/gist.h"
 #include "access/skey.h"
+#if PG_VERSION_NUM < 130000
 #include "access/tuptoaster.h"
+#else
+#include "access/heaptoast.h"
+#endif
 #include "utils/memutils.h"
 
 typedef struct SmlSign {
@@ -242,11 +246,12 @@ getHashedCache(void *cache)
                for(i=0;i<stat->nelems;i++)
                {
                        uint32  hash;
+                       int             index;
 
                        hash = DatumGetUInt32(FunctionCall1Coll(&stat->info->hashFunc,
                                                                                                        DEFAULT_COLLATION_OID,
                                                                                                        stat->elems[i].datum));
-                       int             index = HASHVAL(hash);
+                       index = HASHVAL(hash);
 
                        stat->helems[i].hash = hash;
                        stat->helems[i].idfMin = stat->helems[i].idfMax = stat->elems[i].idf;