[PATCH] libc style cleanup (libc/db)

Alexey Slynko slynko at elizabet.tronet.ru
Mon Oct 17 09:35:59 PDT 2005


Hi,

this patch does the following jobs:

1) Convert old-style function prototypes
2) Remove warnings abouth parentheses
3) Remove warnings about variable initialization
4) Remove warnings about unused function attributes
5) Add the lost includes
6) Rename variable names, that hides by another included parts


Index: btree/bt_conv.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_conv.c,v
retrieving revision 1.5
diff -u -r1.5 bt_conv.c
--- btree/bt_conv.c	19 Sep 2005 09:20:37 -0000	1.5
+++ btree/bt_conv.c	13 Oct 2005 22:24:46 -0000
@@ -53,10 +53,7 @@
    *	h:	page to convert
    */
   void
-__bt_pgin(t, pg, pp)
-	void *t;
-	pgno_t pg;
-	void *pp;
+__bt_pgin(void *t, pgno_t pg, void *pp)
   {
   	PAGE *h;
   	indx_t i, top;
@@ -121,10 +118,7 @@
   }
   void
-__bt_pgout(t, pg, pp)
-	void *t;
-	pgno_t pg;
-	void *pp;
+__bt_pgout(void *t, pgno_t pg, void *pp)
   {
   	PAGE *h;
   	indx_t i, top;
@@ -195,8 +189,7 @@
    *	p:	page to convert
    */
   static void
-mswap(pg)
-	PAGE *pg;
+mswap(PAGE *pg)
   {
   	char *p;
Index: btree/bt_delete.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_delete.c,v
retrieving revision 1.7
diff -u -r1.7 bt_delete.c
--- btree/bt_delete.c	19 Sep 2005 09:20:37 -0000	1.7
+++ btree/bt_delete.c	13 Oct 2005 22:27:37 -0000
@@ -55,10 +55,7 @@
    * Return RET_SPECIAL if the key is not found.
    */
   int
-__bt_delete(dbp, key, flags)
-	const DB *dbp;
-	const DBT *key;
-	u_int flags;
+__bt_delete(const DB *dbp, const DBT *key, u_int flags)
   {
   	BTREE *t;
   	CURSOR *c;
@@ -136,10 +133,7 @@
    *	0 on success, 1 on failure
    */
   static int
-__bt_stkacq(t, hp, c)
-	BTREE *t;
-	PAGE **hp;
-	CURSOR *c;
+__bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c)
   {
   	BINTERNAL *bi;
   	EPG *e;
@@ -283,9 +277,7 @@
    *	RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
    */
   static int
-__bt_bdelete(t, key)
-	BTREE *t;
-	const DBT *key;
+__bt_bdelete(BTREE *t, const DBT *key)
   {
   	EPG *e;
   	PAGE *h;
@@ -370,9 +362,7 @@
    *	mpool_put's the page
    */
   static int
-__bt_pdelete(t, h)
-	BTREE *t;
-	PAGE *h;
+__bt_pdelete(BTREE *t, PAGE *h)
   {
   	BINTERNAL *bi;
   	PAGE *pg;
@@ -622,9 +612,7 @@
    *	h:	page to be deleted
    */
   static int
-__bt_relink(t, h)
-	BTREE *t;
-	PAGE *h;
+__bt_relink(BTREE *t, PAGE *h)
   {
   	PAGE *pg;
Index: btree/bt_get.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_get.c,v
retrieving revision 1.3
diff -u -r1.3 bt_get.c
--- btree/bt_get.c	19 Sep 2005 09:20:37 -0000	1.3
+++ btree/bt_get.c	13 Oct 2005 22:28:22 -0000
@@ -55,11 +55,7 @@
    *	RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
    */
   int
-__bt_get(dbp, key, data, flags)
-	const DB *dbp;
-	const DBT *key;
-	DBT *data;
-	u_int flags;
+__bt_get(const DB *dbp, const DBT *key, DBT *data, u_int flags)
   {
   	BTREE *t;
   	EPG *e;
Index: btree/bt_open.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_open.c,v
retrieving revision 1.5
diff -u -r1.5 bt_open.c
--- btree/bt_open.c	19 Sep 2005 09:20:37 -0000	1.5
+++ btree/bt_open.c	14 Oct 2005 01:04:45 -0000
@@ -86,10 +86,8 @@
    *
    */
   DB *
-__bt_open(fname, flags, mode, openinfo, dflags)
-	const char *fname;
-	int flags, mode, dflags;
-	const BTREEINFO *openinfo;
+__bt_open(const char *fname, int flags, int mode, 
+	const BTREEINFO *openinfo, int dflags)
   {
   	struct stat sb;
   	BTMETA m;
@@ -349,8 +347,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   static int
-nroot(t)
-	BTREE *t;
+nroot(BTREE *t)
   {
   	PAGE *meta, *root;
   	pgno_t npg;
@@ -383,7 +380,7 @@
   }

   static int
-tmp()
+tmp(void)
   {
   	sigset_t set, oset;
   	int fd;
@@ -404,7 +401,7 @@
   }
   static int
-byteorder()
+byteorder(void)
   {
   	u_int32_t x;
   	u_char *p;
@@ -422,8 +419,7 @@
   }
   int
-__bt_fd(dbp)
-        const DB *dbp;
+__bt_fd(const DB *dbp)
   {
   	BTREE *t;
Index: btree/bt_overflow.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_overflow.c,v
retrieving revision 1.3
diff -u -r1.3 bt_overflow.c
--- btree/bt_overflow.c	19 Sep 2005 09:20:37 -0000	1.3
+++ btree/bt_overflow.c	13 Oct 2005 22:31:20 -0000
@@ -72,12 +72,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__ovfl_get(t, p, ssz, buf, bufsz)
-	BTREE *t;
-	void *p;
-	size_t *ssz;
-	void **buf;
-	size_t *bufsz;
+__ovfl_get(BTREE *t, void *p, size_t *ssz, void **buf, size_t *bufsz)
   {
   	PAGE *h;
   	pgno_t pg;
@@ -131,10 +126,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__ovfl_put(t, dbt, pg)
-	BTREE *t;
-	const DBT *dbt;
-	pgno_t *pg;
+__ovfl_put(BTREE *t, const DBT *dbt, pgno_t *pg)
   {
   	PAGE *h, *last;
   	void *p;
@@ -185,9 +177,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__ovfl_delete(t, p)
-	BTREE *t;
-	void *p;
+__ovfl_delete(BTREE *t, void *p)
   {
   	PAGE *h;
   	pgno_t pg;
Index: btree/bt_page.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_page.c,v
retrieving revision 1.3
diff -u -r1.3 bt_page.c
--- btree/bt_page.c	19 Sep 2005 09:20:37 -0000	1.3
+++ btree/bt_page.c	13 Oct 2005 22:32:22 -0000
@@ -52,9 +52,7 @@
    *	mpool_put's the page.
    */
   int
-__bt_free(t, h)
-	BTREE *t;
-	PAGE *h;
+__bt_free(BTREE *t, PAGE *h)
   {
   	/* Insert the page at the head of the free list. */
   	h->prevpg = P_INVALID;
@@ -78,9 +76,7 @@
    *	Pointer to a page, NULL on error.
    */
   PAGE *
-__bt_new(t, npg)
-	BTREE *t;
-	pgno_t *npg;
+__bt_new(BTREE *t, pgno_t *npg)
   {
   	PAGE *h;
Index: btree/bt_put.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_put.c,v
retrieving revision 1.7
diff -u -r1.7 bt_put.c
--- btree/bt_put.c	19 Sep 2005 09:20:37 -0000	1.7
+++ btree/bt_put.c	13 Oct 2005 22:33:36 -0000
@@ -59,11 +59,7 @@
    *	tree and R_NOOVERWRITE specified.
    */
   int
-__bt_put(dbp, key, data, flags)
-	const DB *dbp;
-	DBT *key;
-	const DBT *data;
-	u_int flags;
+__bt_put(const DB *dbp, DBT *key, const DBT *data, u_int flags)
   {
   	BTREE *t;
   	DBT tkey, tdata;
@@ -259,10 +255,7 @@
    * 	EPG for new record or NULL if not found.
    */
   static EPG *
-bt_fast(t, key, data, exactp)
-	BTREE *t;
-	const DBT *key, *data;
-	int *exactp;
+bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp)
   {
   	PAGE *h;
   	u_int32_t nbytes;
Index: btree/bt_search.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_search.c,v
retrieving revision 1.5
diff -u -r1.5 bt_search.c
--- btree/bt_search.c	19 Sep 2005 09:20:37 -0000	1.5
+++ btree/bt_search.c	13 Oct 2005 22:34:56 -0000
@@ -58,10 +58,7 @@
    *	the bt_cur field of the tree.  A pointer to the field is returned.
    */
   EPG *
-__bt_search(t, key, exactp)
-	BTREE *t;
-	const DBT *key;
-	int *exactp;
+__bt_search(BTREE *t, const DBT *key, int *exactp)
   {
   	PAGE *h;
   	indx_t base, index, lim;
@@ -143,11 +140,7 @@
    *	If an exact match found.
    */
   static int
-__bt_snext(t, h, key, exactp)
-	BTREE *t;
-	PAGE *h;
-	const DBT *key;
-	int *exactp;
+__bt_snext(BTREE *t, PAGE *h, const DBT *key, int *exactp)
   {
   	EPG e;
@@ -182,11 +175,7 @@
    *	If an exact match found.
    */
   static int
-__bt_sprev(t, h, key, exactp)
-	BTREE *t;
-	PAGE *h;
-	const DBT *key;
-	int *exactp;
+__bt_sprev(BTREE *t, PAGE *h, const DBT *key, int *exactp)
   {
   	EPG e;
Index: btree/bt_seq.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_seq.c,v
retrieving revision 1.6
diff -u -r1.6 bt_seq.c
--- btree/bt_seq.c	19 Sep 2005 09:20:37 -0000	1.6
+++ btree/bt_seq.c	13 Oct 2005 22:37:56 -0000
@@ -69,10 +69,7 @@
    *	RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
    */
   int
-__bt_seq(dbp, key, data, flags)
-	const DB *dbp;
-	DBT *key, *data;
-	u_int flags;
+__bt_seq(const DB *dbp, DBT *key, DBT *data, u_int flags)
   {
   	BTREE *t;
   	EPG e;
@@ -144,11 +141,7 @@
    *	RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
    */
   static int
-__bt_seqset(t, ep, key, flags)
-	BTREE *t;
-	EPG *ep;
-	DBT *key;
-	int flags;
+__bt_seqset(BTREE *t, EPG *ep, DBT *key, int flags)
   {
   	PAGE *h;
   	pgno_t pg;
@@ -232,10 +225,7 @@
    *	RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
    */
   static int
-__bt_seqadv(t, ep, flags)
-	BTREE *t;
-	EPG *ep;
-	int flags;
+__bt_seqadv(BTREE *t, EPG *ep, int flags)
   {
   	CURSOR *c;
   	PAGE *h;
@@ -336,11 +326,7 @@
    *	or RET_SPECIAL if no such key exists.
    */
   static int
-__bt_first(t, key, erval, exactp)
-	BTREE *t;
-	const DBT *key;
-	EPG *erval;
-	int *exactp;
+__bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp)
   {
   	PAGE *h;
   	EPG *ep, save;
@@ -437,10 +423,7 @@
    *  index:	page index
    */
   void
-__bt_setcur(t, pgno, index)
-	BTREE *t;
-	pgno_t pgno;
-	u_int index;
+__bt_setcur(BTREE *t, pgno_t pgno, u_int index)
   {
   	/* Lose any already deleted key. */
   	if (t->bt_cursor.key.data != NULL) {
Index: btree/bt_split.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_split.c,v
retrieving revision 1.6
diff -u -r1.6 bt_split.c
--- btree/bt_split.c	19 Sep 2005 09:20:37 -0000	1.6
+++ btree/bt_split.c	14 Oct 2005 01:44:17 -0000
@@ -74,13 +74,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__bt_split(t, sp, key, data, flags, ilen, argskip)
-	BTREE *t;
-	PAGE *sp;
-	const DBT *key, *data;
-	int flags;
-	size_t ilen;
-	u_int32_t argskip;
+__bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags, size_t ilen, u_int32_t argskip)
   {
   	BINTERNAL *bi;
   	BLEAF *bl, *tbl;
@@ -93,6 +87,9 @@
   	int parentsplit;
   	char *dest;
+	bi = NULL;
+	bl = NULL;
+	nksize = 0;
   	/*
   	 * Split the page into two pages, l and r.  The split routines return
   	 * a pointer to the page into which the key should be inserted and with
@@ -336,11 +333,7 @@
    *	Pointer to page in which to insert or NULL on error.
    */
   static PAGE *
-bt_page(t, h, lp, rp, skip, ilen)
-	BTREE *t;
-	PAGE *h, **lp, **rp;
-	indx_t *skip;
-	size_t ilen;
+bt_page(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)
   {
   	PAGE *l, *r, *tp;
   	pgno_t npg;
@@ -441,11 +434,7 @@
    *	Pointer to page in which to insert or NULL on error.
    */
   static PAGE *
-bt_root(t, h, lp, rp, skip, ilen)
-	BTREE *t;
-	PAGE *h, **lp, **rp;
-	indx_t *skip;
-	size_t ilen;
+bt_root(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)
   {
   	PAGE *l, *r, *tp;
   	pgno_t lnpg, rnpg;
@@ -488,9 +477,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   static int
-bt_rroot(t, h, l, r)
-	BTREE *t;
-	PAGE *h, *l, *r;
+bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
   {
   	char *dest;
@@ -528,9 +515,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   static int
-bt_broot(t, h, l, r)
-	BTREE *t;
-	PAGE *h, *l, *r;
+bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
   {
   	BINTERNAL *bi;
   	BLEAF *bl;
@@ -605,11 +590,7 @@
    *	Pointer to page in which to insert.
    */
   static PAGE *
-bt_psplit(t, h, l, r, pskip, ilen)
-	BTREE *t;
-	PAGE *h, *l, *r;
-	indx_t *pskip;
-	size_t ilen;
+bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen)
   {
   	BINTERNAL *bi;
   	BLEAF *bl;
@@ -621,6 +602,7 @@
   	u_int32_t nbytes;
   	int bigkeycnt, isbigkey;
+	src = NULL;
   	/*
   	 * Split the data to the left and right pages.  Leave the skip index
   	 * open.  Additionally, make some effort not to split on an overflow
@@ -668,8 +650,8 @@
   		 * where we decide to try and copy too much onto the left page.
   		 * Make sure that doesn't happen.
   		 */
-		if (skip <= off &&
-		    used + nbytes + sizeof(indx_t) >= full || nxt == top - 1) {
+		if ((skip <= off &&
+		    used + nbytes + sizeof(indx_t) >= full) || nxt == top - 1) {
   			--off;
   			break;
   		}
@@ -783,9 +765,7 @@
    *	RET_SUCCESS, RET_ERROR.
    */
   static int
-bt_preserve(t, pg)
-	BTREE *t;
-	pgno_t pg;
+bt_preserve(BTREE *t, pgno_t pg)
   {
   	PAGE *h;
@@ -811,8 +791,7 @@
    * all the way back to bt_split/bt_rroot and it's not very clean.
    */
   static recno_t
-rec_total(h)
-	PAGE *h;
+rec_total(PAGE *h)
   {
   	recno_t recs;
   	indx_t nxt, top;
Index: btree/bt_utils.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/btree/bt_utils.c,v
retrieving revision 1.4
diff -u -r1.4 bt_utils.c
--- btree/bt_utils.c	19 Sep 2005 09:20:37 -0000	1.4
+++ btree/bt_utils.c	13 Oct 2005 22:39:53 -0000
@@ -59,11 +59,7 @@
    *	RET_SUCCESS, RET_ERROR.
    */
   int
-__bt_ret(t, e, key, rkey, data, rdata, copy)
-	BTREE *t;
-	EPG *e;
-	DBT *key, *rkey, *data, *rdata;
-	int copy;
+__bt_ret(BTREE *t, EPG *e, DBT *key, DBT *rkey, DBT *data, DBT *rdata, int copy)
   {
   	BLEAF *bl;
   	void *p;
@@ -145,10 +141,7 @@
    *	> 0 if k1 is > record
    */
   int
-__bt_cmp(t, k1, e)
-	BTREE *t;
-	const DBT *k1;
-	EPG *e;
+__bt_cmp(BTREE *t, const DBT *k1, EPG *e)
   {
   	BINTERNAL *bi;
   	BLEAF *bl;
@@ -208,8 +201,7 @@
    *	> 0 if a is > b
    */
   int
-__bt_defcmp(a, b)
-	const DBT *a, *b;
+__bt_defcmp(const DBT *a, const DBT *b)
   {
   	size_t len;
   	u_char *p1, *p2;
@@ -238,8 +230,7 @@
    *	Number of bytes needed to distinguish b from a.
    */
   size_t
-__bt_defpfx(a, b)
-	const DBT *a, *b;
+__bt_defpfx(const DBT *a, const DBT *b)
   {
   	u_char *p1, *p2;
   	size_t cnt, len;
Index: hash/hash_bigkey.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/hash/hash_bigkey.c,v
retrieving revision 1.7
diff -u -r1.7 hash_bigkey.c
--- hash/hash_bigkey.c	19 Sep 2005 09:20:37 -0000	1.7
+++ hash/hash_bigkey.c	14 Oct 2005 10:11:51 -0000
@@ -80,10 +80,7 @@
    *-1 ==> ERROR
    */
   extern int
-__big_insert(hashp, bufp, key, val)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	const DBT *key, *val;
+__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
   {
   	u_int16_t *p;
   	int key_size, n, val_size;
@@ -116,7 +113,7 @@
   		if (!bufp)
   			return (-1);
   		n = p[0];
-		if (!key_size)
+		if (!key_size) {
   			if (FREESPACE(p)) {
   				move_bytes = MIN(FREESPACE(p), val_size);
   				off = OFFSET(p) - move_bytes;
@@ -129,6 +126,7 @@
   				OFFSET(p) = off;
   			} else
   				p[n - 2] = FULL_KEY;
+		}
   		p = (u_int16_t *)bufp->page;
   		cp = bufp->page;
   		bufp->flags |= BUF_MOD;
@@ -179,9 +177,7 @@
    *-1 => ERROR
    */
   extern int
-__big_delete(hashp, bufp)
-	HTAB *hashp;
-	BUFHEAD *bufp;
+__big_delete(HTAB *hashp, BUFHEAD *bufp)
   {
   	BUFHEAD *last_bfp, *rbufp;
   	u_int16_t *bp, pageno;
@@ -258,12 +254,8 @@
    * -3 error
    */
   extern int
-__find_bigpair(hashp, bufp, ndx, key, size)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	int ndx;
-	const char *key;
-	int size;
+__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx,
+		const char *key, int size)
   {
   	u_int16_t *bp;
   	char *p;
@@ -310,9 +302,7 @@
    * bucket)
    */
   extern u_int16_t
-__find_last_page(hashp, bpp)
-	HTAB *hashp;
-	BUFHEAD **bpp;
+__find_last_page(HTAB *hashp, BUFHEAD **bpp)
   {
   	BUFHEAD *bufp;
   	u_int16_t *bp, pageno;
@@ -351,12 +341,7 @@
    * index (index should always be 1).
    */
   extern int
-__big_return(hashp, bufp, ndx, val, set_current)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	int ndx;
-	DBT *val;
-	int set_current;
+__big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current)
   {
   	BUFHEAD *save_p;
   	u_int16_t *bp, len, off, save_addr;
@@ -442,10 +427,7 @@
    * allocate a buffer and copy the data as you recurse up.
    */
   static int
-collect_data(hashp, bufp, len, set)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	int len, set;
+collect_data(HTAB *hashp, BUFHEAD *bufp, int len, int set)
   {
   	u_int16_t *bp;
   	char *p;
@@ -498,11 +480,7 @@
    * Fill in the key and data for this big pair.
    */
   extern int
-__big_keydata(hashp, bufp, key, val, set)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	DBT *key, *val;
-	int set;
+__big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set)
   {
   	key->size = collect_key(hashp, bufp, 0, val, set);
   	if (key->size == -1)
@@ -516,12 +494,7 @@
    * collect the data, allocate a buffer and copy the key as you recurse up.
    */
   static int
-collect_key(hashp, bufp, len, val, set)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	int len;
-	DBT *val;
-	int set;
+collect_key(HTAB *hashp, BUFHEAD *bufp, int len, DBT *val, int set)
   {
   	BUFHEAD *xbp;
   	char *p;
@@ -556,20 +529,18 @@
   }
   /*
+ * Parameters:
+ *	op:		Pointer to where to put keys that go in old bucket
+ *	np:		Pointer to new bucket page
+ *	big_keyp:	Pointer to first page containing the big key/data
+ *	addr:		Address of big_keyp
+ *	obucket:	Old Bucket
    * Returns:
- *  0 => OK
- * -1 => error
+ *	0  => OK
+ *	-1 => error
    */
   extern int
-__big_split(hashp, op, np, big_keyp, addr, obucket, ret)
-	HTAB *hashp;
-	BUFHEAD *op;	/* Pointer to where to put keys that go in old bucket */
-	BUFHEAD *np;	/* Pointer to new bucket page */
-			/* Pointer to first page containing the big key/data */
-	BUFHEAD *big_keyp;
-	int addr;	/* Address of big_keyp */
-	u_int32_t   obucket;/* Old Bucket */
-	SPLIT_RETURN *ret;
+__big_split(HTAB *hashp, BUFHEAD *op, BUFHEAD *np, BUFHEAD *big_keyp, int addr, u_int32_t obucket, SPLIT_RETURN *ret)
   {
   	BUFHEAD *tmpp;
   	u_int16_t *tp;
Index: hash/hash_buf.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/hash/hash_buf.c,v
retrieving revision 1.5
diff -u -r1.5 hash_buf.c
--- hash/hash_buf.c	19 Sep 2005 09:20:37 -0000	1.5
+++ hash/hash_buf.c	14 Oct 2005 01:44:33 -0000
@@ -91,18 +91,14 @@
   /*
    * We are looking for a buffer with address "addr".  If prev_bp is NULL, then
    * address is a bucket index.  If prev_bp is not NULL, then it points to the
- * page previous to an overflow page that we are trying to find.
+ * page previous to an overflow page that we are trying to find.
    *
    * CAVEAT:  The buffer header accessed via prev_bp's ovfl field may no longer
    * be valid.  Therefore, you must always verify that its address matches the
    * address you are seeking.
    */
   extern BUFHEAD *
-__get_buf(hashp, addr, prev_bp, newpage)
-	HTAB *hashp;
-	u_int32_t addr;
-	BUFHEAD *prev_bp;
-	int newpage;	/* If prev_bp set, indicates a new overflow page. */
+__get_buf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp, int newpage)
   {
   	BUFHEAD *bp;
   	u_int32_t is_disk_mask;
@@ -111,6 +107,8 @@
   	is_disk = 0;
   	is_disk_mask = 0;
+	segment_ndx = 0;
+	segp = NULL;
   	if (prev_bp) {
   		bp = prev_bp->ovfl;
   		if (!bp || (bp->addr != addr))
@@ -153,10 +151,7 @@
    * If newbuf finds an error (returning NULL), it also sets errno.
    */
   static BUFHEAD *
-newbuf(hashp, addr, prev_bp)
-	HTAB *hashp;
-	u_int32_t addr;
-	BUFHEAD *prev_bp;
+newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp)
   {
   	BUFHEAD *bp;		/* The buffer we're going to use */
   	BUFHEAD *xbp;		/* Temp pointer */
@@ -283,9 +278,7 @@
   }
   extern void
-__buf_init(hashp, nbytes)
-	HTAB *hashp;
-	int nbytes;
+__buf_init(HTAB *hashp, int nbytes)
   {
   	BUFHEAD *bfp;
   	int npages;
@@ -308,9 +301,7 @@
   }
   extern int
-__buf_free(hashp, do_free, to_disk)
-	HTAB *hashp;
-	int do_free, to_disk;
+__buf_free(HTAB *hashp, int do_free, int to_disk)
   {
   	BUFHEAD *bp;
@@ -339,9 +330,7 @@
   }
   extern void
-__reclaim_buf(hashp, bp)
-	HTAB *hashp;
-	BUFHEAD *bp;
+__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
   {
   	bp->ovfl = 0;
   	bp->addr = 0;
Index: hash/hash_func.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/hash/hash_func.c,v
retrieving revision 1.6
diff -u -r1.6 hash_func.c
--- hash/hash_func.c	19 Sep 2005 09:20:37 -0000	1.6
+++ hash/hash_func.c	14 Oct 2005 02:14:17 -0000
@@ -40,9 +40,9 @@
   #include "page.h"
   #include "extern.h"
-static u_int32_t hash1 (const void *, size_t);
-static u_int32_t hash2 (const void *, size_t);
-static u_int32_t hash3 (const void *, size_t);
+static u_int32_t hash1 (const void *, size_t)  __unused;
+static u_int32_t hash2 (const void *, size_t)  __unused;
+static u_int32_t hash3 (const void *, size_t)  __unused;
   static u_int32_t hash4 (const void *, size_t);
   /* Global default hash function */
@@ -61,9 +61,7 @@
   #define PRIME2		1048583
   static u_int32_t
-hash1(keyarg, len)
-	const void *keyarg;
-	size_t len;
+hash1(const void *keyarg, size_t len)
   {
   	const u_char *key;
   	u_int32_t h;
@@ -81,9 +79,7 @@
   #define dcharhash(h, c)	((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c))
   static u_int32_t
-hash2(keyarg, len)
-	const void *keyarg;
-	size_t len;
+hash2(const void *keyarg, size_t len)
   {
   	const u_char *e, *key;
   	u_int32_t h;
@@ -110,9 +106,7 @@
    * OZ's original sdbm hash
    */
   static u_int32_t
-hash3(keyarg, len)
-	const void *keyarg;
-	size_t len;
+hash3(const void *keyarg, size_t len)
   {
   	const u_char *key;
   	size_t loop;
@@ -158,9 +152,7 @@
   /* Hash function from Chris Torek. */
   static u_int32_t
-hash4(keyarg, len)
-	const void *keyarg;
-	size_t len;
+hash4(const void *keyarg, size_t len)
   {
   	const u_char *key;
   	size_t loop;
Index: hash/hash_log2.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/hash/hash_log2.c,v
retrieving revision 1.4
diff -u -r1.4 hash_log2.c
--- hash/hash_log2.c	19 Sep 2005 09:20:37 -0000	1.4
+++ hash/hash_log2.c	14 Oct 2005 02:22:08 -0000
@@ -36,10 +36,12 @@
   #include <sys/types.h>
   #include <db.h>
+#include "hash.h"
+#include "page.h"
+#include "extern.h"
   u_int32_t
-__log2(num)
-	u_int32_t num;
+__log2(u_int32_t num)
   {
   	u_int32_t i, limit;
Index: hash/hash_page.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/hash/hash_page.c,v
retrieving revision 1.6
diff -u -r1.6 hash_page.c
--- hash/hash_page.c	19 Sep 2005 09:20:37 -0000	1.6
+++ hash/hash_page.c	14 Oct 2005 02:29:07 -0000
@@ -92,9 +92,7 @@
    * stuff on.
    */
   static void
-putpair(p, key, val)
-	char *p;
-	const DBT *key, *val;
+putpair(char *p, const DBT *key, const DBT *val)
   {
   	u_int16_t *bp, n, off;
@@ -124,10 +122,7 @@
    *	-1 error
    */
   extern int
-__delpair(hashp, bufp, ndx)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	int ndx;
+__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
   {
   	u_int16_t *bp, newoff;
   	int n;
@@ -177,9 +172,7 @@
    *	-1 ==> Error
    */
   extern int
-__split_page(hashp, obucket, nbucket)
-	HTAB *hashp;
-	u_int32_t obucket, nbucket;
+__split_page(HTAB *hashp, u_int32_t obucket, u_int32_t nbucket)
   {
   	BUFHEAD *new_bufp, *old_bufp;
   	u_int16_t *ino;
@@ -273,12 +266,8 @@
    *	-1 ==> failure
    */
   static int
-ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
-	HTAB *hashp;
-	u_int32_t obucket;	/* Same as __split_page. */
-	BUFHEAD *old_bufp, *new_bufp;
-	int copyto;	/* First byte on page which contains key/data values. */
-	int moved;	/* Number of pairs moved to new page. */
+ugly_split(HTAB *hashp, u_int32_t obucket, BUFHEAD *old_bufp, BUFHEAD *new_bufp,
+		int copyto, int moved)
   {
   	BUFHEAD *bufp;	/* Buffer header for ino */
   	u_int16_t *ino;	/* Page keys come off of */
@@ -394,10 +383,7 @@
    *	1 ==> failure
    */
   extern int
-__addel(hashp, bufp, key, val)
-	HTAB *hashp;
-	BUFHEAD *bufp;
-	const DBT *key, *val;
+__addel(HTAB *hashp, BUFHEAD *bufp,  const DBT *key,  const DBT *val)
   {
   	u_int16_t *bp, *sop;
   	int do_expand;
@@ -461,9 +447,7 @@
    *	NULL on error
    */
   extern BUFHEAD *
-__add_ovflpage(hashp, bufp)
-	HTAB *hashp;
-	BUFHEAD *bufp;
+__add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
   {
   	u_int16_t *sp;
   	u_int16_t ndx, ovfl_num;
@@ -514,11 +498,8 @@
    *	-1 indicates FAILURE
    */
   extern int
-__get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
-	HTAB *hashp;
-	char *p;
-	u_int32_t bucket;
-	int is_bucket, is_disk, is_bitmap;
+__get_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket,
+		int is_disk, int is_bitmap)
   {
   	int fd, page, size;
   	int rsize;
@@ -574,11 +555,7 @@
    *	-1 ==>failure
    */
   extern int
-__put_page(hashp, p, bucket, is_bucket, is_bitmap)
-	HTAB *hashp;
-	char *p;
-	u_int32_t bucket;
-	int is_bucket, is_bitmap;
+__put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
   {
   	int fd, page, size;
   	int wsize;
@@ -623,9 +600,7 @@
    * once they are read in.
    */
   extern int
-__ibitmap(hashp, pnum, nbits, ndx)
-	HTAB *hashp;
-	int pnum, nbits, ndx;
+__ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
   {
   	u_int32_t *ip;
   	int clearbytes, clearints;
@@ -646,8 +621,7 @@
   }
   static u_int32_t
-first_free(map)
-	u_int32_t map;
+first_free(u_int32_t map)
   {
   	u_int32_t i, mask;
@@ -661,8 +635,7 @@
   }
   static u_int16_t
-overflow_page(hashp)
-	HTAB *hashp;
+overflow_page(HTAB *hashp)
   {
   	u_int32_t *freep;
   	int max_free, offset, splitnum;
@@ -671,6 +644,7 @@
   #ifdef DEBUG2
   	int tmp1, tmp2;
   #endif
+	freep = NULL;
   	splitnum = hashp->OVFL_POINT;
   	max_free = hashp->SPARES[splitnum];
@@ -809,9 +783,7 @@
    * Mark this overflow page as free.
    */
   extern void
-__free_ovflpage(hashp, obufp)
-	HTAB *hashp;
-	BUFHEAD *obufp;
+__free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
   {
   	u_int16_t addr;
   	u_int32_t *freep;
@@ -855,8 +827,7 @@
    *	-1 failure
    */
   static int
-open_temp(hashp)
-	HTAB *hashp;
+open_temp(HTAB *hashp)
   {
   	sigset_t set, oset;
   	static char namestr[] = "_hashXXXXXX";
@@ -877,9 +848,7 @@
    * an overflow pair, so we need to shift things.
    */
   static void
-squeeze_key(sp, key, val)
-	u_int16_t *sp;
-	const DBT *key, *val;
+squeeze_key(u_int16_t *sp, const DBT *key, const DBT *val)
   {
   	char *p;
   	u_int16_t free_space, n, off, pageno;
@@ -904,9 +873,7 @@
   }
   static u_int32_t *
-fetch_bitmap(hashp, ndx)
-	HTAB *hashp;
-	int ndx;
+fetch_bitmap(HTAB *hashp, int ndx)
   {
   	if (ndx >= hashp->nmaps)
   		return (NULL);
@@ -922,8 +889,7 @@
   #ifdef DEBUG4
   int
-print_chain(addr)
-	int addr;
+print_chain(int addr)
   {
   	BUFHEAD *bufp;
   	short *bp, oaddr;
Index: hash/ndbm.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/hash/ndbm.c,v
retrieving revision 1.3
diff -u -r1.3 ndbm.c
--- hash/ndbm.c	19 Sep 2005 09:20:37 -0000	1.3
+++ hash/ndbm.c	14 Oct 2005 02:25:50 -0000
@@ -53,9 +53,7 @@
    *	 NULL on failure
    */
   extern DBM *
-dbm_open(file, flags, mode)
-	const char *file;
-	int flags, mode;
+dbm_open(const char *file, int flags, int mode)
   {
   	HASHINFO info;
   	char path[MAXPATHLEN];
@@ -77,8 +75,7 @@
   }
   extern void
-dbm_close(db)
-	DBM *db;
+dbm_close(DBM *db)
   {
   	(void)(db->close)(db);
   }
@@ -89,9 +86,7 @@
    *	NULL on failure
    */
   extern datum
-dbm_fetch(db, key)
-	DBM *db;
-	datum key;
+dbm_fetch(DBM *db, datum key)
   {
   	datum retdata;
   	int status;
@@ -115,8 +110,7 @@
    *	NULL on failure
    */
   extern datum
-dbm_firstkey(db)
-	DBM *db;
+dbm_firstkey(DBM *db)
   {
   	int status;
   	datum retkey;
@@ -136,8 +130,7 @@
    *	NULL on failure
    */
   extern datum
-dbm_nextkey(db)
-	DBM *db;
+dbm_nextkey(DBM *db)
   {
   	int status;
   	datum retkey;
@@ -157,9 +150,7 @@
    *	<0 failure
    */
   extern int
-dbm_delete(db, key)
-	DBM *db;
-	datum key;
+dbm_delete(DBM *db, datum key)
   {
   	int status;
   	DBT dbtkey;
@@ -180,10 +171,7 @@
    *	 1 if DBM_INSERT and entry exists
    */
   extern int
-dbm_store(db, key, data, flags)
-	DBM *db;
-	datum key, data;
-	int flags;
+dbm_store(DBM *db, datum key, datum data, int flags)
   {
   	DBT dbtkey, dbtdata;
@@ -196,8 +184,7 @@
   }
   extern int
-dbm_error(db)
-	DBM *db;
+dbm_error(DBM *db)
   {
   	HTAB *hp;
@@ -206,8 +193,7 @@
   }
   extern int
-dbm_clearerr(db)
-	DBM *db;
+dbm_clearerr(DBM *db)
   {
   	HTAB *hp;
@@ -217,8 +203,7 @@
   }
   extern int
-dbm_dirfno(db)
-	DBM *db;
+dbm_dirfno(DBM *db)
   {
   	return(((HTAB *)db->internal)->fp);
   }
Index: mpool/mpool.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/mpool/mpool.c,v
retrieving revision 1.5
diff -u -r1.5 mpool.c
--- mpool/mpool.c	19 Sep 2005 09:20:37 -0000	1.5
+++ mpool/mpool.c	14 Oct 2005 09:22:07 -0000
@@ -58,10 +58,7 @@
    *	Initialize a memory pool.
    */
   MPOOL *
-mpool_open(key, fd, pagesize, maxcache)
-	void *key;
-	int fd;
-	pgno_t pagesize, maxcache;
+mpool_open(void *key __unused, int fd, pgno_t pagesize, pgno_t maxcache)
   {
   	struct stat sb;
   	MPOOL *mp;
@@ -98,11 +95,8 @@
    *	Initialize input/output filters.
    */
   void
-mpool_filter(mp, pgin, pgout, pgcookie)
-	MPOOL *mp;
-	void (*pgin) (void *, pgno_t, void *);
-	void (*pgout) (void *, pgno_t, void *);
-	void *pgcookie;
+mpool_filter(MPOOL *mp, void (*pgin) (void *, pgno_t, void *), 
+		void (*pgout) (void *, pgno_t, void *), void *pgcookie)
   {
   	mp->pgin = pgin;
   	mp->pgout = pgout;
@@ -114,9 +108,7 @@
    *	Get a new page of memory.
    */
   void *
-mpool_new(mp, pgnoaddr)
-	MPOOL *mp;
-	pgno_t *pgnoaddr;
+mpool_new(MPOOL *mp, pgno_t *pgnoaddr)
   {
   	struct _hqh *head;
   	BKT *bp;
@@ -149,10 +141,7 @@
    *	Get a page.
    */
   void *
-mpool_get(mp, pgno, flags)
-	MPOOL *mp;
-	pgno_t pgno;
-	u_int flags;				/* XXX not used? */
+mpool_get(MPOOL *mp, pgno_t pgno, u_int flags __unused)
   {
   	struct _hqh *head;
   	BKT *bp;
@@ -234,10 +223,7 @@
    *	Return a page.
    */
   int
-mpool_put(mp, page, flags)
-	MPOOL *mp;
-	void *page;
-	u_int flags;
+mpool_put(MPOOL *mp __unused, void *page, u_int flags)
   {
   	BKT *bp;

@@ -262,8 +248,7 @@
    *	Close the buffer pool.
    */
   int
-mpool_close(mp)
-	MPOOL *mp;
+mpool_close(MPOOL *mp)
   {
   	BKT *bp;
@@ -284,8 +269,7 @@
    *	Sync the pool to disk.
    */
   int
-mpool_sync(mp)
-	MPOOL *mp;
+mpool_sync(MPOOL *mp)
   {
   	BKT *bp;
@@ -304,8 +288,7 @@
    *	Get a page from the cache (or create one).
    */
   static BKT *
-mpool_bkt(mp)
-	MPOOL *mp;
+mpool_bkt(MPOOL *mp)
   {
   	struct _hqh *head;
   	BKT *bp;
@@ -361,9 +344,7 @@
    *	Write a page to disk.
    */
   static int
-mpool_write(mp, bp)
-	MPOOL *mp;
-	BKT *bp;
+mpool_write(MPOOL *mp, BKT *bp)
   {
   	off_t off;
@@ -390,9 +371,7 @@
    *	Lookup a page in the cache.
    */
   static BKT *
-mpool_look(mp, pgno)
-	MPOOL *mp;
-	pgno_t pgno;
+mpool_look(MPOOL *mp, pgno_t pgno)
   {
   	struct _hqh *head;
   	BKT *bp;
@@ -417,8 +396,7 @@
    *	Print out cache statistics.
    */
   void
-mpool_stat(mp)
-	MPOOL *mp;
+mpool_stat(MPOOL *mp)
   {
   	BKT *bp;
   	int cnt;
Index: recno/rec_close.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_close.c,v
retrieving revision 1.4
diff -u -r1.4 rec_close.c
--- recno/rec_close.c	19 Sep 2005 09:20:37 -0000	1.4
+++ recno/rec_close.c	14 Oct 2005 09:25:17 -0000
@@ -55,8 +55,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__rec_close(dbp)
-	DB *dbp;
+__rec_close(DB *dbp)
   {
   	BTREE *t;
   	int status;
@@ -77,13 +76,14 @@
   	if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize))
   		status = RET_ERROR;
-	if (!F_ISSET(t, R_INMEM))
+	if (!F_ISSET(t, R_INMEM)) {
   		if (F_ISSET(t, R_CLOSEFP)) {
   			if (fclose(t->bt_rfp))
   				status = RET_ERROR;
   		} else
   			if (_close(t->bt_rfd))
   				status = RET_ERROR;
+	}
   	if (__bt_close(dbp) == RET_ERROR)
   		status = RET_ERROR;
@@ -101,9 +101,7 @@
    *	RET_SUCCESS, RET_ERROR.
    */
   int
-__rec_sync(dbp, flags)
-	const DB *dbp;
-	u_int flags;
+__rec_sync(const DB *dbp, u_int flags)
   {
   	struct iovec iov[2];
   	BTREE *t;
Index: recno/rec_delete.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_delete.c,v
retrieving revision 1.4
diff -u -r1.4 rec_delete.c
--- recno/rec_delete.c	19 Sep 2005 09:20:37 -0000	1.4
+++ recno/rec_delete.c	14 Oct 2005 09:30:07 -0000
@@ -56,10 +56,7 @@
    *	RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
    */
   int
-__rec_delete(dbp, key, flags)
-	const DB *dbp;
-	const DBT *key;
-	u_int flags;
+__rec_delete(const DB *dbp, const DBT *key, u_int flags)
   {
   	BTREE *t;
   	recno_t nrec;
@@ -112,9 +109,7 @@
    *	RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
    */
   static int
-rec_rdelete(t, nrec)
-	BTREE *t;
-	recno_t nrec;
+rec_rdelete(BTREE *t, recno_t nrec)
   {
   	EPG *e;
   	PAGE *h;
@@ -140,16 +135,13 @@
    *
    * Parameters:
    *	t:	tree
- *	index:	index on current page to delete
+ *	idx:	index on current page to delete
    *
    * Returns:
    *	RET_SUCCESS, RET_ERROR.
    */
   int
-__rec_dleaf(t, h, index)
-	BTREE *t;
-	PAGE *h;
-	u_int32_t index;
+__rec_dleaf(BTREE *t, PAGE *h, u_int32_t idx)
   {
   	RLEAF *rl;
   	indx_t *ip, cnt, offset;
@@ -167,7 +159,7 @@
   	 * down, overwriting the deleted record and its index.  If the record
   	 * uses overflow pages, make them available for reuse.
   	 */
-	to = rl = GETRLEAF(h, index);
+	to = rl = GETRLEAF(h, idx);
   	if (rl->flags & P_BIGDATA && __ovfl_delete(t, rl->bytes) == RET_ERROR)
   		return (RET_ERROR);
   	nbytes = NRLEAF(rl);
@@ -180,8 +172,8 @@
   	memmove(from + nbytes, from, (char *)to - from);
   	h->upper += nbytes;
-	offset = h->linp[index];
-	for (cnt = &h->linp[index] - (ip = &h->linp[0]); cnt--; ++ip)
+	offset = h->linp[idx];
+	for (cnt = &h->linp[idx] - (ip = &h->linp[0]); cnt--; ++ip)
   		if (ip[0] < offset)
   			ip[0] += nbytes;
   	for (cnt = &h->linp[NEXTINDEX(h)] - ip; --cnt; ++ip)
Index: recno/rec_get.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_get.c,v
retrieving revision 1.3
diff -u -r1.3 rec_get.c
--- recno/rec_get.c	19 Sep 2005 09:20:37 -0000	1.3
+++ recno/rec_get.c	14 Oct 2005 02:42:50 -0000
@@ -56,11 +56,7 @@
    *	RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
    */
   int
-__rec_get(dbp, key, data, flags)
-	const DB *dbp;
-	const DBT *key;
-	DBT *data;
-	u_int flags;
+__rec_get(const DB *dbp, const DBT *key, DBT *data, u_int flags)
   {
   	BTREE *t;
   	EPG *e;
@@ -115,9 +111,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__rec_fpipe(t, top)
-	BTREE *t;
-	recno_t top;
+__rec_fpipe(BTREE *t, recno_t top)
   {
   	DBT data;
   	recno_t nrec;
@@ -171,9 +165,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__rec_vpipe(t, top)
-	BTREE *t;
-	recno_t top;
+__rec_vpipe(BTREE *t, recno_t top)
   {
   	DBT data;
   	recno_t nrec;
@@ -228,9 +220,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__rec_fmap(t, top)
-	BTREE *t;
-	recno_t top;
+__rec_fmap(BTREE *t, recno_t top)
   {
   	DBT data;
   	recno_t nrec;
@@ -278,9 +268,7 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__rec_vmap(t, top)
-	BTREE *t;
-	recno_t top;
+__rec_vmap(BTREE *t, recno_t top)
   {
   	DBT data;
   	u_char *sp, *ep;
Index: recno/rec_open.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_open.c,v
retrieving revision 1.4
diff -u -r1.4 rec_open.c
--- recno/rec_open.c	19 Sep 2005 09:20:37 -0000	1.4
+++ recno/rec_open.c	14 Oct 2005 09:36:44 -0000
@@ -51,10 +51,7 @@
   #include "recno.h"
   DB *
-__rec_open(fname, flags, mode, openinfo, dflags)
-	const char *fname;
-	int flags, mode, dflags;
-	const RECNOINFO *openinfo;
+__rec_open(const char *fname, int flags, int mode, const RECNOINFO *openinfo, int dflags)
   {
   	BTREE *t;
   	BTREEINFO btopeninfo;
@@ -63,6 +60,8 @@
   	struct stat sb;
   	int rfd, sverrno;
+	rfd = 0;
+
   	/* Open the user's file -- if this fails, we're done. */
   	if (fname != NULL && (rfd = _open(fname, flags, mode)) < 0)
   		return (NULL);
@@ -217,8 +216,7 @@
   }
   int
-__rec_fd(dbp)
-	const DB *dbp;
+__rec_fd(const DB *dbp)
   {
   	BTREE *t;
Index: recno/rec_put.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_put.c,v
retrieving revision 1.3
diff -u -r1.3 rec_put.c
--- recno/rec_put.c	19 Sep 2005 09:20:37 -0000	1.3
+++ recno/rec_put.c	14 Oct 2005 09:41:48 -0000
@@ -55,11 +55,7 @@
    *	already in the tree and R_NOOVERWRITE specified.
    */
   int
-__rec_put(dbp, key, data, flags)
-	const DB *dbp;
-	DBT *key;
-	const DBT *data;
-	u_int flags;
+__rec_put(const DB *dbp, DBT *key, const DBT *data, u_int flags)
   {
   	BTREE *t;
   	DBT fdata, tdata;
@@ -188,16 +184,12 @@
    *	RET_ERROR, RET_SUCCESS
    */
   int
-__rec_iput(t, nrec, data, flags)
-	BTREE *t;
-	recno_t nrec;
-	const DBT *data;
-	u_int flags;
+__rec_iput(BTREE *t, recno_t nrec, const DBT *data, u_int flags)
   {
   	DBT tdata;
   	EPG *e;
   	PAGE *h;
-	indx_t index, nxtindex;
+	indx_t curindex, nxtindex;
   	pgno_t pg;
   	u_int32_t nbytes;
   	int dflags, status;
@@ -228,7 +220,7 @@
   		return (RET_ERROR);
   	h = e->page;
-	index = e->index;
+	curindex = e->index;
   	/*
   	 * Add the specified key/data pair to the tree.  The R_IAFTER and
@@ -238,13 +230,13 @@
   	 */
   	switch (flags) {
   	case R_IAFTER:
-		++index;
+		++curindex;
   		break;
   	case R_IBEFORE:
   		break;
   	default:
   		if (nrec < t->bt_nrecs &&
-		    __rec_dleaf(t, h, index) == RET_ERROR) {
+		    __rec_dleaf(t, h, curindex) == RET_ERROR) {
   			mpool_put(t->bt_mp, h, 0);
   			return (RET_ERROR);
   		}
@@ -258,18 +250,18 @@
   	 */
   	nbytes = NRLEAFDBT(data->size);
   	if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
-		status = __bt_split(t, h, NULL, data, dflags, nbytes, index);
+		status = __bt_split(t, h, NULL, data, dflags, nbytes, curindex);
   		if (status == RET_SUCCESS)
   			++t->bt_nrecs;
   		return (status);
   	}
-	if (index < (nxtindex = NEXTINDEX(h)))
-		memmove(h->linp + index + 1, h->linp + index,
-		    (nxtindex - index) * sizeof(indx_t));
+	if (curindex < (nxtindex = NEXTINDEX(h)))
+		memmove(h->linp + curindex + 1, h->linp + curindex,
+		    (nxtindex - curindex) * sizeof(indx_t));
   	h->lower += sizeof(indx_t);
-	h->linp[index] = h->upper -= nbytes;
+	h->linp[curindex] = h->upper -= nbytes;
   	dest = (char *)h + h->upper;
   	WR_RLEAF(dest, data, dflags);
Index: recno/rec_search.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_search.c,v
retrieving revision 1.4
diff -u -r1.4 rec_search.c
--- recno/rec_search.c	19 Sep 2005 09:20:37 -0000	1.4
+++ recno/rec_search.c	14 Oct 2005 09:44:19 -0000
@@ -56,10 +56,7 @@
    *	the bt_cur field of the tree.  A pointer to the field is returned.
    */
   EPG *
-__rec_search(t, recno, op)
-	BTREE *t;
-	recno_t recno;
-	enum SRCHOP op;
+__rec_search(BTREE *t, recno_t recno, enum SRCHOP op)
   {
   	indx_t index;
   	PAGE *h;
Index: recno/rec_seq.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_seq.c,v
retrieving revision 1.3
diff -u -r1.3 rec_seq.c
--- recno/rec_seq.c	19 Sep 2005 09:20:37 -0000	1.3
+++ recno/rec_seq.c	14 Oct 2005 09:44:44 -0000
@@ -53,10 +53,7 @@
    *	RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
    */
   int
-__rec_seq(dbp, key, data, flags)
-	const DB *dbp;
-	DBT *key, *data;
-	u_int flags;
+__rec_seq(const DB *dbp, DBT *key, DBT *data, u_int flags)
   {
   	BTREE *t;
   	EPG *e;
Index: recno/rec_utils.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libc/db/recno/rec_utils.c,v
retrieving revision 1.3
diff -u -r1.3 rec_utils.c
--- recno/rec_utils.c	19 Sep 2005 09:20:37 -0000	1.3
+++ recno/rec_utils.c	14 Oct 2005 09:46:52 -0000
@@ -54,11 +54,7 @@
    *	RET_SUCCESS, RET_ERROR.
    */
   int
-__rec_ret(t, e, nrec, key, data)
-	BTREE *t;
-	EPG *e;
-	recno_t nrec;
-	DBT *key, *data;
+__rec_ret(BTREE *t, EPG *e, recno_t nrec, DBT *key, DBT *data)
   {
   	RLEAF *rl;
   	void *p;





More information about the Submit mailing list