X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=smlar.git;a=blobdiff_plain;f=smlar_gist.c;h=7d77788af34dc23332ad163c0584c36c0c4c3c8a;hp=b1d907393c1f79ca1e280928d2600b48e1887473;hb=HEAD;hpb=15c8b4b78d7ed329f52e520e824c68ae33748f8a diff --git a/smlar_gist.c b/smlar_gist.c index b1d9073..a142a77 100644 --- a/smlar_gist.c +++ b/smlar_gist.c @@ -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 { @@ -48,6 +52,10 @@ typedef char *BITVECP; #define GETENTRY(vec,pos) ((SmlSign *) DatumGetPointer((vec)->vector[(pos)].key)) +#ifndef Abs +#define Abs(x) abs(x) +#endif + /* * Fake IO */ @@ -242,11 +250,12 @@ getHashedCache(void *cache) for(i=0;inelems;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; @@ -425,7 +434,7 @@ Datum gsmlsign_decompress(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); - SmlSign *key = (SmlSign*)DatumGetPointer(PG_DETOAST_DATUM(entry->key)); + SmlSign *key = (SmlSign*)PG_DETOAST_DATUM(entry->key); if (key != (SmlSign *) DatumGetPointer(entry->key)) {