summaryrefslogtreecommitdiff
path: root/src/backend/access/nbtree
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-06-15 19:30:31 +0000
committerBruce Momjian <bruce@momjian.us>1998-06-15 19:30:31 +0000
commit6bd323c6b3f65b26273d5efb7ddd0ac04d039546 (patch)
tree6106db4e7512e765ca8c48963fb750cb63fec96f /src/backend/access/nbtree
parent27db9ecd0b15abca733a99dab3bf9771ad70507d (diff)
downloadpostgresql-6bd323c6b3f65b26273d5efb7ddd0ac04d039546.tar.gz
Remove un-needed braces around single statements.
Diffstat (limited to 'src/backend/access/nbtree')
-rw-r--r--src/backend/access/nbtree/nbtinsert.c14
-rw-r--r--src/backend/access/nbtree/nbtree.c8
-rw-r--r--src/backend/access/nbtree/nbtscan.c4
-rw-r--r--src/backend/access/nbtree/nbtsearch.c30
-rw-r--r--src/backend/access/nbtree/nbtsort.c38
-rw-r--r--src/backend/access/nbtree/nbtutils.c8
6 files changed, 6 insertions, 96 deletions
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index b00dae99a0..350e198514 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.25 1998/01/15 19:42:10 pgsql Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.26 1998/06/15 19:27:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -127,9 +127,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
}
/* get next offnum */
if (offset < maxoff)
- {
offset = OffsetNumberNext(offset);
- }
else
{ /* move right ? */
if (P_RIGHTMOST(opaque))
@@ -906,13 +904,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
*/
if (P_RIGHTMOST(ropaque))
- {
itemid = PageGetItemId(rightpage, P_HIKEY);
- }
else
- {
itemid = PageGetItemId(rightpage, P_FIRSTKEY);
- }
itemsz = ItemIdGetLength(itemid);
item = (BTItem) PageGetItem(rightpage, itemid);
@@ -1178,9 +1172,7 @@ _bt_pgaddtup(Relation rel,
first = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (afteritem == (BTItem) NULL)
- {
itup_off = _bt_binsrch(rel, buf, keysz, itup_scankey, BT_INSERTION);
- }
else
{
itup_off = first;
@@ -1358,9 +1350,7 @@ _bt_itemcmp(Relation rel,
compare = (strat == BTLessStrategyNumber) ? true : false;
}
else
- {
compare = _bt_invokestrat(rel, i, strat, attrDatum1, attrDatum2);
- }
if (compare) /* true for one of ">, <, =" */
{
@@ -1430,9 +1420,7 @@ _bt_updateitem(Relation rel,
/* this should never happen (in theory) */
if (!BTItemSame(item, oldItem))
- {
elog(FATAL, "_bt_getstackbuf was lying!!");
- }
/*
* It's defined by caller (_bt_insertonpg)
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 72e0731edd..b4d1185a60 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.25 1998/02/26 04:29:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.26 1998/06/15 19:27:56 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -267,20 +267,14 @@ btbuild(Relation heap,
* into the btree.
*/
if (usefast)
- {
_bt_spool(index, btitem, spool);
- }
else
- {
res = _bt_doinsert(index, btitem, isunique, heap);
- }
pfree(btitem);
pfree(itup);
if (res)
- {
pfree(res);
- }
}
/* okay, all heap tuples are indexed */
diff --git a/src/backend/access/nbtree/nbtscan.c b/src/backend/access/nbtree/nbtscan.c
index a7ae57f91a..8fc6e736c6 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.13 1998/02/28 13:53:18 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.14 1998/06/15 19:27:57 momjian Exp $
*
*
* NOTES
@@ -72,9 +72,7 @@ _bt_dropscan(IndexScanDesc scan)
for (chk = BTScans;
chk != (BTScanList) NULL && chk->btsl_scan != scan;
chk = chk->btsl_next)
- {
last = chk;
- }
if (chk == (BTScanList) NULL)
elog(ERROR, "btree scan list trashed; can't find 0x%lx", scan);
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index d11874d56d..633a310ea1 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.35 1998/05/13 03:44:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.36 1998/06/15 19:27:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -541,9 +541,7 @@ _bt_firsteq(Relation rel,
while (offnum > limit
&& _bt_compare(rel, itupdesc, page,
keysz, scankey, OffsetNumberPrev(offnum)) == 0)
- {
offnum = OffsetNumberPrev(offnum);
- }
return (offnum);
}
@@ -616,9 +614,7 @@ _bt_compare(Relation rel,
* - see new comments above...
*/
if (!P_RIGHTMOST(opaque))
- {
elog(ERROR, "_bt_compare: invalid comparison to high key");
- }
#if 0
@@ -634,9 +630,7 @@ _bt_compare(Relation rel,
if (_bt_skeycmp(rel, keysz, scankey, page, itemid,
BTEqualStrategyNumber))
- {
return (0);
- }
return (1);
#endif
}
@@ -676,9 +670,7 @@ _bt_compare(Relation rel,
tmpres = (long) -1; /* NOT_NULL "<" NULL */
}
else
- {
tmpres = (long) FMGR_PTR2(&entry->sk_func, entry->sk_argument, datum);
- }
result = tmpres;
/* if the keys are unequal, return the difference */
@@ -1090,9 +1082,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
if (ScanDirectionIsForward(dir))
{
if (!PageIsEmpty(page) && offnum < maxoff)
- {
offnum = OffsetNumberNext(offnum);
- }
else
{
@@ -1119,9 +1109,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (!PageIsEmpty(page) && start <= maxoff)
- {
break;
- }
else
{
blkno = opaque->btpo_next;
@@ -1145,9 +1133,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
start = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
if (offnum > start)
- {
offnum = OffsetNumberPrev(offnum);
- }
else
{
@@ -1196,9 +1182,7 @@ _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
/* anything to look at here? */
if (!PageIsEmpty(page) && maxoff >= start)
- {
break;
- }
else
{
blkno = opaque->btpo_prev;
@@ -1278,13 +1262,9 @@ _bt_twostep(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
/* if we've hit end of scan we don't have to do any work */
if (ScanDirectionIsForward(dir) && P_RIGHTMOST(opaque))
- {
return (false);
- }
else if (ScanDirectionIsBackward(dir) && P_LEFTMOST(opaque))
- {
return (false);
- }
/*
* Okay, it's off the page; let _bt_step() do the hard work, and we'll
@@ -1371,13 +1351,9 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
break;
if (ScanDirectionIsForward(dir))
- {
offnum = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
- }
else
- {
offnum = PageGetMaxOffsetNumber(page);
- }
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &(btitem->bti_itup);
@@ -1461,9 +1437,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
}
/* new stuff ends here */
else
- {
ItemPointerSet(current, blkno, start);
- }
}
else if (ScanDirectionIsBackward(dir))
{
@@ -1510,9 +1484,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
}
}
else
- {
elog(ERROR, "Illegal scan direction %d", dir);
- }
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, start));
itup = &(btitem->bti_itup);
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c
index b6f7b337a9..12effb71eb 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.29 1998/02/26 04:29:54 momjian Exp $
+ * $Id: nbtsort.c,v 1.30 1998/06/15 19:27:59 momjian Exp $
*
* NOTES
*
@@ -288,9 +288,7 @@ _bt_pqsift(BTPriQueue *q, int parent)
if (child < q->btpq_nelem - 1)
{
if (GREATER(&(q->btpq_queue[child]), &(q->btpq_queue[child + 1])))
- {
++child;
- }
}
if (GREATER(&(q->btpq_queue[parent]), &(q->btpq_queue[child])))
{
@@ -300,9 +298,7 @@ _bt_pqsift(BTPriQueue *q, int parent)
parent = child;
}
else
- {
parent = child + 1;
- }
}
}
@@ -331,18 +327,14 @@ _bt_pqadd(BTPriQueue *q, BTPriQueueElem *e)
parent;
if (q->btpq_nelem >= MAXELEM)
- {
elog(ERROR, "_bt_pqadd: queue overflow");
- }
child = q->btpq_nelem++;
while (child > 0)
{
parent = child / 2;
if (GREATER(e, &(q->btpq_queue[parent])))
- {
break;
- }
else
{
q->btpq_queue[child] = q->btpq_queue[parent]; /* struct = */
@@ -424,9 +416,7 @@ _bt_tapecreate(char *fname)
BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
if (tape == (BTTapeBlock *) NULL)
- {
elog(ERROR, "_bt_tapecreate: out of memory");
- }
tape->bttb_magic = BTTAPEMAGIC;
@@ -516,9 +506,7 @@ _bt_tapenext(BTTapeBlock *tape, char **pos)
BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top)
- {
return ((BTItem) NULL);
- }
bti = (BTItem) *pos;
itemsz = BTITEMSZ(bti);
*pos += DOUBLEALIGN(itemsz);
@@ -561,9 +549,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
if (btspool == (BTSpool *) NULL || fname == (char *) NULL)
- {
elog(ERROR, "_bt_spoolinit: out of memory");
- }
MemSet((char *) btspool, 0, sizeof(BTSpool));
btspool->bts_ntapes = ntapes;
btspool->bts_tape = 0;
@@ -575,9 +561,7 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
(BTTapeBlock **) palloc(sizeof(BTTapeBlock *) * ntapes);
if (btspool->bts_itape == (BTTapeBlock **) NULL ||
btspool->bts_otape == (BTTapeBlock **) NULL)
- {
elog(ERROR, "_bt_spoolinit: out of memory");
- }
for (i = 0; i < ntapes; ++i)
{
@@ -621,9 +605,7 @@ _bt_spoolflush(BTSpool *btspool)
for (i = 0; i < btspool->bts_ntapes; ++i)
{
if (!EMPTYTAPE(btspool->bts_otape[i]))
- {
_bt_tapewrite(btspool->bts_otape[i], 1);
- }
}
}
@@ -716,9 +698,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
(BTSortKey *) palloc(it_ntup * sizeof(BTSortKey));
pos = itape->bttb_data;
for (i = 0; i < it_ntup; ++i)
- {
_bt_setsortkey(index, _bt_tapenext(itape, &pos), &(parray[i]));
- }
/*
* qsort the pointer array.
@@ -790,9 +770,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
/* insert this item into the current buffer */
if (btitem != (BTItem) NULL)
- {
_bt_tapeadd(itape, btitem, itemsz);
- }
}
/*
@@ -1008,9 +986,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
* shuffling).
*/
for (o = last_off; o > first_off; o = OffsetNumberPrev(o))
- {
PageIndexTupleDelete(opage, o);
- }
hii = PageGetItemId(opage, P_HIKEY);
ii = PageGetItemId(opage, first_off);
*hii = *ii;
@@ -1085,14 +1061,10 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
#endif /* FASTBUILD_DEBUG && FASTBUILD_MERGE */
#endif
if (last_bti == (BTItem) NULL)
- {
first_off = P_FIRSTKEY;
- }
else if (!_bt_itemcmp(index, _bt_nattr,
bti, last_bti, BTEqualStrategyNumber))
- {
first_off = off;
- }
last_off = off;
last_bti = (BTItem) PageGetItem(npage, PageGetItemId(npage, off));
@@ -1226,9 +1198,7 @@ _bt_merge(Relation index, BTSpool *btspool)
do
{
if (_bt_taperead(itape) == 0)
- {
tapedone[t] = 1;
- }
} while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t])
{
@@ -1237,9 +1207,7 @@ _bt_merge(Relation index, BTSpool *btspool)
_bt_setsortkey(index, _bt_tapenext(itape, &tapepos[t]),
&(e.btpqe_item));
if (e.btpqe_item.btsk_item != (BTItem) NULL)
- {
_bt_pqadd(&q, &e);
- }
}
}
@@ -1334,9 +1302,7 @@ _bt_merge(Relation index, BTSpool *btspool)
do
{
if (_bt_taperead(itape) == 0)
- {
tapedone[t] = 1;
- }
} while (!tapedone[t] && EMPTYTAPE(itape));
if (!tapedone[t])
{
@@ -1372,9 +1338,7 @@ _bt_merge(Relation index, BTSpool *btspool)
* pages instead of merging into a tape file.
*/
if (nruns <= btspool->bts_ntapes)
- {
doleaf = true;
- }
} while (nruns > 0); /* pass */
_bt_uppershutdown(index, state);
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index 652f1c6978..f4fd602898 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.19 1998/04/27 04:04:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.20 1998/06/15 19:27:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -157,9 +157,7 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
if (i == numberOfKeys || cur->sk_attno != attno)
{
if (cur->sk_attno != attno + 1 && i < numberOfKeys)
- {
elog(ERROR, "_bt_orderkeys: key(s) for attribute %d missed", attno + 1);
- }
/*
* If = has been specified, no other key will be used. In case
@@ -373,9 +371,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);
- }
if (key[0].sk_flags & SK_COMMUTE)
{
@@ -391,9 +387,7 @@ _bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size *keysok)
}
if (!test == !(key[0].sk_flags & SK_NEGATE))
- {
return (false);
- }
keysz -= 1;
key++;