summaryrefslogtreecommitdiff
path: root/src/backend/access/rtree
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/rtree')
-rw-r--r--src/backend/access/rtree/rtget.c12
-rw-r--r--src/backend/access/rtree/rtproc.c12
-rw-r--r--src/backend/access/rtree/rtree.c48
-rw-r--r--src/backend/access/rtree/rtscan.c51
4 files changed, 75 insertions, 48 deletions
diff --git a/src/backend/access/rtree/rtget.c b/src/backend/access/rtree/rtget.c
index 5b99e807f6..8854163def 100644
--- a/src/backend/access/rtree/rtget.c
+++ b/src/backend/access/rtree/rtget.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.20 2000/01/26 05:56:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.21 2000/06/13 07:34:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,21 +28,23 @@ static RetrieveIndexResult rtnext(IndexScanDesc s, ScanDirection dir);
static ItemPointer rtheapptr(Relation r, ItemPointer itemp);
-RetrieveIndexResult
-rtgettuple(IndexScanDesc s, ScanDirection dir)
+Datum
+rtgettuple(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 = rtscancache(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 = rtnext(s, dir);
else
res = rtfirst(s, dir);
- return res;
+ PG_RETURN_POINTER(res);
}
static RetrieveIndexResult
diff --git a/src/backend/access/rtree/rtproc.c b/src/backend/access/rtree/rtproc.c
index 6b571c7d4a..df410045c2 100644
--- a/src/backend/access/rtree/rtproc.c
+++ b/src/backend/access/rtree/rtproc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.25 2000/01/26 05:56:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.26 2000/06/13 07:34:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -102,13 +102,15 @@ rt_poly_union(POLYGON *a, POLYGON *b)
return p;
}
-void
-rt_poly_size(POLYGON *a, float *size)
+Datum
+rt_poly_size(PG_FUNCTION_ARGS)
{
+ POLYGON *a = PG_GETARG_POLYGON_P(0);
+ /* NB: size is an output argument */
+ float *size = (float *) PG_GETARG_POINTER(1);
double xdim,
ydim;
- size = (float *) palloc(sizeof(float));
if (a == (POLYGON *) NULL ||
a->boundbox.high.x <= a->boundbox.low.x ||
a->boundbox.high.y <= a->boundbox.low.y)
@@ -121,7 +123,7 @@ rt_poly_size(POLYGON *a, float *size)
*size = (float) (xdim * ydim);
}
- return;
+ PG_RETURN_POINTER(NULL); /* no real return value */
}
POLYGON *
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index 020f6bdff8..358d307d0b 100644
--- a/src/backend/access/rtree/rtree.c
+++ b/src/backend/access/rtree/rtree.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.47 2000/05/30 04:24:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.48 2000/06/13 07:34:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,17 +59,20 @@ static int nospace(Page p, IndexTuple it);
static void initRtstate(RTSTATE *rtstate, Relation index);
-void
-rtbuild(Relation heap,
- Relation index,
- int natts,
- AttrNumber *attnum,
- IndexStrategy istrat,
- uint16 pcount,
- Datum *params,
- FuncIndexInfo *finfo,
- PredInfo *predInfo)
+Datum
+rtbuild(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;
@@ -277,6 +280,8 @@ rtbuild(Relation heap,
/* be tidy */
pfree(nulls);
pfree(d);
+
+ PG_RETURN_POINTER(NULL); /* no real return value */
}
/*
@@ -285,9 +290,16 @@ rtbuild(Relation heap,
* This is the public interface routine for tuple insertion in rtrees.
* It doesn't do any work; just locks the relation and passes the buck.
*/
-InsertIndexResult
-rtinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
+Datum
+rtinsert(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;
RTSTATE rtState;
@@ -305,7 +317,7 @@ rtinsert(Relation r, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation he
res = rtdoinsert(r, itup, &rtState);
- return res;
+ PG_RETURN_POINTER(res);
}
static InsertIndexResult
@@ -982,9 +994,11 @@ freestack(RTSTACK *s)
}
}
-char *
-rtdelete(Relation r, ItemPointer tid)
+Datum
+rtdelete(PG_FUNCTION_ARGS)
{
+ Relation r = (Relation) PG_GETARG_POINTER(0);
+ ItemPointer tid = (ItemPointer) PG_GETARG_POINTER(1);
BlockNumber blkno;
OffsetNumber offnum;
Buffer buf;
@@ -1011,7 +1025,7 @@ rtdelete(Relation r, ItemPointer tid)
WriteBuffer(buf);
- return (char *) NULL;
+ PG_RETURN_POINTER(NULL); /* no real return value */
}
static void
diff --git a/src/backend/access/rtree/rtscan.c b/src/backend/access/rtree/rtscan.c
index 71e2acf5f8..97a71a0058 100644
--- a/src/backend/access/rtree/rtscan.c
+++ b/src/backend/access/rtree/rtscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.32 2000/04/12 17:14:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.33 2000/06/13 07:34:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,12 +51,13 @@ typedef RTScanListData *RTScanList;
/* pointer to list of local scans on rtrees */
static RTScanList RTScans = (RTScanList) NULL;
-IndexScanDesc
-rtbeginscan(Relation r,
- bool fromEnd,
- uint16 nkeys,
- ScanKey key)
+Datum
+rtbeginscan(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;
/*
@@ -68,22 +69,19 @@ rtbeginscan(Relation r,
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
rtregscan(s);
- return s;
+ PG_RETURN_POINTER(s);
}
-void
-rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
+Datum
+rtrescan(PG_FUNCTION_ARGS)
{
+ IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
+ bool fromEnd = PG_GETARG_BOOL(1);
+ ScanKey key = (ScanKey) PG_GETARG_POINTER(2);
RTreeScanOpaque p;
RegProcedure internal_proc;
int i;
- if (!IndexScanIsValid(s))
- {
- elog(ERROR, "rtrescan: invalid scan.");
- return;
- }
-
/*
* Clear all the pointers.
*/
@@ -157,11 +155,14 @@ rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
}
}
}
+
+ PG_RETURN_POINTER(NULL); /* no real return value */
}
-void
-rtmarkpos(IndexScanDesc s)
+Datum
+rtmarkpos(PG_FUNCTION_ARGS)
{
+ IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
RTreeScanOpaque p;
RTSTACK *o,
*n,
@@ -190,11 +191,14 @@ rtmarkpos(IndexScanDesc s)
freestack(p->s_markstk);
p->s_markstk = o;
+
+ PG_RETURN_POINTER(NULL); /* no real return value */
}
-void
-rtrestrpos(IndexScanDesc s)
+Datum
+rtrestrpos(PG_FUNCTION_ARGS)
{
+ IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
RTreeScanOpaque p;
RTSTACK *o,
*n,
@@ -223,11 +227,14 @@ rtrestrpos(IndexScanDesc s)
freestack(p->s_stack);
p->s_stack = o;
+
+ PG_RETURN_POINTER(NULL); /* no real return value */
}
-void
-rtendscan(IndexScanDesc s)
+Datum
+rtendscan(PG_FUNCTION_ARGS)
{
+ IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
RTreeScanOpaque p;
p = (RTreeScanOpaque) s->opaque;
@@ -241,6 +248,8 @@ rtendscan(IndexScanDesc s)
rtdropscan(s);
/* XXX don't unset read lock -- two-phase locking */
+
+ PG_RETURN_POINTER(NULL); /* no real return value */
}
static void