Skip to content

Commit eb0d00a

Browse files
author
Neil Conway
committed
Various style cleanups for GiST; no changes to functionality.
1 parent c9a382b commit eb0d00a

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed

src/backend/access/gist/gist.c

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -25,9 +25,9 @@
2525

2626
#undef GIST_PAGEADDITEM
2727

28-
#define ATTSIZE( datum, TupDesc, i, isnull ) \
28+
#define ATTSIZE(datum, TupDesc, i, isnull) \
2929
( \
30-
( isnull ) ? 0 : \
30+
(isnull) ? 0 : \
3131
att_addlength(0, (TupDesc)->attrs[(i)-1]->attlen, (datum)) \
3232
)
3333

@@ -45,12 +45,12 @@
4545
* and gistadjsubkey only
4646
*/
4747
#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); \
5151
} else { \
52-
gistentryinit((evp), okey, r, NULL, \
53-
(OffsetNumber) 0, okeyb, FALSE); \
52+
gistentryinit((evp), okey, r, NULL, \
53+
(OffsetNumber) 0, okeyb, FALSE); \
5454
} \
5555
} while(0)
5656

@@ -87,8 +87,7 @@ static OffsetNumber gistwritebuffer(Relation r,
8787
IndexTuple *itup,
8888
int len,
8989
OffsetNumber off);
90-
static int gistnospace(Page page,
91-
IndexTuple *itvec, int len);
90+
static bool gistnospace(Page page, IndexTuple *itvec, int len);
9291
static IndexTuple *gistreadbuffer(Buffer buffer, int *len);
9392
static IndexTuple *gistjoinvector(
9493
IndexTuple *itvec, int *len,
@@ -107,14 +106,13 @@ static void gistadjsubkey(Relation r,
107106
GIST_SPLITVEC *v,
108107
GISTSTATE *giststate);
109108
static IndexTuple gistFormTuple(GISTSTATE *giststate,
110-
Relation r, Datum attdata[], int datumsize[], bool isnull[]);
109+
Relation r, Datum *attdata, int *datumsize, bool *isnull);
111110
static IndexTuple *gistSplit(Relation r,
112111
Buffer buffer,
113112
IndexTuple *itup,
114113
int *len,
115114
GISTSTATE *giststate);
116-
static void gistnewroot(Relation r,
117-
IndexTuple *itup, int len);
115+
static void gistnewroot(Relation r, IndexTuple *itup, int len);
118116
static void GISTInitBuffer(Buffer b, uint32 f);
119117
static OffsetNumber gistchoose(Relation r, Page p,
120118
IndexTuple it,
@@ -131,8 +129,8 @@ static void gistcentryinit(GISTSTATE *giststate, int nkey,
131129
OffsetNumber o, int b, bool l, bool isNull);
132130
static void gistDeCompressAtt(GISTSTATE *giststate, Relation r,
133131
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);
136134
static void gistpenalty(GISTSTATE *giststate, int attno,
137135
GISTENTRY *key1, bool isNull1,
138136
GISTENTRY *key2, bool isNull2,
@@ -503,7 +501,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
503501
}
504502
else
505503
{
506-
/* enogth space */
504+
/* enough space */
507505
OffsetNumber off,
508506
l;
509507

@@ -577,7 +575,7 @@ gistwritebuffer(Relation r, Page page, IndexTuple *itup,
577575
/*
578576
* Check space for itup vector on page
579577
*/
580-
static int
578+
static bool
581579
gistnospace(Page page, IndexTuple *itvec, int len)
582580
{
583581
unsigned int size = 0;
@@ -934,7 +932,7 @@ gistunionsubkey(Relation r, GISTSTATE *giststate, IndexTuple *itvec, GIST_SPLITV
934932
}
935933

936934
/*
937-
* find group in vector with equial value
935+
* find group in vector with equal value
938936
*/
939937
static int
940938
gistfindgroup(GISTSTATE *giststate, GISTENTRY *valvec, GIST_SPLITVEC *spl)
@@ -949,7 +947,6 @@ gistfindgroup(GISTSTATE *giststate, GISTENTRY *valvec, GIST_SPLITVEC *spl)
949947
* first key is always not null (see gistinsert), so we may not check
950948
* for nulls
951949
*/
952-
953950
for (i = 0; i < spl->spl_nleft; i++)
954951
{
955952
if (spl->spl_idgrp[spl->spl_left[i]])
@@ -1007,8 +1004,7 @@ gistadjsubkey(Relation r,
10071004
IndexTuple *itup, /* contains compressed entry */
10081005
int *len,
10091006
GIST_SPLITVEC *v,
1010-
GISTSTATE *giststate
1011-
)
1007+
GISTSTATE *giststate)
10121008
{
10131009
int curlen;
10141010
OffsetNumber *curwpos;
@@ -1400,8 +1396,8 @@ GISTInitBuffer(Buffer b, uint32 f)
14001396

14011397

14021398
/*
1403-
** find entry with lowest penalty
1404-
*/
1399+
* find entry with lowest penalty
1400+
*/
14051401
static OffsetNumber
14061402
gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */
14071403
GISTSTATE *giststate)
@@ -1643,12 +1639,12 @@ freeGISTstate(GISTSTATE *giststate)
16431639

16441640
#ifdef GIST_PAGEADDITEM
16451641
/*
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+
*/
16521648
static IndexTuple
16531649
gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
16541650
{
@@ -1690,8 +1686,8 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
16901686
#endif
16911687

16921688
/*
1693-
** initialize a GiST entry with a decompressed version of key
1694-
*/
1689+
* initialize a GiST entry with a decompressed version of key
1690+
*/
16951691
void
16961692
gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
16971693
Datum k, Relation r, Page pg, OffsetNumber o,
@@ -1719,8 +1715,8 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
17191715

17201716

17211717
/*
1722-
** initialize a GiST entry with a compressed version of key
1723-
*/
1718+
* initialize a GiST entry with a compressed version of key
1719+
*/
17241720
static void
17251721
gistcentryinit(GISTSTATE *giststate, int nkey,
17261722
GISTENTRY *e, Datum k, Relation r,
@@ -1790,7 +1786,7 @@ gistFormTuple(GISTSTATE *giststate, Relation r,
17901786

17911787
static void
17921788
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)
17941790
{
17951791
int i;
17961792
Datum datum;
@@ -1814,7 +1810,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
18141810
}
18151811

18161812
static void
1817-
gistFreeAtt(Relation r, GISTENTRY attdata[], bool decompvec[])
1813+
gistFreeAtt(Relation r, GISTENTRY *attdata, bool *decompvec)
18181814
{
18191815
int i;
18201816

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy