1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Major code cleanups from D'arcy (-Wall -Werror)

This commit is contained in:
Marc G. Fournier
1996-10-23 07:42:13 +00:00
parent 29a0fb84fc
commit f36b2560a4
44 changed files with 249 additions and 147 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.2 1996/10/20 10:53:02 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.3 1996/10/23 07:38:54 scrappy Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -20,8 +20,10 @@
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <string.h>
#include <time.h>
#include "postgres.h"
#include "utils/nabstime.h"
int32

View File

@@ -7,11 +7,14 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.2 1996/10/20 10:53:03 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.3 1996/10/23 07:39:00 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <time.h>
#include "postgres.h"
#include "catalog/pg_attribute.h"
@@ -37,15 +40,14 @@
#include "storage/itemid.h"
#include "storage/item.h"
#include "storage/bufpage.h"
#include <time.h>
#include "utils/nabstime.h"
#include "utils/palloc.h"
#include "access/htup.h"
#include "utils/tqual.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/nbtree.h"
#include <stdio.h>
#include "storage/ipc.h"
#include "storage/bufmgr.h"

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.2 1996/10/20 10:53:06 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.3 1996/10/23 07:39:04 scrappy Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
@@ -19,6 +19,8 @@
*
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <time.h>
#include "postgres.h"
@@ -36,7 +38,6 @@
#include "utils/rel.h"
#include "storage/buf.h"
#include "storage/block.h"
#include "storage/off.h"
#include "storage/itemptr.h"
@@ -45,7 +46,6 @@
#include "storage/itemid.h"
#include "storage/item.h"
#include "storage/bufpage.h"
#include <time.h>
#include "utils/nabstime.h"
#include "access/htup.h"
#include "utils/tqual.h"
@@ -53,9 +53,9 @@
#include "access/sdir.h"
#include "access/nbtree.h"
#include <stdio.h>
#include "storage/ipc.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#define BTREE_METAPAGE 0
#define BTREE_MAGIC 0x053162

View File

