Skip to content

Commit f2d1205

Browse files
committed
Another batch of fmgr updates. I think I have gotten all old-style
functions that take pass-by-value datatypes. Should be ready for port testing ...
1 parent 8f057d9 commit f2d1205

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1642
-1594
lines changed

src/backend/access/gist/gist.c

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.55 2000/05/30 04:24:28 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.56 2000/06/13 07:34:27 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -47,7 +47,6 @@ static BlockNumber gistChooseSubtree(Relation r, IndexTuple itup, int level,
4747
static OffsetNumber gistchoose(Relation r, Page p, IndexTuple it,
4848
GISTSTATE *giststate);
4949
static int gistnospace(Page p, IndexTuple it);
50-
void gistdelete(Relation r, ItemPointer tid);
5150
static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t);
5251
static void gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
5352
Relation r, Page pg, OffsetNumber o, int b, bool l);
@@ -60,17 +59,20 @@ static char *int_range_out(INTRANGE *r);
6059
/*
6160
** routine to build an index. Basically calls insert over and over
6261
*/
63-
void
64-
gistbuild(Relation heap,
65-
Relation index,
66-
int natts,
67-
AttrNumber *attnum,
68-
IndexStrategy istrat,
69-
uint16 pint,
70-
Datum *params,
71-
FuncIndexInfo *finfo,
72-
PredInfo *predInfo)
62+
Datum
63+
gistbuild(PG_FUNCTION_ARGS)
7364
{
65+
Relation heap = (Relation) PG_GETARG_POINTER(0);
66+
Relation index = (Relation) PG_GETARG_POINTER(1);
67+
int32 natts = PG_GETARG_INT32(2);
68+
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
69+
#ifdef NOT_USED
70+
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
71+
uint16 pcount = PG_GETARG_UINT16(5);
72+
Datum *params = (Datum *) PG_GETARG_POINTER(6);
73+
#endif
74+
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
75+
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
7476
HeapScanDesc scan;
7577
AttrNumber i;
7678
HeapTuple htup;
@@ -83,12 +85,10 @@ gistbuild(Relation heap,
8385
int nb,
8486
nh,
8587
ni;
86-
8788
#ifndef OMIT_PARTIAL_INDEX
8889
ExprContext *econtext;
8990
TupleTable tupleTable;
9091
TupleTableSlot *slot;
91-
9292
#endif
9393
Node *pred,
9494
*oldPred;
@@ -302,6 +302,8 @@ gistbuild(Relation heap,
302302
/* be tidy */
303303
pfree(nulls);
304304
pfree(d);
305+
306+
PG_RETURN_POINTER(NULL); /* no real return value */
305307
}
306308

307309
/*
@@ -310,9 +312,16 @@ gistbuild(Relation heap,
310312
* This is the public interface routine for tuple insertion in GiSTs.
311313
* It doesn't do any work; just locks the relation and passes the buck.
312314
*/
313-
InsertIndexResult
314-
gistinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
315+
Datum
316+
gistinsert(PG_FUNCTION_ARGS)
315317
{
318+
Relation r = (Relation) PG_GETARG_POINTER(0);
319+
Datum *datum = (Datum *) PG_GETARG_POINTER(1);
320+
char *nulls = (char *) PG_GETARG_POINTER(2);
321+
ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
322+
#ifdef NOT_USED
323+
Relation heapRel = (Relation) PG_GETARG_POINTER(4);
324+
#endif
316325
InsertIndexResult res;
317326
IndexTuple itup;
318327
GISTSTATE giststate;
@@ -351,7 +360,7 @@ gistinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
351360
pfree(itup);
352361
pfree(compvec);
353362

354-
return res;
363+
PG_RETURN_POINTER(res);
355364
}
356365

357366
/*
@@ -596,7 +605,9 @@ gistAdjustKeys(Relation r,
596605

597606
/* delete old tuple */
598607
ItemPointerSet(&oldtid, stk->gs_blk, stk->gs_child);
599-
gistdelete(r, (ItemPointer) &oldtid);
608+
DirectFunctionCall2(gistdelete,
609+
PointerGetDatum(r),
610+
PointerGetDatum(&oldtid));
600611

601612
/* generate and insert new tuple */
602613
tupDesc = r->rd_att;
@@ -890,7 +901,9 @@ gistintinsert(Relation r,
890901

891902
/* remove old left pointer, insert the 2 new entries */
892903
ItemPointerSet(&ltid, stk->gs_blk, stk->gs_child);
893-
gistdelete(r, (ItemPointer) &ltid);
904+
DirectFunctionCall2(gistdelete,
905+
PointerGetDatum(r),
906+
PointerGetDatum(&ltid));
894907
gistentryinserttwo(r, stk, ltup, rtup, giststate);
895908
}
896909

@@ -1105,9 +1118,11 @@ gistfreestack(GISTSTACK *s)
11051118
/*
11061119
** remove an entry from a page
11071120
*/
1108-
void
1109-
gistdelete(Relation r, ItemPointer tid)
1121+
Datum
1122+
gistdelete(PG_FUNCTION_ARGS)
11101123
{
1124+
Relation r = (Relation) PG_GETARG_POINTER(0);
1125+
ItemPointer tid = (ItemPointer) PG_GETARG_POINTER(1);
11111126
BlockNumber blkno;
11121127
OffsetNumber offnum;
11131128
Buffer buf;
@@ -1134,6 +1149,7 @@ gistdelete(Relation r, ItemPointer tid)
11341149

11351150
WriteBuffer(buf);
11361151

1152+
PG_RETURN_POINTER(NULL); /* no real return value */
11371153
}
11381154

11391155
void

src/backend/access/gist/gistget.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,23 @@ static bool gistindex_keytest(IndexTuple tuple, TupleDesc tupdesc,
2929
Relation r, Page p, OffsetNumber offset);
3030

3131

32-
RetrieveIndexResult
33-
gistgettuple(IndexScanDesc s, ScanDirection dir)
32+
Datum
33+
gistgettuple(PG_FUNCTION_ARGS)
3434
{
35+
IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
36+
ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
3537
RetrieveIndexResult res;
3638

3739
/* if we have it cached in the scan desc, just return the value */
3840
if ((res = gistscancache(s, dir)) != (RetrieveIndexResult) NULL)
39-
return res;
41+
PG_RETURN_POINTER(res);
4042

4143
/* not cached, so we'll have to do some work */
4244
if (ItemPointerIsValid(&(s->currentItemData)))
4345
res = gistnext(s, dir);
4446
else
4547
res = gistfirst(s, dir);
46-
return res;
48+
PG_RETURN_POINTER(res);
4749
}
4850

4951
static RetrieveIndexResult

src/backend/access/gist/gistscan.c

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ typedef GISTScanListData *GISTScanList;
4848
/* pointer to list of local scans on GiSTs */
4949
static GISTScanList GISTScans = (GISTScanList) NULL;
5050

51-
IndexScanDesc
52-
gistbeginscan(Relation r,
53-
bool fromEnd,
54-
uint16 nkeys,
55-
ScanKey key)
51+
Datum
52+
gistbeginscan(PG_FUNCTION_ARGS)
5653
{
54+
Relation r = (Relation) PG_GETARG_POINTER(0);
55+
bool fromEnd = PG_GETARG_BOOL(1);
56+
uint16 nkeys = PG_GETARG_UINT16(2);
57+
ScanKey key = (ScanKey) PG_GETARG_POINTER(3);
5758
IndexScanDesc s;
5859

5960
/*
@@ -65,21 +66,18 @@ gistbeginscan(Relation r,
6566
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
6667
gistregscan(s);
6768

68-
return s;
69+
PG_RETURN_POINTER(s);
6970
}
7071

71-
void
72-
gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
72+
Datum
73+
gistrescan(PG_FUNCTION_ARGS)
7374
{
75+
IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
76+
bool fromEnd = PG_GETARG_BOOL(1);
77+
ScanKey key = (ScanKey) PG_GETARG_POINTER(2);
7478
GISTScanOpaque p;
7579
int i;
7680

77-
if (!IndexScanIsValid(s))
78-
{
79-
elog(ERROR, "gistrescan: invalid scan.");
80-
return;
81-
}
82-
8381
/*
8482
* Clear all the pointers.
8583
*/
@@ -155,11 +153,14 @@ gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
155153
s->keyData[i].sk_func = p->giststate->consistentFn;
156154
}
157155
}
156+
157+
PG_RETURN_POINTER(NULL); /* no real return value */
158158
}
159159

