aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-03-05 05:30:40 +0000
committerBruce Momjian <bruce@momjian.us>2002-03-05 05:30:40 +0000
commit276fc7ce829404627075ebf8ed5ee3039923eb2b (patch)
treeb0b280d11c9029b5ef7da2db030f71efc2178230 /src/backend/access/gist
parent33766e680d815b66e108f9b6d536f1ff059c954b (diff)
downloadpostgresql-276fc7ce829404627075ebf8ed5ee3039923eb2b.tar.gz
postgresql-276fc7ce829404627075ebf8ed5ee3039923eb2b.zip
I was digging through the GiST code, and figured I'd fix up some of the
"bad smell" in that code. Stuff like function parameters that aren't used, typos in the comments, comparison between signed and unsigned ints, etc. Attached is a pretty trivial patch; it compiles, but beyond that completely untested. Unless anyone sees any problems, please apply for 7.3. Neil Conway
Diffstat (limited to 'src/backend/access/gist')
-rw-r--r--src/backend/access/gist/gist.c42
-rw-r--r--src/backend/access/gist/gistget.c6
-rw-r--r--src/backend/access/gist/gistscan.c12
3 files changed, 27 insertions, 33 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 7ca41bfd074..586e5692f8b 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.89 2002/03/02 21:39:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.90 2002/03/05 05:30:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,12 +87,10 @@ static OffsetNumber gistwritebuffer(Relation r,
Page page,
IndexTuple *itup,
int len,
- OffsetNumber off,
- GISTSTATE *giststate);
+ OffsetNumber off);
static int gistnospace(Page page,
IndexTuple *itvec, int len);
-static IndexTuple *gistreadbuffer(Relation r,
- Buffer buffer, int *len);
+static IndexTuple *gistreadbuffer(Buffer buffer, int *len);
static IndexTuple *gistjoinvector(
IndexTuple *itvec, int *len,
IndexTuple *additvec, int addlen);
@@ -117,7 +115,7 @@ static IndexTuple *gistSplit(Relation r,
int *len,
GISTSTATE *giststate,
InsertIndexResult *res);
-static void gistnewroot(GISTSTATE *giststate, Relation r,
+static void gistnewroot(Relation r,
IndexTuple *itup, int len);
static void GISTInitBuffer(Buffer b, uint32 f);
static OffsetNumber gistchoose(Relation r, Page p,
@@ -359,11 +357,11 @@ gistinsert(PG_FUNCTION_ARGS)
#ifdef GIST_PAGEADDITEM
/*
-** Take a compressed entry, and install it on a page. Since we now know
-** where the entry will live, we decompress it and recompress it using
-** that knowledge (some compression routines may want to fish around
-** on the page, for example, or do something special for leaf nodes.)
-*/
+ * Take a compressed entry, and install it on a page. Since we now know
+ * where the entry will live, we decompress it and recompress it using
+ * that knowledge (some compression routines may want to fish around
+ * on the page, for example, or do something special for leaf nodes.)
+ */
static OffsetNumber
gistPageAddItem(GISTSTATE *giststate,
Relation r,
@@ -425,7 +423,7 @@ gistdoinsert(Relation r,
ret = gistlayerinsert(r, GISTP_ROOT, &instup, &len, res, giststate);
if (ret & SPLITED)
- gistnewroot(giststate, r, instup, len);
+ gistnewroot(r, instup, len);
for (i = 0; i < len; i++)
pfree(instup[i]);
@@ -452,7 +450,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
if (!(opaque->flags & F_LEAF))
{
/* internal page, so we must walk on tree */
- /* len IS equial 1 */
+ /* len IS equal 1 */
ItemId iid;
BlockNumber nblkno;
ItemPointerData oldtid;
@@ -509,7 +507,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
oldlen;
ret |= SPLITED;
- itvec = gistreadbuffer(r, buffer, &tlen);
+ itvec = gistreadbuffer(buffer, &tlen);
itvec = gistjoinvector(itvec, &tlen, (*itup), *len);
oldlen = *len;
newitup = gistSplit(r, buffer, itvec, &tlen, giststate,
@@ -534,7 +532,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
FirstOffsetNumber
:
OffsetNumberNext(PageGetMaxOffsetNumber(page));
- l = gistwritebuffer(r, page, (*itup), *len, off, giststate);
+ l = gistwritebuffer(r, page, (*itup), *len, off);
WriteBuffer(buffer);
/*
@@ -570,7 +568,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
*/
static OffsetNumber
gistwritebuffer(Relation r, Page page, IndexTuple *itup,
- int len, OffsetNumber off, GISTSTATE *giststate)
+ int len, OffsetNumber off)
{
OffsetNumber l = InvalidOffsetNumber;
int i;
@@ -609,7 +607,7 @@ gistwritebuffer(Relation r, Page page, IndexTuple *itup,
static int
gistnospace(Page page, IndexTuple *itvec, int len)
{
- int size = 0;
+ unsigned int size = 0;
int i;
for (i = 0; i < len; i++)
@@ -622,7 +620,7 @@ gistnospace(Page page, IndexTuple *itvec, int len)
* Read buffer into itup vector
*/
static IndexTuple *
-gistreadbuffer(Relation r, Buffer buffer, int *len /* out */ )
+gistreadbuffer(Buffer buffer, int *len /* out */ )
{
OffsetNumber i,
maxoff;
@@ -1365,7 +1363,7 @@ gistSplit(Relation r,
{
OffsetNumber l;
- l = gistwritebuffer(r, right, rvectup, v.spl_nright, FirstOffsetNumber, giststate);
+ l = gistwritebuffer(r, right, rvectup, v.spl_nright, FirstOffsetNumber);
WriteBuffer(rightbuf);
if (res)
@@ -1398,7 +1396,7 @@ gistSplit(Relation r,
{
OffsetNumber l;
- l = gistwritebuffer(r, left, lvectup, v.spl_nleft, FirstOffsetNumber, giststate);
+ l = gistwritebuffer(r, left, lvectup, v.spl_nleft, FirstOffsetNumber);
if (BufferGetBlockNumber(buffer) != GISTP_ROOT)
PageRestoreTempPage(left, p);
@@ -1428,7 +1426,7 @@ gistSplit(Relation r,
}
static void
-gistnewroot(GISTSTATE *giststate, Relation r, IndexTuple *itup, int len)
+gistnewroot(Relation r, IndexTuple *itup, int len)
{
Buffer b;
Page p;
@@ -1437,7 +1435,7 @@ gistnewroot(GISTSTATE *giststate, Relation r, IndexTuple *itup, int len)
GISTInitBuffer(b, 0);
p = BufferGetPage(b);
- gistwritebuffer(r, p, itup, len, FirstOffsetNumber, giststate);
+ gistwritebuffer(r, p, itup, len, FirstOffsetNumber);
WriteBuffer(b);
}
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index ed92258e624..826644288a2 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.31 2001/10/25 05:49:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.32 2002/03/05 05:30:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@ static RetrieveIndexResult gistscancache(IndexScanDesc s, ScanDirection dir);
static RetrieveIndexResult gistfirst(IndexScanDesc s, ScanDirection dir);
static RetrieveIndexResult gistnext(IndexScanDesc s, ScanDirection dir);
static ItemPointer gistheapptr(Relation r, ItemPointer itemp);
-static bool gistindex_keytest(IndexTuple tuple, TupleDesc tupdesc,
+static bool gistindex_keytest(IndexTuple tuple,
int scanKeySize, ScanKey key, GISTSTATE *giststate,
Relation r, Page p, OffsetNumber offset);
@@ -219,7 +219,6 @@ gistnext(IndexScanDesc s, ScanDirection dir)
/* Similar to index_keytest, but decompresses the key in the IndexTuple */
static bool
gistindex_keytest(IndexTuple tuple,
- TupleDesc tupdesc,
int scanKeySize,
ScanKey key,
GISTSTATE *giststate,
@@ -314,7 +313,6 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
{
it = (IndexTuple) PageGetItem(p, PageGetItemId(p, n));
if (gistindex_keytest(it,
- RelationGetDescr(s->relation),
s->numberOfKeys, s->keyData, giststate,
s->relation, p, n))
break;
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index 8623b8f643e..2d3a4f69419 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.40 2001/10/25 05:49:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.41 2002/03/05 05:30:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,8 +24,7 @@ static void gistregscan(IndexScanDesc s);
static void gistdropscan(IndexScanDesc s);
static void gistadjone(IndexScanDesc s, int op, BlockNumber blkno,
OffsetNumber offnum);
-static void adjuststack(GISTSTACK *stk, BlockNumber blkno,
- OffsetNumber offnum);
+static void adjuststack(GISTSTACK *stk, BlockNumber blkno);
static void adjustiptr(IndexScanDesc s, ItemPointer iptr,
int op, BlockNumber blkno, OffsetNumber offnum);
@@ -340,8 +339,8 @@ gistadjone(IndexScanDesc s,
if (op == GISTOP_SPLIT)
{
- adjuststack(so->s_stack, blkno, offnum);
- adjuststack(so->s_markstk, blkno, offnum);
+ adjuststack(so->s_stack, blkno);
+ adjuststack(so->s_markstk, blkno);
}
}
@@ -428,8 +427,7 @@ adjustiptr(IndexScanDesc s,
/*ARGSUSED*/
static void
adjuststack(GISTSTACK *stk,
- BlockNumber blkno,
- OffsetNumber offnum)
+ BlockNumber blkno)
{
while (stk != (GISTSTACK *) NULL)
{