8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.114 2005/05/11 06:24:50 neilc Exp $
11
+ * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.115 2005/05/15 04:08:29 neilc Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
25
25
26
26
#undef GIST_PAGEADDITEM
27
27
28
- #define ATTSIZE ( datum , TupDesc , i , isnull ) \
28
+ #define ATTSIZE (datum , TupDesc , i , isnull ) \
29
29
( \
30
- ( isnull ) ? 0 : \
30
+ (isnull) ? 0 : \
31
31
att_addlength(0, (TupDesc)->attrs[(i)-1]->attlen, (datum)) \
32
32
)
33
33
45
45
* and gistadjsubkey only
46
46
*/
47
47
#define FILLITEM (evp , isnullkey , okey , okeyb , rkey , rkeyb ) do { \
48
- if ( isnullkey ) { \
49
- gistentryinit((evp), rkey, r, NULL, \
50
- (OffsetNumber) 0, rkeyb, FALSE); \
48
+ if (isnullkey) { \
49
+ gistentryinit((evp), rkey, r, NULL, \
50
+ (OffsetNumber) 0, rkeyb, FALSE); \
51
51
} else { \
52
- gistentryinit((evp), okey, r, NULL, \
53
- (OffsetNumber) 0, okeyb, FALSE); \
52
+ gistentryinit((evp), okey, r, NULL, \
53
+ (OffsetNumber) 0, okeyb, FALSE); \
54
54
} \
55
55
} while(0)
56
56
@@ -87,8 +87,7 @@ static OffsetNumber gistwritebuffer(Relation r,
87
87
IndexTuple * itup ,
88
88
int len ,
89
89
OffsetNumber off );
90
- static int gistnospace (Page page ,
91
- IndexTuple * itvec , int len );
90
+ static bool gistnospace (Page page , IndexTuple * itvec , int len );
92
91
static IndexTuple * gistreadbuffer (Buffer buffer , int * len );
93
92
static IndexTuple * gistjoinvector (
94
93
IndexTuple * itvec , int * len ,
@@ -107,14 +106,13 @@ static void gistadjsubkey(Relation r,
107
106
GIST_SPLITVEC * v ,
108
107
GISTSTATE * giststate );
109
108
static IndexTuple gistFormTuple (GISTSTATE * giststate ,
110
- Relation r , Datum attdata [] , int datumsize [] , bool isnull [] );
109
+ Relation r , Datum * attdata , int * datumsize , bool * isnull );
111
110
static IndexTuple * gistSplit (Relation r ,
112
111
Buffer buffer ,
113
112
IndexTuple * itup ,
114
113
int * len ,
115
114
GISTSTATE * giststate );
116
- static void gistnewroot (Relation r ,
117
- IndexTuple * itup , int len );
115
+ static void gistnewroot (Relation r , IndexTuple * itup , int len );
118
116
static void GISTInitBuffer (Buffer b , uint32 f );
119
117
static OffsetNumber gistchoose (Relation r , Page p ,
120
118
IndexTuple it ,
@@ -131,8 +129,8 @@ static void gistcentryinit(GISTSTATE *giststate, int nkey,
131
129
OffsetNumber o , int b , bool l , bool isNull );
132
130
static void gistDeCompressAtt (GISTSTATE * giststate , Relation r ,
133
131
IndexTuple tuple , Page p , OffsetNumber o ,
134
- GISTENTRY attdata [] , bool decompvec [] , bool isnull [] );
135
- static void gistFreeAtt (Relation r , GISTENTRY attdata [] , bool decompvec [] );
132
+ GISTENTRY * attdata , bool * decompvec , bool * isnull );
133
+ static void gistFreeAtt (Relation r , GISTENTRY * attdata , bool * decompvec );
136
134
static void gistpenalty (GISTSTATE * giststate , int attno ,
137
135
GISTENTRY * key1 , bool isNull1 ,
138
136
GISTENTRY * key2 , bool isNull2 ,
@@ -503,7 +501,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
503
501
}
504
502
else
505
503
{
506
- /* enogth space */
504
+ /* enough space */
507
505
OffsetNumber off ,
508
506
l ;
509
507
@@ -577,7 +575,7 @@ gistwritebuffer(Relation r, Page page, IndexTuple *itup,
577
575
/*
578
576
* Check space for itup vector on page
579
577
*/
580
- static int
578
+ static bool
581
579
gistnospace (Page page , IndexTuple * itvec , int len )
582
580
{
583
581
unsigned int size = 0 ;
@@ -934,7 +932,7 @@ gistunionsubkey(Relation r, GISTSTATE *giststate, IndexTuple *itvec, GIST_SPLITV
934
932
}
935
933
936
934
/*
937
- * find group in vector with equial value
935
+ * find group in vector with equal value
938
936
*/
939
937
static int
940
938
gistfindgroup (GISTSTATE * giststate , GISTENTRY * valvec , GIST_SPLITVEC * spl )
@@ -949,7 +947,6 @@ gistfindgroup(GISTSTATE *giststate, GISTENTRY *valvec, GIST_SPLITVEC *spl)
949
947
* first key is always not null (see gistinsert), so we may not check
950
948
* for nulls
951
949
*/
952
-
953
950
for (i = 0 ; i < spl -> spl_nleft ; i ++ )
954
951
{
955
952
if (spl -> spl_idgrp [spl -> spl_left [i ]])
@@ -1007,8 +1004,7 @@ gistadjsubkey(Relation r,
1007
1004
IndexTuple * itup , /* contains compressed entry */
1008
1005
int * len ,
1009
1006
GIST_SPLITVEC * v ,
1010
- GISTSTATE * giststate
1011
- )
1007
+ GISTSTATE * giststate )
1012
1008
{
1013
1009
int curlen ;
1014
1010
OffsetNumber * curwpos ;
@@ -1400,8 +1396,8 @@ GISTInitBuffer(Buffer b, uint32 f)
1400
1396
1401
1397
1402
1398
/*
1403
- * * find entry with lowest penalty
1404
- */
1399
+ * find entry with lowest penalty
1400
+ */
1405
1401
static OffsetNumber
1406
1402
gistchoose (Relation r , Page p , IndexTuple it , /* it has compressed entry */
1407
1403
GISTSTATE * giststate )
@@ -1643,12 +1639,12 @@ freeGISTstate(GISTSTATE *giststate)
1643
1639
1644
1640
#ifdef GIST_PAGEADDITEM
1645
1641
/*
1646
- * * Given an IndexTuple to be inserted on a page, this routine replaces
1647
- * * the key with another key, which may involve generating a new IndexTuple
1648
- * * if the sizes don't match or if the null status changes.
1649
- * *
1650
- * * XXX this only works for a single-column index tuple!
1651
- */
1642
+ * Given an IndexTuple to be inserted on a page, this routine replaces
1643
+ * the key with another key, which may involve generating a new IndexTuple
1644
+ * if the sizes don't match or if the null status changes.
1645
+ *
1646
+ * XXX this only works for a single-column index tuple!
1647
+ */
1652
1648
static IndexTuple
1653
1649
gist_tuple_replacekey (Relation r , GISTENTRY entry , IndexTuple t )
1654
1650
{
@@ -1690,8 +1686,8 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
1690
1686
#endif
1691
1687
1692
1688
/*
1693
- * * initialize a GiST entry with a decompressed version of key
1694
- */
1689
+ * initialize a GiST entry with a decompressed version of key
1690
+ */
1695
1691
void
1696
1692
gistdentryinit (GISTSTATE * giststate , int nkey , GISTENTRY * e ,
1697
1693
Datum k , Relation r , Page pg , OffsetNumber o ,
@@ -1719,8 +1715,8 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
1719
1715
1720
1716
1721
1717
/*
1722
- * * initialize a GiST entry with a compressed version of key
1723
- */
1718
+ * initialize a GiST entry with a compressed version of key
1719
+ */
1724
1720
static void
1725
1721
gistcentryinit (GISTSTATE * giststate , int nkey ,
1726
1722
GISTENTRY * e , Datum k , Relation r ,
@@ -1790,7 +1786,7 @@ gistFormTuple(GISTSTATE *giststate, Relation r,
1790
1786
1791
1787
static void
1792
1788
gistDeCompressAtt (GISTSTATE * giststate , Relation r , IndexTuple tuple , Page p ,
1793
- OffsetNumber o , GISTENTRY attdata [] , bool decompvec [] , bool isnull [] )
1789
+ OffsetNumber o , GISTENTRY * attdata , bool * decompvec , bool * isnull )
1794
1790
{
1795
1791
int i ;
1796
1792
Datum datum ;
@@ -1814,7 +1810,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
1814
1810
}
1815
1811
1816
1812
static void
1817
- gistFreeAtt (Relation r , GISTENTRY attdata [] , bool decompvec [] )
1813
+ gistFreeAtt (Relation r , GISTENTRY * attdata , bool * decompvec )
1818
1814
{
1819
1815
int i ;
1820
1816
0 commit comments