160-
void
161-
gistmarkpos(IndexScanDesc s)
160+
Datum
161+
gistmarkpos(PG_FUNCTION_ARGS)
162162
{
163+
IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
163164
GISTScanOpaque p;
164165
GISTSTACK *o,
165166
*n,
@@ -188,11 +189,14 @@ gistmarkpos(IndexScanDesc s)
188189

189190
gistfreestack(p->s_markstk);
190191
p->s_markstk = o;
192+
193+
PG_RETURN_POINTER(NULL); /* no real return value */
191194
}
192195

193-
void
194-
gistrestrpos(IndexScanDesc s)
196+
Datum
197+
gistrestrpos(PG_FUNCTION_ARGS)
195198
{
199+
IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
196200
GISTScanOpaque p;
197201
GISTSTACK *o,
198202
*n,
@@ -221,12 +225,15 @@ gistrestrpos(IndexScanDesc s)
221225

222226
gistfreestack(p->s_stack);
223227
p->s_stack = o;
228+
229+
PG_RETURN_POINTER(NULL); /* no real return value */
224230
}
225231

226-
void
227-
gistendscan(IndexScanDesc s)
232+
Datum
233+
gistendscan(PG_FUNCTION_ARGS)
228234
{
229-
GISTScanOpaque p;
235+
IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
236+
GISTScanOpaque p;
230237

231238
p = (GISTScanOpaque) s->opaque;
232239

@@ -239,6 +246,8 @@ gistendscan(IndexScanDesc s)
239246

240247
gistdropscan(s);
241248
/* XXX don't unset read lock -- two-phase locking */
249+
250+
PG_RETURN_POINTER(NULL); /* no real return value */
242251
}
243252

244253
static void

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