diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-06-13 07:35:40 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-06-13 07:35:40 +0000 |
commit | f2d120532207b8873a5e74e7350dd2904f377289 (patch) | |
tree | 992c89e023c4b29b42bf4fd6563de91f8d6ec8ca /src/backend/access/gist | |
parent | 8f057d971d663fff9bbb2ae7d053bf71cf09b4a2 (diff) | |
download | postgresql-f2d120532207b8873a5e74e7350dd2904f377289.tar.gz postgresql-f2d120532207b8873a5e74e7350dd2904f377289.zip |
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 ...
Diffstat (limited to 'src/backend/access/gist')
-rw-r--r-- | src/backend/access/gist/gist.c | 58 | ||||
-rw-r--r-- | src/backend/access/gist/gistget.c | 10 | ||||
-rw-r--r-- | src/backend/access/gist/gistscan.c | 51 |
3 files changed, 73 insertions, 46 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 7c3bb452cce..1d8c25104ce 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.55 2000/05/30 04:24:28 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.56 2000/06/13 07:34:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,6 @@ static BlockNumber gistChooseSubtree(Relation r, IndexTuple itup, int level, static OffsetNumber gistchoose(Relation r, Page p, IndexTuple it, GISTSTATE *giststate); static int gistnospace(Page p, IndexTuple it); -void gistdelete(Relation r, ItemPointer tid); static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t); static void gistcentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr, Relation r, Page pg, OffsetNumber o, int b, bool l); @@ -60,17 +59,20 @@ static char *int_range_out(INTRANGE *r); /* ** routine to build an index. Basically calls insert over and over */ -void -gistbuild(Relation heap, - Relation index, - int natts, - AttrNumber *attnum, - IndexStrategy istrat, - uint16 pint, - Datum *params, - FuncIndexInfo *finfo, - PredInfo *predInfo) +Datum +gistbuild(PG_FUNCTION_ARGS) { + Relation heap = (Relation) PG_GETARG_POINTER(0); + Relation index = (Relation) PG_GETARG_POINTER(1); + int32 natts = PG_GETARG_INT32(2); + AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3); +#ifdef NOT_USED + IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4); + uint16 pcount = PG_GETARG_UINT16(5); + Datum *params = (Datum *) PG_GETARG_POINTER(6); +#endif + FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7); + PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8); HeapScanDesc scan; AttrNumber i; HeapTuple htup; @@ -83,12 +85,10 @@ gistbuild(Relation heap, int nb, nh, ni; - #ifndef OMIT_PARTIAL_INDEX ExprContext *econtext; TupleTable tupleTable; TupleTableSlot *slot; - #endif Node *pred, *oldPred; @@ -302,6 +302,8 @@ gistbuild(Relation heap, /* be tidy */ pfree(nulls); pfree(d); + + PG_RETURN_POINTER(NULL); /* no real return value */ } /* @@ -310,9 +312,16 @@ gistbuild(Relation heap, * This is the public interface routine for tuple insertion in GiSTs. * It doesn't do any work; just locks the relation and passes the buck. */ -InsertIndexResult -gistinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation heapRel) +Datum +gistinsert(PG_FUNCTION_ARGS) { + Relation r = (Relation) PG_GETARG_POINTER(0); + Datum *datum = (Datum *) PG_GETARG_POINTER(1); + char *nulls = (char *) PG_GETARG_POINTER(2); + ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3); +#ifdef NOT_USED + Relation heapRel = (Relation) PG_GETARG_POINTER(4); +#endif InsertIndexResult res; IndexTuple itup; GISTSTATE giststate; @@ -351,7 +360,7 @@ gistinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation pfree(itup); pfree(compvec); - return res; + PG_RETURN_POINTER(res); } /* @@ -596,7 +605,9 @@ gistAdjustKeys(Relation r, /* delete old tuple */ ItemPointerSet(&oldtid, stk->gs_blk, stk->gs_child); - gistdelete(r, (ItemPointer) &oldtid); + DirectFunctionCall2(gistdelete, + PointerGetDatum(r), + PointerGetDatum(&oldtid)); /* generate and insert new tuple */ tupDesc = r->rd_att; @@ -890,7 +901,9 @@ gistintinsert(Relation r, /* remove old left pointer, insert the 2 new entries */ ItemPointerSet(<id, stk->gs_blk, stk->gs_child); - gistdelete(r, (ItemPointer) <id); + DirectFunctionCall2(gistdelete, + PointerGetDatum(r), + PointerGetDatum(<id)); gistentryinserttwo(r, stk, ltup, rtup, giststate); } @@ -1105,9 +1118,11 @@ gistfreestack(GISTSTACK *s) /* ** remove an entry from a page */ -void -gistdelete(Relation r, ItemPointer tid) +Datum +gistdelete(PG_FUNCTION_ARGS) { + Relation r = (Relation) PG_GETARG_POINTER(0); + ItemPointer tid = (ItemPointer) PG_GETARG_POINTER(1); BlockNumber blkno; OffsetNumber offnum; Buffer buf; @@ -1134,6 +1149,7 @@ gistdelete(Relation r, ItemPointer tid) WriteBuffer(buf); + PG_RETURN_POINTER(NULL); /* no real return value */ } void diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index c08a5cc2fea..f7b49430d07 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -29,21 +29,23 @@ static bool gistindex_keytest(IndexTuple tuple, TupleDesc tupdesc, Relation r, Page p, OffsetNumber offset); -RetrieveIndexResult -gistgettuple(IndexScanDesc s, ScanDirection dir) +Datum +gistgettuple(PG_FUNCTION_ARGS) { + IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0); + ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1); RetrieveIndexResult res; /* if we have it cached in the scan desc, just return the value */ if ((res = gistscancache(s, dir)) != (RetrieveIndexResult) NULL) - return res; + PG_RETURN_POINTER(res); /* not cached, so we'll have to do some work */ if (ItemPointerIsValid(&(s->currentItemData))) res = gistnext(s, dir); else res = gistfirst(s, dir); - return res; + PG_RETURN_POINTER(res); } static RetrieveIndexResult diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index 2196e897e4a..729837e8008 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -48,12 +48,13 @@ typedef GISTScanListData *GISTScanList; /* pointer to list of local scans on GiSTs */ static GISTScanList GISTScans = (GISTScanList) NULL; -IndexScanDesc -gistbeginscan(Relation r, - bool fromEnd, - uint16 nkeys, - ScanKey key) +Datum +gistbeginscan(PG_FUNCTION_ARGS) { + Relation r = (Relation) PG_GETARG_POINTER(0); + bool fromEnd = PG_GETARG_BOOL(1); + uint16 nkeys = PG_GETARG_UINT16(2); + ScanKey key = (ScanKey) PG_GETARG_POINTER(3); IndexScanDesc s; /* @@ -65,21 +66,18 @@ gistbeginscan(Relation r, s = RelationGetIndexScan(r, fromEnd, nkeys, key); gistregscan(s); - return s; + PG_RETURN_POINTER(s); } -void -gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key) +Datum +gistrescan(PG_FUNCTION_ARGS) { + IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0); + bool fromEnd = PG_GETARG_BOOL(1); + ScanKey key = (ScanKey) PG_GETARG_POINTER(2); GISTScanOpaque p; int i; - if (!IndexScanIsValid(s)) - { - elog(ERROR, "gistrescan: invalid scan."); - return; - } - /* * Clear all the pointers. */ @@ -155,11 +153,14 @@ gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key) s->keyData[i].sk_func = p->giststate->consistentFn; } } + + PG_RETURN_POINTER(NULL); /* no real return value */ } -void -gistmarkpos(IndexScanDesc s) +Datum +gistmarkpos(PG_FUNCTION_ARGS) { + IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0); GISTScanOpaque p; GISTSTACK *o, *n, @@ -188,11 +189,14 @@ gistmarkpos(IndexScanDesc s) gistfreestack(p->s_markstk); p->s_markstk = o; + + PG_RETURN_POINTER(NULL); /* no real return value */ } -void -gistrestrpos(IndexScanDesc s) +Datum +gistrestrpos(PG_FUNCTION_ARGS) { + IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0); GISTScanOpaque p; GISTSTACK *o, *n, @@ -221,12 +225,15 @@ gistrestrpos(IndexScanDesc s) gistfreestack(p->s_stack); p->s_stack = o; + + PG_RETURN_POINTER(NULL); /* no real return value */ } -void -gistendscan(IndexScanDesc s) +Datum +gistendscan(PG_FUNCTION_ARGS) { - GISTScanOpaque p; + IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0); + GISTScanOpaque p; p = (GISTScanOpaque) s->opaque; @@ -239,6 +246,8 @@ gistendscan(IndexScanDesc s) gistdropscan(s); /* XXX don't unset read lock -- two-phase locking */ + + PG_RETURN_POINTER(NULL); /* no real return value */ } static void |