@@ -8,13 +8,15 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.4 1996/10/20 10:53:08 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.5 1996/10/23 07:39:06 scrappy Exp $
*
* NOTES
* This file contains only the public interface routines.
*
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <time.h>
#include "postgres.h"
@@ -25,6 +27,7 @@
#include "storage/fd.h"
#include "catalog/pg_am.h"
#include "catalog/pg_class.h"
#include "catalog/index.h"
#include "nodes/nodes.h"
#include "rewrite/prs2lock.h"
#include "access/skey.h"
@@ -40,10 +43,11 @@
#include "storage/item.h"
#include "storage/buf.h"
#include "storage/bufpage.h"
#include <time.h>
#include "storage/bufmgr.h"
#include "utils/nabstime.h"
#include "access/htup.h"
#include "utils/tqual.h"
#include "utils/palloc.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/nbtree.h"
@@ -59,7 +63,6 @@
#include "nodes/parsenodes.h"
#include "tcop/dest.h"
#include "executor/execdesc.h"
#include <stdio.h>
#include "catalog/pg_index.h"
#include "executor/executor.h"
@@ -96,13 +99,15 @@ btbuild(Relation heap,
TupleDesc htupdesc, itupdesc;
Datum *attdata;
bool *nulls;
InsertIndexResult res;
InsertIndexResult res = 0;
int nhtups, nitups;
int i;
BTItem btitem;
#ifndef OMIT_PARTIAL_INDEX
ExprContext *econtext;
TupleTable tupleTable;
TupleTableSlot *slot;
#endif
Oid hrelid, irelid;
Node *pred, *oldPred;
void *spool;
@@ -139,6 +144,12 @@ btbuild(Relation heap,
econtext = makeNode(ExprContext);
FillDummyExprContext(econtext, slot, htupdesc, InvalidBuffer);
}
else
{
econtext = NULL;
tupleTable = NULL;
slot = NULL;
}
#endif /* OMIT_PARTIAL_INDEX */
/* start a heap scan */
@@ -152,6 +163,8 @@ btbuild(Relation heap,
spool = _bt_spoolinit(index, 7);
res = (InsertIndexResult) NULL;
}
else
spool = NULL;
for (; HeapTupleIsValid(htup); htup = heap_getnext(hscan, 0, &buffer)) {

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.2 1996/10/20 10:53:10 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.3 1996/10/23 07:39:08 scrappy Exp $
*
*
* NOTES
@@ -55,6 +55,7 @@
#include "utils/nabstime.h"
#include "access/htup.h"
#include "utils/tqual.h"
#include "utils/palloc.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/nbtree.h"

View File

@@ -7,11 +7,13 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.3 1996/10/20 10:53:11 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.4 1996/10/23 07:39:10 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <time.h>
#include "postgres.h"
#include "catalog/pg_attribute.h"
@@ -36,13 +38,17 @@
#include "storage/item.h"
#include "storage/buf.h"
#include "storage/bufpage.h"
#include <time.h>
#include "storage/bufmgr.h"
#include "utils/nabstime.h"
#include "access/htup.h"
#include "utils/tqual.h"
#include "utils/palloc.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/nbtree.h"
#include "access/genam.h"
#include "fmgr.h"
static BTStack _bt_searchr(Relation rel, int keysz, ScanKey scankey, Buffer *bufP, BTStack stack_in);
static OffsetNumber _bt_firsteq(Relation rel, TupleDesc itupdesc, Page page, Size keysz, ScanKey scankey, OffsetNumber offnum);
@@ -296,14 +302,13 @@ _bt_binsrch(Relation rel,
Page page;
BTPageOpaque opaque;
OffsetNumber low, mid, high;
bool match;
int result;
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
/* by convention, item 0 on any non-rightmost page is the high key */
low = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
low = mid = P_RIGHTMOST(opaque) ? P_HIKEY : P_FIRSTKEY;
high = PageGetMaxOffsetNumber(page);
@@ -320,7 +325,6 @@ _bt_binsrch(Relation rel,
return (low);
itupdesc = RelationGetTupleDescriptor(rel);
match = false;
while ((high - low) > 1) {
mid = low + ((high - low) / 2);
@@ -330,16 +334,9 @@ _bt_binsrch(Relation rel,
low = mid;
else if (result < 0)
high = mid - 1;
else {
match = true;
break;
}
}
/* if we found a match, we want to find the first one on the page */
if (match) {
else
return (_bt_firsteq(rel, itupdesc, page, keysz, scankey, mid));
} else {
}
/*
* We terminated because the endpoints got too close together. There
@@ -387,7 +384,6 @@ _bt_binsrch(Relation rel,
return (OffsetNumberNext(high));
}
}
}
}
static OffsetNumber
@@ -1039,7 +1035,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
ItemPointer current;
ItemPointer iptr;
OffsetNumber offnum, maxoff;
OffsetNumber start;
OffsetNumber start = 0;
BlockNumber blkno;
BTItem btitem;
IndexTuple itup;

View File

@@ -5,7 +5,7 @@
*
*
* IDENTIFICATION
* $Id: nbtsort.c,v 1.4 1996/10/20 10:53:13 scrappy Exp $
* $Id: nbtsort.c,v 1.5 1996/10/23 07:39:11 scrappy Exp $
*
* NOTES
*
@@ -47,6 +47,10 @@
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include "postgres.h"
#include "catalog/pg_attribute.h"
@@ -71,17 +75,14 @@
#include "storage/item.h"
#include "storage/buf.h"
#include "storage/bufpage.h"
#include <time.h>
#include "utils/nabstime.h"
#include "access/htup.h"
#include "utils/tqual.h"
#include "utils/palloc.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/nbtree.h"
#include <stdio.h>
#include <fcntl.h>
#include "storage/ipc.h"
#include "storage/bufmgr.h"

View File

@@ -7,11 +7,13 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.3 1996/10/20 10:53:18 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.4 1996/10/23 07:39:15 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <time.h>
#include "postgres.h"
#include "catalog/pg_attribute.h"
@@ -36,15 +38,18 @@
#include "storage/item.h"
#include "storage/buf.h"
#include "storage/bufpage.h"
#include <time.h>
#include "utils/nabstime.h"
#include "access/htup.h"
#include "utils/tqual.h"
#include "utils/palloc.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/nbtree.h"
#include "access/istrat.h"
#include "access/genam.h"
#include "access/iqual.h"
#include "fmgr.h"
ScanKey
_bt_mkscankey(Relation rel, IndexTuple itup)