aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/nbtree
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/nbtree')
-rw-r--r--src/backend/access/nbtree/nbtcompare.c4
-rw-r--r--src/backend/access/nbtree/nbtinsert.c50
-rw-r--r--src/backend/access/nbtree/nbtpage.c16
-rw-r--r--src/backend/access/nbtree/nbtree.c17
-rw-r--r--src/backend/access/nbtree/nbtscan.c8
-rw-r--r--src/backend/access/nbtree/nbtsearch.c132
-rw-r--r--src/backend/access/nbtree/nbtsort.c44
-rw-r--r--src/backend/access/nbtree/nbtstrat.c4
-rw-r--r--src/backend/access/nbtree/nbtutils.c26
9 files changed, 151 insertions, 150 deletions
diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c
index 45ec7b241de..65db2d3e1ac 100644
--- a/src/backend/access/nbtree/nbtcompare.c
+++ b/src/backend/access/nbtree/nbtcompare.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.17 1998/08/19 02:01:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.18 1998/09/01 03:21:12 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -85,7 +85,7 @@ btoidcmp(Oid a, Oid b)
}
int32
-btoid8cmp(Oid a[], Oid b[])
+btoid8cmp(Oid *a, Oid *b)
{
int i;
for (i=0; i < 8; i++)
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index b575476ba8a..f6a34e97acd 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.28 1998/08/19 02:01:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.29 1998/09/01 03:21:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -104,7 +104,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
Buffer nbuf;
BlockNumber blkno;
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
nbuf = InvalidBuffer;
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -182,7 +182,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
_bt_freestack(stack);
_bt_freeskey(itup_scankey);
- return (res);
+ return res;
}
/*
@@ -301,7 +301,7 @@ _bt_insertonpg(Relation rel,
keysz, scankey, stack->bts_btitem,
NULL);
ItemPointerSet(&(res->pointerData), itup_blkno, itup_off);
- return (res);
+ return res;
}
}
else
@@ -780,7 +780,7 @@ _bt_insertonpg(Relation rel,
res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData));
ItemPointerSet(&(res->pointerData), itup_blkno, itup_off);
- return (res);
+ return res;
}
/*
@@ -961,7 +961,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
}
/* split's done */
- return (rbuf);
+ return rbuf;
}
/*
@@ -1045,7 +1045,7 @@ _bt_findsplitloc(Relation rel,
if (saferight == maxoff && (maxoff - start) > 1)
saferight = start + (maxoff - start) / 2;
- return (saferight);
+ return saferight;
}
/*
@@ -1193,7 +1193,7 @@ _bt_pgaddtup(Relation rel,
/* write the buffer, but hold our lock */
_bt_wrtnorelbuf(rel, buf);
- return (itup_off);
+ return itup_off;
}
/*
@@ -1227,7 +1227,7 @@ _bt_goesonpg(Relation rel,
/* no right neighbor? */
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (P_RIGHTMOST(opaque))
- return (true);
+ return true;
/*
* this is a non-rightmost page, so it must have a high key item.
@@ -1237,7 +1237,7 @@ _bt_goesonpg(Relation rel,
*/
hikey = PageGetItemId(page, P_HIKEY);
if (_bt_skeycmp(rel, keysz, scankey, page, hikey, BTLessStrategyNumber))
- return (true);
+ return true;
/*
* If the scan key is > the high key, then it for sure doesn't belong
@@ -1245,7 +1245,7 @@ _bt_goesonpg(Relation rel,
*/
if (_bt_skeycmp(rel, keysz, scankey, page, hikey, BTGreaterStrategyNumber))
- return (false);
+ return false;
/*
* If we have no adjacency information, and the item is equal to the
@@ -1258,14 +1258,14 @@ _bt_goesonpg(Relation rel,
if (afteritem == (BTItem) NULL)
{
if (opaque->btpo_flags & BTP_LEAF)
- return (false);
+ return false;
if (opaque->btpo_flags & BTP_CHAIN)
- return (true);
+ return true;
if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, P_FIRSTKEY),
BTEqualStrategyNumber))
- return (true);
- return (false);
+ return true;
+ return false;
}
/* damn, have to work for it. i hate that. */
@@ -1293,7 +1293,7 @@ _bt_goesonpg(Relation rel,
}
}
- return (found);
+ return found;
}
/*
@@ -1330,7 +1330,7 @@ _bt_itemcmp(Relation rel,
strat = BTGreaterStrategyNumber;
}
- tupDes = RelationGetTupleDescriptor(rel);
+ tupDes = RelationGetDescr(rel);
indexTuple1 = &(item1->bti_itup);
indexTuple2 = &(item2->bti_itup);
@@ -1357,13 +1357,13 @@ _bt_itemcmp(Relation rel,
if (compare) /* true for one of ">, <, =" */
{
if (strat != BTEqualStrategyNumber)
- return (true);
+ return true;
}
else
/* false for one of ">, <, =" */
{
if (strat == BTEqualStrategyNumber)
- return (false);
+ return false;
/*
* if original strat was "<=, >=" OR "<, >" but some
@@ -1379,10 +1379,10 @@ _bt_itemcmp(Relation rel,
if (compare) /* item1' and item2' attributes are equal */
continue; /* - try to compare next attributes */
}
- return (false);
+ return false;
}
}
- return (true);
+ return true;
}
/*
@@ -1475,15 +1475,15 @@ _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
/* NULLs are not equal */
if (entry->sk_flags & SK_ISNULL || null)
- return (false);
+ return false;
result = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
if (result != 0)
- return (false);
+ return false;
}
/* by here, the keys are equal */
- return (true);
+ return true;
}
#ifdef NOT_USED
@@ -1621,7 +1621,7 @@ _bt_shift(Relation rel, Buffer buf, BTStack stack, int keysz,
ItemPointerSet(&(res->pointerData), nbknum, P_HIKEY);
- return (res);
+ return res;
}
#endif
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index 1d714166558..223efc5c91e 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.15 1998/01/07 21:01:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.16 1998/09/01 03:21:14 momjian Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
@@ -274,7 +274,7 @@ _bt_getroot(Relation rel, int access)
*/
_bt_relbuf(rel, metabuf, BT_WRITE);
- return (_bt_getroot(rel, access));
+ return _bt_getroot(rel, access);
}
}
else
@@ -298,7 +298,7 @@ _bt_getroot(Relation rel, int access)
/* it happened, try again */
_bt_relbuf(rel, rootbuf, access);
- return (_bt_getroot(rel, access));
+ return _bt_getroot(rel, access);
}
/*
@@ -307,7 +307,7 @@ _bt_getroot(Relation rel, int access)
* Return the root block.
*/
- return (rootbuf);
+ return rootbuf;
}
/*
@@ -350,7 +350,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
}
/* ref count and lock type are correct */
- return (buf);
+ return buf;
}
/*
@@ -505,7 +505,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save;
- return (buf);
+ return buf;
}
/* if the item has just moved right on this page, we're done */
@@ -525,7 +525,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save;
- return (buf);
+ return buf;
}
}
}
@@ -562,7 +562,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
item_save = (BTItem) palloc(item_nbytes);
memmove((char *) item_save, (char *) item, item_nbytes);
stack->bts_btitem = item_save;
- return (buf);
+ return buf;
}
}
}
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 582988c1b07..082cfe36283 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.30 1998/08/25 21:33:56 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.31 1998/09/01 03:21:16 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -119,8 +119,8 @@ btbuild(Relation heap,
_bt_metapinit(index);
/* get tuple descriptors for heap and index relations */
- htupdesc = RelationGetTupleDescriptor(heap);
- itupdesc = RelationGetTupleDescriptor(index);
+ htupdesc = RelationGetDescr(heap);
+ itupdesc = RelationGetDescr(index);
/* get space for data items that'll appear in the index tuple */
attdata = (Datum *) palloc(natts * sizeof(Datum));
@@ -355,13 +355,14 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
InsertIndexResult res;
/* generate an index tuple */
- itup = index_formtuple(RelationGetTupleDescriptor(rel), datum, nulls);
+ itup = index_formtuple(RelationGetDescr(rel), datum, nulls);
itup->t_tid = *ht_ctid;
/*
* See comments in btbuild.
*
- * if (itup->t_info & INDEX_NULL_MASK) return ((InsertIndexResult) NULL);
+ * if (itup->t_info & INDEX_NULL_MASK)
+ return (InsertIndexResult) NULL;
*/
btitem = _bt_formitem(itup);
@@ -377,7 +378,7 @@ btinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relation
_bt_adjscans(rel, &(res->pointerData), BT_INSERT);
#endif
- return (res);
+ return res;
}
/*
@@ -417,7 +418,7 @@ btgettuple(IndexScanDesc scan, ScanDirection dir)
if (res)
((BTScanOpaque)scan->opaque)->curHeapIptr = res->heap_iptr;
- return ((char *) res);
+ return (char *) res;
}
/*
@@ -434,7 +435,7 @@ btbeginscan(Relation rel, bool fromEnd, uint16 keysz, ScanKey scankey)
/* register scan in case we change pages it's using */
_bt_regscan(scan);
- return ((char *) scan);
+ return (char *) scan;
}
/*
diff --git a/src/backend/access/nbtree/nbtscan.c b/src/backend/access/nbtree/nbtscan.c
index b6566e936a9..11b76593765 100644
--- a/src/backend/access/nbtree/nbtscan.c
+++ b/src/backend/access/nbtree/nbtscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.16 1998/08/19 02:01:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.17 1998/09/01 03:21:17 momjian Exp $
*
*
* NOTES
@@ -231,13 +231,13 @@ _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno)
- return (true);
+ return true;
current = &(scan->currentMarkData);
if (ItemPointerIsValid(current)
&& ItemPointerGetBlockNumber(current) == blkno
&& ItemPointerGetOffsetNumber(current) >= offno)
- return (true);
+ return true;
- return (false);
+ return false;
}
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index 633a310ea1a..8584f205875 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.36 1998/06/15 19:27:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.37 1998/09/01 03:21:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,7 +52,7 @@ BTStack
_bt_search(Relation rel, int keysz, ScanKey scankey, Buffer *bufP)
{
*bufP = _bt_getroot(rel, BT_READ);
- return (_bt_searchr(rel, keysz, scankey, bufP, (BTStack) NULL));
+ return _bt_searchr(rel, keysz, scankey, bufP, (BTStack) NULL);
}
/*
@@ -81,7 +81,7 @@ _bt_searchr(Relation rel,
page = BufferGetPage(*bufP);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (opaque->btpo_flags & BTP_LEAF)
- return (stack_in);
+ return stack_in;
/*
* Find the appropriate item on the internal page, and get the child
@@ -127,7 +127,7 @@ _bt_searchr(Relation rel,
*bufP = _bt_moveright(rel, *bufP, keysz, scankey, BT_READ);
/* okay, all set to move down a level */
- return (_bt_searchr(rel, keysz, scankey, bufP, stack));
+ return _bt_searchr(rel, keysz, scankey, bufP, stack);
}
/*
@@ -166,7 +166,7 @@ _bt_moveright(Relation rel,
/* if we're on a rightmost page, we don't need to move right */
if (P_RIGHTMOST(opaque))
- return (buf);
+ return buf;
/* by convention, item 0 on non-rightmost pages is the high key */
hikey = PageGetItemId(page, P_HIKEY);
@@ -252,7 +252,7 @@ _bt_moveright(Relation rel,
&& _bt_skeycmp(rel, keysz, scankey, page, hikey,
BTGreaterEqualStrategyNumber));
}
- return (buf);
+ return buf;
}
/*
@@ -300,7 +300,7 @@ _bt_skeycmp(Relation rel,
item = (BTItem) PageGetItem(page, itemid);
indexTuple = &(item->bti_itup);
- tupDes = RelationGetTupleDescriptor(rel);
+ tupDes = RelationGetDescr(rel);
/* see if the comparison is true for all of the key attributes */
for (i = 1; i <= keysz; i++)
@@ -338,13 +338,13 @@ _bt_skeycmp(Relation rel,
if (compare) /* true for one of ">, <, =" */
{
if (strat != BTEqualStrategyNumber)
- return (true);
+ return true;
}
else
/* false for one of ">, <, =" */
{
if (strat == BTEqualStrategyNumber)
- return (false);
+ return false;
/*
* if original strat was "<=, >=" OR "<, >" but some
@@ -360,11 +360,11 @@ _bt_skeycmp(Relation rel,
if (compare) /* key' and item' attributes are equal */
continue; /* - try to compare next attributes */
}
- return (false);
+ return false;
}
}
- return (true);
+ return true;
}
/*
@@ -397,7 +397,7 @@ _bt_binsrch(Relation rel,
int natts = rel->rd_rel->relnatts;
int result;
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -416,17 +416,17 @@ _bt_binsrch(Relation rel,
*/
if (PageIsEmpty(page))
- return (low);
+ return low;
if ((!P_RIGHTMOST(opaque) && high <= low))
{
if (high < low ||
(srchtype == BT_DESCENT && !(opaque->btpo_flags & BTP_LEAF)))
- return (low);
+ return low;
/* It's insertion and high == low == 2 */
result = _bt_compare(rel, itupdesc, page, keysz, scankey, low);
if (result > 0)
- return (OffsetNumberNext(low));
- return (low);
+ return OffsetNumberNext(low);
+ return low;
}
while ((high - low) > 1)
@@ -454,11 +454,11 @@ _bt_binsrch(Relation rel,
* code (natts == keysz). - vadim 04/15/97
*/
if (natts == keysz || opaque->btpo_flags & BTP_LEAF)
- return (mid);
+ return mid;
low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (mid == low)
- return (mid);
- return (OffsetNumberPrev(mid));
+ return mid;
+ return OffsetNumberPrev(mid);
}
}
@@ -490,33 +490,33 @@ _bt_binsrch(Relation rel,
* comments above for multi-column indices.
*/
if (natts == keysz)
- return (mid);
+ return mid;
low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (mid == low)
- return (mid);
- return (OffsetNumberPrev(mid));
+ return mid;
+ return OffsetNumberPrev(mid);
}
else if (result > 0)
- return (high);
+ return high;
else
- return (low);
+ return low;
}
else
/* we want the first key >= the scan key */
{
result = _bt_compare(rel, itupdesc, page, keysz, scankey, low);
if (result <= 0)
- return (low);
+ return low;
else
{
if (low == high)
- return (OffsetNumberNext(low));
+ return OffsetNumberNext(low);
result = _bt_compare(rel, itupdesc, page, keysz, scankey, high);
if (result <= 0)
- return (high);
+ return high;
else
- return (OffsetNumberNext(high));
+ return OffsetNumberNext(high);
}
}
}
@@ -543,7 +543,7 @@ _bt_firsteq(Relation rel,
keysz, scankey, OffsetNumberPrev(offnum)) == 0)
offnum = OffsetNumberPrev(offnum);
- return (offnum);
+ return offnum;
}
/*
@@ -630,8 +630,8 @@ _bt_compare(Relation rel,
if (_bt_skeycmp(rel, keysz, scankey, page, itemid,
BTEqualStrategyNumber))
- return (0);
- return (1);
+ return 0;
+ return 1;
#endif
}
@@ -675,11 +675,11 @@ _bt_compare(Relation rel,
/* if the keys are unequal, return the difference */
if (result != 0)
- return (result);
+ return result;
}
/* by here, the keys are equal */
- return (0);
+ return 0;
}
/*
@@ -726,7 +726,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
{
/* step one tuple in the appropriate direction */
if (!_bt_step(scan, &buf, dir))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
/* by here, current is the tuple we want to return */
offnum = ItemPointerGetOffsetNumber(current);
@@ -741,7 +741,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
/* remember which buffer we have pinned and locked */
so->btso_curbuf = buf;
- return (res);
+ return res;
}
} while (keysok >= so->numberOfFirstKeys);
@@ -750,7 +750,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ);
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
/*
@@ -812,13 +812,13 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
scan->scanFromEnd = true;
if (so->qual_ok == 0)
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
/* if we just need to walk down one edge of the tree, do that */
if (scan->scanFromEnd)
- return (_bt_endpoint(scan, dir));
+ return _bt_endpoint(scan, dir);
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
current = &(scan->currentItemData);
/*
@@ -831,7 +831,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
if (so->keyData[0].sk_flags & SK_ISNULL)
{
elog(ERROR, "_bt_first: btree doesn't support is(not)null, yet");
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
proc = index_getprocid(rel, 1, BTORDER_PROC);
ScanKeyEntryInitialize(&skdata, so->keyData[0].sk_flags, 1, proc,
@@ -855,7 +855,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ);
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
maxoff = PageGetMaxOffsetNumber(page);
pop = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -881,7 +881,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
_bt_relbuf(rel, buf, BT_READ);
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
maxoff = PageGetMaxOffsetNumber(page);
pop = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -955,7 +955,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(scan->relation, buf, BT_READ);
so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
break;
@@ -970,7 +970,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(scan->relation, buf, BT_READ);
so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
}
else if (result > 0)
@@ -1035,7 +1035,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
else if (keysok >= so->numberOfFirstKeys)
{
so->btso_curbuf = buf;
- return (_bt_next(scan, dir));
+ return _bt_next(scan, dir);
}
else
{
@@ -1045,7 +1045,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
res = (RetrieveIndexResult) NULL;
}
- return (res);
+ return res;
}
/*
@@ -1093,7 +1093,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
_bt_relbuf(rel, *bufP, BT_READ);
ItemPointerSetInvalid(current);
*bufP = so->btso_curbuf = InvalidBuffer;
- return (false);
+ return false;
}
else
{
@@ -1118,7 +1118,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{
*bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current);
- return (false);
+ return false;
}
}
}
@@ -1144,7 +1144,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
_bt_relbuf(rel, *bufP, BT_READ);
*bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current);
- return (false);
+ return false;
}
else
{
@@ -1192,7 +1192,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{
*bufP = so->btso_curbuf = InvalidBuffer;
ItemPointerSetInvalid(current);
- return (false);
+ return false;
}
}
}
@@ -1204,7 +1204,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
so->btso_curbuf = *bufP;
ItemPointerSet(current, blkno, offnum);
- return (true);
+ return true;
}
/*
@@ -1252,19 +1252,19 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
if (ScanDirectionIsForward(dir) && offnum < maxoff)
{ /* XXX PageIsEmpty? */
ItemPointerSet(current, blkno, OffsetNumberNext(offnum));
- return (true);
+ return true;
}
else if (ScanDirectionIsBackward(dir) && offnum > start)
{
ItemPointerSet(current, blkno, OffsetNumberPrev(offnum));
- return (true);
+ return true;
}
/* if we've hit end of scan we don't have to do any work */
if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque))
- return (false);
+ return false;
else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque))
- return (false);
+ return false;
/*
* Okay, it's off the page; let _bt_step() do the hard work, and we'll
@@ -1283,7 +1283,7 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
if (_bt_step(scan, bufP, dir))
{
pfree(svitem);
- return (true);
+ return true;
}
/* try to find our place again */
@@ -1299,7 +1299,7 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
{
pfree(svitem);
ItemPointerSet(current, blkno, offnum);
- return (false);
+ return false;
}
}
@@ -1312,7 +1312,7 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
elog(ERROR, "btree synchronization error: concurrent update botched scan");
- return (false);
+ return false;
}
/*
@@ -1406,7 +1406,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
{
ItemPointerSet(current, blkno, maxoff);
if (!_bt_step(scan, &buf, BackwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
@@ -1424,13 +1424,13 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(rel, buf, BT_READ);
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
if (start > maxoff) /* start == 2 && maxoff == 1 */
{
ItemPointerSet(current, blkno, maxoff);
if (!_bt_step(scan, &buf, ForwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
@@ -1452,7 +1452,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
{
ItemPointerSet(current, blkno, FirstOffsetNumber);
if (!_bt_step(scan, &buf, ForwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
@@ -1466,12 +1466,12 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
_bt_relbuf(rel, buf, BT_READ);
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
}
/* Go back ! */
ItemPointerSet(current, blkno, FirstOffsetNumber);
if (!_bt_step(scan, &buf, BackwardScanDirection))
- return ((RetrieveIndexResult) NULL);
+ return (RetrieveIndexResult) NULL;
start = ItemPointerGetOffsetNumber(current);
page = BufferGetPage(buf);
@@ -1500,7 +1500,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
else if (keysok >= so->numberOfFirstKeys)
{
so->btso_curbuf = buf;
- return (_bt_next(scan, dir));
+ return _bt_next(scan, dir);
}
else
{
@@ -1510,5 +1510,5 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
res = (RetrieveIndexResult) NULL;
}
- return (res);
+ return res;
}
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c
index 404653f8e9c..5fb3145c36c 100644
--- a/src/backend/access/nbtree/nbtsort.c
+++ b/src/backend/access/nbtree/nbtsort.c
@@ -5,7 +5,7 @@
*
*
* IDENTIFICATION
- * $Id: nbtsort.c,v 1.31 1998/08/25 21:33:57 scrappy Exp $
+ * $Id: nbtsort.c,v 1.32 1998/09/01 03:21:19 momjian Exp $
*
* NOTES
*
@@ -180,11 +180,11 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
if (k1->btsk_item == (BTItem) NULL)
{
if (k2->btsk_item == (BTItem) NULL)
- return (0); /* 1 = 2 */
- return (1); /* 1 > 2 */
+ return 0; /* 1 = 2 */
+ return 1; /* 1 > 2 */
}
else if (k2->btsk_item == (BTItem) NULL)
- return (-1); /* 1 < 2 */
+ return -1; /* 1 < 2 */
for (i = 0; i < _bt_nattr; i++)
{
@@ -195,17 +195,17 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
equal_isnull = true;
continue;
}
- return (1); /* NULL ">" NOT_NULL */
+ return 1; /* NULL ">" NOT_NULL */
}
else if (k2_nulls[i] != ' ') /* k2 attr is NULL */
- return (-1); /* NOT_NULL "<" NULL */
+ return -1; /* NOT_NULL "<" NULL */
if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
k1_datum[i], k2_datum[i]))
- return (1); /* 1 > 2 */
+ return 1; /* 1 > 2 */
else if (_bt_invokestrat(_bt_sortrel, i + 1, BTGreaterStrategyNumber,
k2_datum[i], k1_datum[i]))
- return (-1); /* 1 < 2 */
+ return -1; /* 1 < 2 */
}
if (_bt_inspool->isunique && !equal_isnull)
@@ -213,7 +213,7 @@ _bt_isortcmp(BTSortKey *k1, BTSortKey *k2)
_bt_spooldestroy((void *) _bt_inspool);
elog(ERROR, "Cannot create unique index. Table contains non-unique values");
}
- return (0); /* 1 = 2 */
+ return 0; /* 1 = 2 */
}
static void
@@ -307,17 +307,17 @@ _bt_pqnext(BTPriQueue *q, BTPriQueueElem *e)
{
if (q->btpq_nelem < 1)
{ /* already empty */
- return (-1);
+ return -1;
}
*e = q->btpq_queue[0]; /* struct = */
if (--q->btpq_nelem < 1)
{ /* now empty, don't sift */
- return (0);
+ return 0;
}
q->btpq_queue[0] = q->btpq_queue[q->btpq_nelem]; /* struct = */
_bt_pqsift(q, 0);
- return (0);
+ return 0;
}
static void
@@ -426,7 +426,7 @@ _bt_tapecreate(char *fname)
/* initialize the buffer */
_bt_tapereset(tape);
- return (tape);
+ return tape;
}
/*
@@ -468,7 +468,7 @@ _bt_taperead(BTTapeBlock *tape)
if (tape->bttb_eor)
{
- return (0); /* we are already at End-Of-Run */
+ return 0; /* we are already at End-Of-Run */
}
/*
@@ -482,11 +482,11 @@ _bt_taperead(BTTapeBlock *tape)
if (nread != TAPEBLCKSZ)
{
Assert(nread == 0); /* we are at EOF */
- return (0);
+ return 0;
}
Assert(tape->bttb_magic == BTTAPEMAGIC);
NDirectFileRead += TAPEBLCKSZ / BLCKSZ;
- return (1);
+ return 1;
}
/*
@@ -506,11 +506,11 @@ _bt_tapenext(BTTapeBlock *tape, char **pos)
BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top)
- return ((BTItem) NULL);
+ return (BTItem) NULL;
bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti);
*pos += DOUBLEALIGN(itemsz);
- return (bti);
+ return bti;
}
/*
@@ -574,7 +574,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
_bt_isortcmpinit(index, btspool);
- return ((void *) btspool);
+ return (void *) btspool;
}
/*
@@ -838,7 +838,7 @@ _bt_pagestate(Relation index, int flags, int level, bool doupper)
state->btps_level = level;
state->btps_doupper = doupper;
- return ((void *) state);
+ return (void *) state;
}
/*
@@ -859,7 +859,7 @@ _bt_minitem(Page opage, BlockNumber oblkno, int atend)
nbti = _bt_formitem(&(obti->bti_itup));
ItemPointerSet(&(nbti->bti_itup.t_tid), oblkno, P_HIKEY);
- return (nbti);
+ return nbti;
}
/*
@@ -1074,7 +1074,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
state->btps_lastoff = last_off;
state->btps_firstoff = first_off;
- return (last_bti);
+ return last_bti;
}
static void
diff --git a/src/backend/access/nbtree/nbtstrat.c b/src/backend/access/nbtree/nbtstrat.c
index 6af9df2b65a..3d155aa164b 100644
--- a/src/backend/access/nbtree/nbtstrat.c
+++ b/src/backend/access/nbtree/nbtstrat.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.6 1997/09/08 02:20:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.7 1998/09/01 03:21:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -115,7 +115,7 @@ _bt_getstrat(Relation rel,
Assert(StrategyNumberIsValid(strat));
- return (strat);
+ return strat;
}
bool
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index f8a8e860dc3..30baab1e9f5 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.21 1998/08/19 02:01:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.22 1998/09/01 03:21:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,7 +44,7 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
bits16 flag;
natts = rel->rd_rel->relnatts;
- itupdesc = RelationGetTupleDescriptor(rel);
+ itupdesc = RelationGetDescr(rel);
skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
@@ -64,7 +64,7 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
ScanKeyEntryInitialize(&skey[i], flag, (AttrNumber) (i + 1), proc, arg);
}
- return (skey);
+ return skey;
}
void
@@ -306,7 +306,7 @@ _bt_formitem(IndexTuple itup)
#ifndef BTREE_VERSION_1
btitem->bti_oid = newoid();
#endif
- return (btitem);
+ return btitem;
}
#ifdef NOT_USED
@@ -317,10 +317,10 @@ _bt_checkqual(IndexScanDesc scan, IndexTuple itup)
so = (BTScanOpaque) scan->opaque;
if (so->numberOfKeys > 0)
- return (index_keytest(itup, RelationGetTupleDescriptor(scan->relation),
+ return (index_keytest(itup, RelationGetDescr(scan->relation),
so->numberOfKeys, so->keyData));
else
- return (true);
+ return true;
}
#endif
@@ -333,10 +333,10 @@ _bt_checkforkeys(IndexScanDesc scan, IndexTuple itup, Size keysz)
so = (BTScanOpaque) scan->opaque;
if (keysz > 0 && so->numberOfKeys >= keysz)
- return (index_keytest(itup, RelationGetTupleDescriptor(scan->relation),
+ return (index_keytest(itup, RelationGetDescr(scan->relation),
keysz, so->keyData));
else
- return (true);
+ return true;
}
#endif
@@ -354,10 +354,10 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
*keysok = 0;
if (keysz == 0)
- return (true);
+ return true;
key = so->keyData;
- tupdesc = RelationGetTupleDescriptor(scan->relation);
+ tupdesc = RelationGetDescr(scan->relation);
IncrIndexProcessed();
@@ -370,7 +370,7 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
/* btree doesn't support 'A is null' clauses, yet */
if (isNull || key[0].sk_flags & SK_ISNULL)
- return (false);
+ return false;
if (key[0].sk_flags & SK_COMMUTE)
{
@@ -386,12 +386,12 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- return (false);
+ return false;
keysz -= 1;
key++;
(*keysok)++;
}
- return (true);
+ return true;
}