aboutsummaryrefslogtreecommitdiff
path: root/contrib/btree_gist/btree_ts.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2004-03-30 15:45:33 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2004-03-30 15:45:33 +0000
commitf2c064afcbfad4999d7e9ccb644a8aa99463a1ac (patch)
treea630e42b10478f1d88b637a96114945016faa2e0 /contrib/btree_gist/btree_ts.c
parent8d9a28eeefc477638cca58d0685635271eae49d6 (diff)
downloadpostgresql-f2c064afcbfad4999d7e9ccb644a8aa99463a1ac.tar.gz
postgresql-f2c064afcbfad4999d7e9ccb644a8aa99463a1ac.zip
Cleanup vectors of GISTENTRY and eliminate problem with 64-bit strict-aligned
boxes. Change interface to user-defined GiST support methods union and picksplit. Now instead of bytea struct it used special GistEntryVector structure.
Diffstat (limited to 'contrib/btree_gist/btree_ts.c')
-rw-r--r--contrib/btree_gist/btree_ts.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c
index 59fdcdba5cd..658528dcb99 100644
--- a/contrib/btree_gist/btree_ts.c
+++ b/contrib/btree_gist/btree_ts.c
@@ -146,22 +146,22 @@ gts_consistent(PG_FUNCTION_ARGS)
Datum
gts_union(PG_FUNCTION_ARGS)
{
- bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
+ GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
int i,
numranges;
TSKEY *cur,
*out = palloc(sizeof(TSKEY));
- numranges = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
+ numranges = entryvec->n;
*(int *) PG_GETARG_POINTER(1) = sizeof(TSKEY);
- cur = (TSKEY *) DatumGetPointer((((GISTENTRY *) (VARDATA(entryvec)))[0].key));
+ cur = (TSKEY *) DatumGetPointer((entryvec->vector[0].key));
out->lower = cur->lower;
out->upper = cur->upper;
for (i = 1; i < numranges; i++)
{
- cur = (TSKEY *) DatumGetPointer((((GISTENTRY *) (VARDATA(entryvec)))[i].key));
+ cur = (TSKEY *) DatumGetPointer((entryvec->vector[i].key));
if (TSGT(&out->lower, &cur->lower))
out->lower = cur->lower;
if (TSLT(&out->upper, &cur->upper))
@@ -204,7 +204,7 @@ Datum
gts_picksplit(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(btree_picksplit(
- (bytea *) PG_GETARG_POINTER(0),
+ (GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
gts_binary_union,
tskey_cmp