* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.114 2005/05/11 06:24:50 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.115 2005/05/15 04:08:29 neilc Exp $
*
*-------------------------------------------------------------------------
*/
#undef GIST_PAGEADDITEM
-#define ATTSIZE( datum, TupDesc, i, isnull ) \
+#define ATTSIZE(datum, TupDesc, i, isnull) \
( \
- ( isnull ) ? 0 : \
+ (isnull) ? 0 : \
att_addlength(0, (TupDesc)->attrs[(i)-1]->attlen, (datum)) \
)
* and gistadjsubkey only
*/
#define FILLITEM(evp, isnullkey, okey, okeyb, rkey, rkeyb) do { \
- if ( isnullkey ) { \
- gistentryinit((evp), rkey, r, NULL, \
- (OffsetNumber) 0, rkeyb, FALSE); \
+ if (isnullkey) { \
+ gistentryinit((evp), rkey, r, NULL, \
+ (OffsetNumber) 0, rkeyb, FALSE); \
} else { \
- gistentryinit((evp), okey, r, NULL, \
- (OffsetNumber) 0, okeyb, FALSE); \
+ gistentryinit((evp), okey, r, NULL, \
+ (OffsetNumber) 0, okeyb, FALSE); \
} \
} while(0)
IndexTuple *itup,
int len,
OffsetNumber off);
-static int gistnospace(Page page,
- IndexTuple *itvec, int len);
+static bool gistnospace(Page page, IndexTuple *itvec, int len);
static IndexTuple *gistreadbuffer(Buffer buffer, int *len);
static IndexTuple *gistjoinvector(
IndexTuple *itvec, int *len,
GIST_SPLITVEC *v,
GISTSTATE *giststate);
static IndexTuple gistFormTuple(GISTSTATE *giststate,
- Relation r, Datum attdata[], int datumsize[], bool isnull[]);
+ Relation r, Datum *attdata, int *datumsize, bool *isnull);
static IndexTuple *gistSplit(Relation r,
Buffer buffer,
IndexTuple *itup,
int *len,
GISTSTATE *giststate);
-static void gistnewroot(Relation r,
- IndexTuple *itup, int len);
+static void gistnewroot(Relation r, IndexTuple *itup, int len);
static void GISTInitBuffer(Buffer b, uint32 f);
static OffsetNumber gistchoose(Relation r, Page p,
IndexTuple it,
OffsetNumber o, int b, bool l, bool isNull);
static void gistDeCompressAtt(GISTSTATE *giststate, Relation r,
IndexTuple tuple, Page p, OffsetNumber o,
- GISTENTRY attdata[], bool decompvec[], bool isnull[]);
-static void gistFreeAtt(Relation r, GISTENTRY attdata[], bool decompvec[]);
+ GISTENTRY *attdata, bool *decompvec, bool *isnull);
+static void gistFreeAtt(Relation r, GISTENTRY *attdata, bool *decompvec);
static void gistpenalty(GISTSTATE *giststate, int attno,
GISTENTRY *key1, bool isNull1,
GISTENTRY *key2, bool isNull2,
}
else
{
- /* enogth space */
+ /* enough space */
OffsetNumber off,
l;
/*
* Check space for itup vector on page
*/
-static int
+static bool
gistnospace(Page page, IndexTuple *itvec, int len)
{
unsigned int size = 0;
}
/*
- * find group in vector with equial value
+ * find group in vector with equal value
*/
static int
gistfindgroup(GISTSTATE *giststate, GISTENTRY *valvec, GIST_SPLITVEC *spl)
* first key is always not null (see gistinsert), so we may not check
* for nulls
*/
-
for (i = 0; i < spl->spl_nleft; i++)
{
if (spl->spl_idgrp[spl->spl_left[i]])
IndexTuple *itup, /* contains compressed entry */
int *len,
GIST_SPLITVEC *v,
- GISTSTATE *giststate
-)
+ GISTSTATE *giststate)
{
int curlen;
OffsetNumber *curwpos;
/*
-** find entry with lowest penalty
-*/
+ * find entry with lowest penalty
+ */
static OffsetNumber
gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */
GISTSTATE *giststate)
#ifdef GIST_PAGEADDITEM
/*
-** Given an IndexTuple to be inserted on a page, this routine replaces
-** the key with another key, which may involve generating a new IndexTuple
-** if the sizes don't match or if the null status changes.
-**
-** XXX this only works for a single-column index tuple!
-*/
+ * Given an IndexTuple to be inserted on a page, this routine replaces
+ * the key with another key, which may involve generating a new IndexTuple
+ * if the sizes don't match or if the null status changes.
+ *
+ * XXX this only works for a single-column index tuple!
+ */
static IndexTuple
gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
{
#endif
/*
-** initialize a GiST entry with a decompressed version of key
-*/
+ * initialize a GiST entry with a decompressed version of key
+ */
void
gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
Datum k, Relation r, Page pg, OffsetNumber o,
/*
-** initialize a GiST entry with a compressed version of key
-*/
+ * initialize a GiST entry with a compressed version of key
+ */
static void
gistcentryinit(GISTSTATE *giststate, int nkey,
GISTENTRY *e, Datum k, Relation r,
static void
gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
- OffsetNumber o, GISTENTRY attdata[], bool decompvec[], bool isnull[])
+ OffsetNumber o, GISTENTRY *attdata, bool *decompvec, bool *isnull)
{
int i;
Datum datum;
}
static void
-gistFreeAtt(Relation r, GISTENTRY attdata[], bool decompvec[])
+gistFreeAtt(Relation r, GISTENTRY *attdata, bool *decompvec)
{
int i;