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

Commit8fa393a

Browse files
committed
Minor cleanup of GiST code, for readability.
Remove the gistcentryinit function, inlining the relevant part of it intothe only caller.
1 parentbed756a commit8fa393a

File tree

2 files changed

+16
-40
lines changed

2 files changed

+16
-40
lines changed

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

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -558,61 +558,41 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
558558
gistentryinit(*e, (Datum)0,r,pg,o,l);
559559
}
560560

561-
562-
/*
563-
* initialize a GiST entry with a compressed version of key
564-
*/
565-
void
566-
gistcentryinit(GISTSTATE*giststate,intnkey,
567-
GISTENTRY*e,Datumk,Relationr,
568-
Pagepg,OffsetNumbero,booll,boolisNull)
569-
{
570-
if (!isNull)
571-
{
572-
GISTENTRY*cep;
573-
574-
gistentryinit(*e,k,r,pg,o,l);
575-
cep= (GISTENTRY*)
576-
DatumGetPointer(FunctionCall1Coll(&giststate->compressFn[nkey],
577-
giststate->supportCollation[nkey],
578-
PointerGetDatum(e)));
579-
/* compressFn may just return the given pointer */
580-
if (cep!=e)
581-
gistentryinit(*e,cep->key,cep->rel,cep->page,cep->offset,
582-
cep->leafkey);
583-
}
584-
else
585-
gistentryinit(*e, (Datum)0,r,pg,o,l);
586-
}
587-
588561
IndexTuple
589562
gistFormTuple(GISTSTATE*giststate,Relationr,
590-
Datumattdata[],boolisnull[],boolnewValues)
563+
Datumattdata[],boolisnull[],boolisleaf)
591564
{
592-
GISTENTRYcentry[INDEX_MAX_KEYS];
593565
Datumcompatt[INDEX_MAX_KEYS];
594566
inti;
595567
IndexTupleres;
596568

569+
/*
570+
* Call the compress method on each attribute.
571+
*/
597572
for (i=0;i<r->rd_att->natts;i++)
598573
{
599574
if (isnull[i])
600575
compatt[i]= (Datum)0;
601576
else
602577
{
603-
gistcentryinit(giststate,i,&centry[i],attdata[i],
604-
r,NULL, (OffsetNumber)0,
605-
newValues,
606-
FALSE);
607-
compatt[i]=centry[i].key;
578+
GISTENTRYcentry;
579+
GISTENTRY*cep;
580+
581+
gistentryinit(centry,attdata[i],r,NULL, (OffsetNumber)0,
582+
isleaf);
583+
cep= (GISTENTRY*)
584+
DatumGetPointer(FunctionCall1Coll(&giststate->compressFn[i],
585+
giststate->supportCollation[i],
586+
PointerGetDatum(&centry)));
587+
compatt[i]=cep->key;
608588
}
609589
}
610590

611591
res=index_form_tuple(giststate->tupdesc,compatt,isnull);
612592

613593
/*
614594
* The offset number on tuples on internal pages is unused. For historical
615-
* reasons, it is set 0xffff.
595+
* reasons, it is setto0xffff.
616596
*/
617597
ItemPointerSetOffsetNumber(&(res->t_tid),0xffff);
618598
returnres;

‎src/include/access/gist_private.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,11 @@ extern IndexTuple gistgetadjusted(Relation r,
485485
IndexTupleaddtup,
486486
GISTSTATE*giststate);
487487
externIndexTuplegistFormTuple(GISTSTATE*giststate,
488-
Relationr,Datum*attdata,bool*isnull,boolnewValues);
488+
Relationr,Datum*attdata,bool*isnull,boolisleaf);
489489

490490
externOffsetNumbergistchoose(Relationr,Pagep,
491491
IndexTupleit,
492492
GISTSTATE*giststate);
493-
externvoidgistcentryinit(GISTSTATE*giststate,intnkey,
494-
GISTENTRY*e,Datumk,
495-
Relationr,Pagepg,
496-
OffsetNumbero,booll,boolisNull);
497493

498494
externvoidGISTInitBuffer(Bufferb,uint32f);
499495
externvoidgistdentryinit(GISTSTATE*giststate,intnkey,GISTENTRY*e,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp