Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit276fc7c

Browse files
committed
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'tused, typos in the comments, comparison between signed and unsignedints, etc.Attached is a pretty trivial patch; it compiles, but beyond thatcompletely untested. Unless anyone sees any problems, please apply for7.3.Neil Conway
1 parent33766e6 commit276fc7c

File tree

4 files changed

+32
-40
lines changed

4 files changed

+32
-40
lines changed

‎src/backend/access/gist/gist.c

Lines changed: 20 additions & 22 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-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.89 2002/03/02 21:39:16 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.90 2002/03/05 05:30:31 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -87,12 +87,10 @@ static OffsetNumber gistwritebuffer(Relation r,
8787
Pagepage,
8888
IndexTuple*itup,
8989
intlen,
90-
OffsetNumberoff,
91-
GISTSTATE*giststate);
90+
OffsetNumberoff);
9291
staticintgistnospace(Pagepage,
9392
IndexTuple*itvec,intlen);
94-
staticIndexTuple*gistreadbuffer(Relationr,
95-
Bufferbuffer,int*len);
93+
staticIndexTuple*gistreadbuffer(Bufferbuffer,int*len);
9694
staticIndexTuple*gistjoinvector(
9795
IndexTuple*itvec,int*len,
9896
IndexTuple*additvec,intaddlen);
@@ -117,7 +115,7 @@ static IndexTuple *gistSplit(Relation r,
117115
int*len,
118116
GISTSTATE*giststate,
119117
InsertIndexResult*res);
120-
staticvoidgistnewroot(GISTSTATE*giststate,Relationr,
118+
staticvoidgistnewroot(Relationr,
121119
IndexTuple*itup,intlen);
122120
staticvoidGISTInitBuffer(Bufferb,uint32f);
123121
staticOffsetNumbergistchoose(Relationr,Pagep,
@@ -359,11 +357,11 @@ gistinsert(PG_FUNCTION_ARGS)
359357

360358
#ifdefGIST_PAGEADDITEM
361359
/*
362-
** Take a compressed entry, and install it on a page. Since we now know
363-
** where the entry will live, we decompress it and recompress it using
364-
** that knowledge (some compression routines may want to fish around
365-
** on the page, for example, or do something special for leaf nodes.)
366-
*/
360+
* Take a compressed entry, and install it on a page. Since we now know
361+
* where the entry will live, we decompress it and recompress it using
362+
* that knowledge (some compression routines may want to fish around
363+
* on the page, for example, or do something special for leaf nodes.)
364+
*/
367365
staticOffsetNumber
368366
gistPageAddItem(GISTSTATE*giststate,
369367
Relationr,
@@ -425,7 +423,7 @@ gistdoinsert(Relation r,
425423

426424
ret=gistlayerinsert(r,GISTP_ROOT,&instup,&len,res,giststate);
427425
if (ret&SPLITED)
428-
gistnewroot(giststate,r,instup,len);
426+
gistnewroot(r,instup,len);
429427

430428
for (i=0;i<len;i++)
431429
pfree(instup[i]);
@@ -452,7 +450,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
452450
if (!(opaque->flags&F_LEAF))
453451
{
454452
/* internal page, so we must walk on tree */
455-
/* len ISequial 1 */
453+
/* len ISequal 1 */
456454
ItemIdiid;
457455
BlockNumbernblkno;
458456
ItemPointerDataoldtid;
@@ -509,7 +507,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
509507
oldlen;
510508

511509
ret |=SPLITED;
512-
itvec=gistreadbuffer(r,buffer,&tlen);
510+
itvec=gistreadbuffer(buffer,&tlen);
513511
itvec=gistjoinvector(itvec,&tlen, (*itup),*len);
514512
oldlen=*len;
515513
newitup=gistSplit(r,buffer,itvec,&tlen,giststate,
@@ -534,7 +532,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
534532
FirstOffsetNumber
535533
:
536534
OffsetNumberNext(PageGetMaxOffsetNumber(page));
537-
l=gistwritebuffer(r,page, (*itup),*len,off,giststate);
535+
l=gistwritebuffer(r,page, (*itup),*len,off);
538536
WriteBuffer(buffer);
539537

540538
/*
@@ -570,7 +568,7 @@ gistlayerinsert(Relation r, BlockNumber blkno,
570568
*/
571569
staticOffsetNumber
572570
gistwritebuffer(Relationr,Pagepage,IndexTuple*itup,
573-
intlen,OffsetNumberoff,GISTSTATE*giststate)
571+
intlen,OffsetNumberoff)
574572
{
575573
OffsetNumberl=InvalidOffsetNumber;
576574
inti;
@@ -609,7 +607,7 @@ gistwritebuffer(Relation r, Page page, IndexTuple *itup,
609607
staticint
610608
gistnospace(Pagepage,IndexTuple*itvec,intlen)
611609
{
612-
intsize=0;
610+
unsignedintsize=0;
613611
inti;
614612

615613
for (i=0;i<len;i++)
@@ -622,7 +620,7 @@ gistnospace(Page page, IndexTuple *itvec, int len)
622620
* Read buffer into itup vector
623621
*/
624622
staticIndexTuple*
625-
gistreadbuffer(Relationr,Bufferbuffer,int*len/* out */ )
623+
gistreadbuffer(Bufferbuffer,int*len/* out */ )
626624
{
627625
OffsetNumberi,
628626
maxoff;
@@ -1365,7 +1363,7 @@ gistSplit(Relation r,
13651363
{
13661364
OffsetNumberl;
13671365

1368-
l=gistwritebuffer(r,right,rvectup,v.spl_nright,FirstOffsetNumber,giststate);
1366+
l=gistwritebuffer(r,right,rvectup,v.spl_nright,FirstOffsetNumber);
13691367
WriteBuffer(rightbuf);
13701368

13711369
if (res)
@@ -1398,7 +1396,7 @@ gistSplit(Relation r,
13981396
{
13991397
OffsetNumberl;
14001398

1401-
l=gistwritebuffer(r,left,lvectup,v.spl_nleft,FirstOffsetNumber,giststate);
1399+
l=gistwritebuffer(r,left,lvectup,v.spl_nleft,FirstOffsetNumber);
14021400
if (BufferGetBlockNumber(buffer)!=GISTP_ROOT)
14031401
PageRestoreTempPage(left,p);
14041402

@@ -1428,7 +1426,7 @@ gistSplit(Relation r,
14281426
}
14291427

14301428
staticvoid
1431-
gistnewroot(GISTSTATE*giststate,Relationr,IndexTuple*itup,intlen)
1429+
gistnewroot(Relationr,IndexTuple*itup,intlen)
14321430
{
14331431
Bufferb;
14341432
Pagep;
@@ -1437,7 +1435,7 @@ gistnewroot(GISTSTATE *giststate, Relation r, IndexTuple *itup, int len)
14371435
GISTInitBuffer(b,0);
14381436
p=BufferGetPage(b);
14391437

1440-
gistwritebuffer(r,p,itup,len,FirstOffsetNumber,giststate);
1438+
gistwritebuffer(r,p,itup,len,FirstOffsetNumber);
14411439
WriteBuffer(b);
14421440
}
14431441

‎src/backend/access/gist/gistget.c

Lines changed: 2 additions & 4 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-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.31 2001/10/25 05:49:20 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.32 2002/03/05 05:30:31 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -24,7 +24,7 @@ static RetrieveIndexResult gistscancache(IndexScanDesc s, ScanDirection dir);
2424
staticRetrieveIndexResultgistfirst(IndexScanDescs,ScanDirectiondir);
2525
staticRetrieveIndexResultgistnext(IndexScanDescs,ScanDirectiondir);
2626
staticItemPointergistheapptr(Relationr,ItemPointeritemp);
27-
staticboolgistindex_keytest(IndexTupletuple,TupleDesctupdesc,
27+
staticboolgistindex_keytest(IndexTupletuple,
2828
intscanKeySize,ScanKeykey,GISTSTATE*giststate,
2929
Relationr,Pagep,OffsetNumberoffset);
3030

@@ -219,7 +219,6 @@ gistnext(IndexScanDesc s, ScanDirection dir)
219219
/* Similar to index_keytest, but decompresses the key in the IndexTuple */
220220
staticbool
221221
gistindex_keytest(IndexTupletuple,
222-
TupleDesctupdesc,
223222
intscanKeySize,
224223
ScanKeykey,
225224
GISTSTATE*giststate,
@@ -314,7 +313,6 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
314313
{
315314
it= (IndexTuple)PageGetItem(p,PageGetItemId(p,n));
316315
if (gistindex_keytest(it,
317-
RelationGetDescr(s->relation),
318316
s->numberOfKeys,s->keyData,giststate,
319317
s->relation,p,n))
320318
break;

‎src/backend/access/gist/gistscan.c

Lines changed: 5 additions & 7 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-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.40 2001/10/25 05:49:20 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.41 2002/03/05 05:30:35 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -24,8 +24,7 @@ static void gistregscan(IndexScanDesc s);
2424
staticvoidgistdropscan(IndexScanDescs);
2525
staticvoidgistadjone(IndexScanDescs,intop,BlockNumberblkno,
2626
OffsetNumberoffnum);
27-
staticvoidadjuststack(GISTSTACK*stk,BlockNumberblkno,
28-
OffsetNumberoffnum);
27+
staticvoidadjuststack(GISTSTACK*stk,BlockNumberblkno);
2928
staticvoidadjustiptr(IndexScanDescs,ItemPointeriptr,
3029
intop,BlockNumberblkno,OffsetNumberoffnum);
3130

@@ -340,8 +339,8 @@ gistadjone(IndexScanDesc s,
340339

341340
if (op==GISTOP_SPLIT)
342341
{
343-
adjuststack(so->s_stack,blkno,offnum);
344-
adjuststack(so->s_markstk,blkno,offnum);
342+
adjuststack(so->s_stack,blkno);
343+
adjuststack(so->s_markstk,blkno);
345344
}
346345
}
347346

@@ -428,8 +427,7 @@ adjustiptr(IndexScanDesc s,
428427
/*ARGSUSED*/
429428
staticvoid
430429
adjuststack(GISTSTACK*stk,
431-
BlockNumberblkno,
432-
OffsetNumberoffnum)
430+
BlockNumberblkno)
433431
{
434432
while (stk!= (GISTSTACK*)NULL)
435433
{

‎src/backend/access/rtree/rtscan.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.39 2001/10/25 05:49:21 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.40 2002/03/05 05:30:40 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -25,8 +25,7 @@ static void rtregscan(IndexScanDesc s);
2525
staticvoidrtdropscan(IndexScanDescs);
2626
staticvoidrtadjone(IndexScanDescs,intop,BlockNumberblkno,
2727
OffsetNumberoffnum);
28-
staticvoidadjuststack(RTSTACK*stk,BlockNumberblkno,
29-
OffsetNumberoffnum);
28+
staticvoidadjuststack(RTSTACK*stk,BlockNumberblkno);
3029
staticvoidadjustiptr(IndexScanDescs,ItemPointeriptr,
3130
intop,BlockNumberblkno,OffsetNumberoffnum);
3231

@@ -337,8 +336,8 @@ rtadjone(IndexScanDesc s,
337336

338337
if (op==RTOP_SPLIT)
339338
{
340-
adjuststack(so->s_stack,blkno,offnum);
341-
adjuststack(so->s_markstk,blkno,offnum);
339+
adjuststack(so->s_stack,blkno);
340+
adjuststack(so->s_markstk,blkno);
342341
}
343342
}
344343

@@ -425,8 +424,7 @@ adjustiptr(IndexScanDesc s,
425424
/*ARGSUSED*/
426425
staticvoid
427426
adjuststack(RTSTACK*stk,
428-
BlockNumberblkno,
429-
OffsetNumberoffnum)
427+
BlockNumberblkno)
430428
{
431429
while (stk!= (RTSTACK*)NULL)
432430
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp