Diff reduction against OpenBSD: ANSI'fy prototypes.

(This is part of a larger changeset which is intended to reduce diff only,
thus some prototypes were left intact since they will be changed in the
future).

Verified with:	md5(1)
This commit is contained in:
Xin LI 2009-03-02 23:47:18 +00:00
parent f86bce5ed0
commit 0ac22237f1
28 changed files with 196 additions and 485 deletions

View File

@ -61,8 +61,7 @@ static int bt_meta(BTREE *);
* RET_ERROR, RET_SUCCESS
*/
int
__bt_close(dbp)
DB *dbp;
__bt_close(DB *dbp)
{
BTREE *t;
int fd;
@ -116,9 +115,7 @@ __bt_close(dbp)
* RET_SUCCESS, RET_ERROR.
*/
int
__bt_sync(dbp, flags)
const DB *dbp;
u_int flags;
__bt_sync(const DB *dbp, u_int flags)
{
BTREE *t;
int status;
@ -159,8 +156,7 @@ __bt_sync(dbp, flags)
* RET_ERROR, RET_SUCCESS
*/
static int
bt_meta(t)
BTREE *t;
bt_meta(BTREE *t)
{
BTMETA m;
void *p;

View File

@ -56,10 +56,7 @@ static void mswap(PAGE *);
* 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;
@ -124,10 +121,7 @@ __bt_pgin(t, pg, pp)
}
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;
@ -198,8 +192,7 @@ __bt_pgout(t, pg, pp)
* p: page to convert
*/
static void
mswap(pg)
PAGE *pg;
mswap(PAGE *pg)
{
char *p;

View File

@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$");
* dbp: pointer to the DB
*/
void
__bt_dump(dbp)
DB *dbp;
__bt_dump(DB *dbp)
{
BTREE *t;
PAGE *h;
@ -97,8 +96,7 @@ __bt_dump(dbp)
* h: pointer to the PAGE
*/
void
__bt_dmpage(h)
PAGE *h;
__bt_dmpage(PAGE *h)
{
BTMETA *m;
char *sep;
@ -131,9 +129,7 @@ __bt_dmpage(h)
* n: page number to dump.
*/
void
__bt_dnpage(dbp, pgno)
DB *dbp;
pgno_t pgno;
__bt_dnpage(DB *dbp, pgno_t pgno)
{
BTREE *t;
PAGE *h;
@ -152,8 +148,7 @@ __bt_dnpage(dbp, pgno)
* h: pointer to the PAGE
*/
void
__bt_dpage(h)
PAGE *h;
__bt_dpage(PAGE *h)
{
BINTERNAL *bi;
BLEAF *bl;
@ -249,8 +244,7 @@ __bt_dpage(h)
* dbp: pointer to the DB
*/
void
__bt_stat(dbp)
DB *dbp;
__bt_stat(DB *dbp)
{
extern u_long bt_cache_hit, bt_cache_miss, bt_pfxsaved, bt_rootsplit;
extern u_long bt_sortsplit, bt_split;

View File

@ -58,10 +58,7 @@ static int __bt_stkacq(BTREE *, PAGE **, CURSOR *);
* 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;
@ -139,10 +136,7 @@ __bt_delete(dbp, key, flags)
* 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;
@ -286,9 +280,7 @@ ret: mpool_put(t->bt_mp, h, 0);
* 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;
@ -373,9 +365,7 @@ loop: if ((e = __bt_search(t, key, &exact)) == NULL)
* 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;
@ -633,9 +623,7 @@ dup2: c->pg.pgno = e.page->pgno;
* h: page to be deleted
*/
static int
__bt_relink(t, h)
BTREE *t;
PAGE *h;
__bt_relink(BTREE *t, PAGE *h)
{
PAGE *pg;

View File

@ -58,11 +58,7 @@ __FBSDID("$FreeBSD$");
* 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;

View File

@ -87,10 +87,7 @@ static int tmp(void);
*
*/
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;
@ -350,8 +347,7 @@ err: if (t) {
* RET_ERROR, RET_SUCCESS
*/
static int
nroot(t)
BTREE *t;
nroot(BTREE *t)
{
PAGE *meta, *root;
pgno_t npg;
@ -384,7 +380,7 @@ nroot(t)
}
static int
tmp()
tmp(void)
{
sigset_t set, oset;
int fd;
@ -405,7 +401,7 @@ tmp()
}
static int
byteorder()
byteorder(void)
{
u_int32_t x;
u_char *p;
@ -423,8 +419,7 @@ byteorder()
}
int
__bt_fd(dbp)
const DB *dbp;
__bt_fd(const DB *dbp)
{
BTREE *t;

View File

@ -75,12 +75,7 @@ __FBSDID("$FreeBSD$");
* 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;
@ -134,10 +129,7 @@ __ovfl_get(t, p, ssz, buf, bufsz)
* 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;
@ -188,9 +180,7 @@ __ovfl_put(t, dbt, pg)
* RET_ERROR, RET_SUCCESS
*/
int
__ovfl_delete(t, p)
BTREE *t;
void *p;
__ovfl_delete(BTREE *t, void *p)
{
PAGE *h;
pgno_t pg;

View File

@ -55,9 +55,7 @@ __FBSDID("$FreeBSD$");
* 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;
@ -81,9 +79,7 @@ __bt_free(t, h)
* 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;

View File

@ -62,11 +62,7 @@ static EPG *bt_fast(BTREE *, const DBT *, const DBT *, int *);
* 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;
@ -264,10 +260,7 @@ u_long bt_cache_hit, bt_cache_miss;
* 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;

View File

@ -61,10 +61,7 @@ static int __bt_sprev(BTREE *, PAGE *, const DBT *, int *);
* 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;
@ -146,11 +143,7 @@ next: BT_PUSH(t, h->pgno, index);
* 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;
@ -185,11 +178,7 @@ __bt_snext(t, h, key, exactp)
* 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;

View File

@ -72,10 +72,7 @@ static int __bt_seqset(BTREE *, EPG *, DBT *, int);
* 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;
@ -147,11 +144,7 @@ __bt_seq(dbp, key, data, flags)
* 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;
@ -235,10 +228,7 @@ __bt_seqset(t, ep, key, flags)
* 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;
@ -337,11 +327,7 @@ usecurrent: F_CLR(c, CURS_AFTER | CURS_BEFORE);
* 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;

View File

@ -47,10 +47,10 @@ __FBSDID("$FreeBSD$");
#include "btree.h"
static int bt_broot(BTREE *, PAGE *, PAGE *, PAGE *);
static PAGE *bt_page (BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
static PAGE *bt_page(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
static int bt_preserve(BTREE *, pgno_t);
static PAGE *bt_psplit (BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t);
static PAGE *bt_root (BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
static PAGE *bt_psplit(BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t);
static PAGE *bt_root(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
static int bt_rroot(BTREE *, PAGE *, PAGE *, PAGE *);
static recno_t rec_total(PAGE *);
@ -74,13 +74,8 @@ u_long bt_rootsplit, bt_split, bt_sortsplit, bt_pfxsaved;
* 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;
@ -336,11 +331,7 @@ err2: mpool_put(t->bt_mp, l, 0);
* 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 +432,7 @@ bt_page(t, h, lp, rp, skip, ilen)
* 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 +475,7 @@ bt_root(t, h, lp, rp, skip, ilen)
* 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 +513,7 @@ bt_rroot(t, h, l, r)
* 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 +588,7 @@ bt_broot(t, h, l, r)
* 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;
@ -783,9 +762,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
* 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 +788,7 @@ bt_preserve(t, pg)
* 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;

View File

@ -62,11 +62,7 @@ __FBSDID("$FreeBSD$");
* 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;
@ -148,10 +144,7 @@ __bt_ret(t, e, key, rkey, data, rdata, copy)
* > 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;
@ -211,8 +204,7 @@ __bt_cmp(t, k1, e)
* > 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;
@ -241,8 +233,7 @@ __bt_defcmp(a, b)
* 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;

View File

@ -42,12 +42,10 @@ __FBSDID("$FreeBSD$");
#include <db.h>
static int __dberr(void);
DB *
dbopen(fname, flags, mode, type, openinfo)
const char *fname;
int flags, mode;
DBTYPE type;
const void *openinfo;
dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo)
{
#define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN)
@ -72,7 +70,7 @@ dbopen(fname, flags, mode, type, openinfo)
}
static int
__dberr()
__dberr(void)
{
return (RET_ERROR);
}
@ -84,14 +82,13 @@ __dberr()
* dbp: pointer to the DB structure.
*/
void
__dbpanic(dbp)
DB *dbp;
__dbpanic(DB *dbp)
{
/* The only thing that can succeed is a close. */
dbp->del = (int (*)())__dberr;
dbp->fd = (int (*)())__dberr;
dbp->get = (int (*)())__dberr;
dbp->put = (int (*)())__dberr;
dbp->seq = (int (*)())__dberr;
dbp->sync = (int (*)())__dberr;
dbp->del = (int (*)(const struct __db *, const DBT*, u_int))__dberr;
dbp->fd = (int (*)(const struct __db *))__dberr;
dbp->get = (int (*)(const struct __db *, const DBT*, DBT *, u_int))__dberr;
dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, u_int))__dberr;
dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, u_int))__dberr;
dbp->sync = (int (*)(const struct __db *, u_int))__dberr;
}

View File

@ -92,11 +92,11 @@ int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
/************************** INTERFACE ROUTINES ***************************/
/* OPEN/CLOSE */
extern DB *
__hash_open(file, flags, mode, info, dflags)
const char *file;
int flags, mode, dflags;
const HASHINFO *info; /* Special directives for create */
/* ARGSUSED */
DB *
__hash_open(const char *file, int flags, int mode,
const HASHINFO *info, /* Special directives for create */
int dflags)
{
HTAB *hashp;
struct stat statbuf;
@ -249,8 +249,7 @@ __hash_open(file, flags, mode, info, dflags)
}
static int
hash_close(dbp)
DB *dbp;
hash_close(DB *dbp)
{
HTAB *hashp;
int retval;
@ -265,8 +264,7 @@ hash_close(dbp)
}
static int
hash_fd(dbp)
const DB *dbp;
hash_fd(const DB *dbp)
{
HTAB *hashp;
@ -283,10 +281,7 @@ hash_fd(dbp)
/************************** LOCAL CREATION ROUTINES **********************/
static HTAB *
init_hash(hashp, file, info)
HTAB *hashp;
const char *file;
const HASHINFO *info;
init_hash(HTAB *hashp, const char *file, const HASHINFO *info)
{
struct stat statbuf;
int nelem;
@ -350,9 +345,7 @@ init_hash(hashp, file, info)
* Returns 0 on No Error
*/
static int
init_htab(hashp, nelem)
HTAB *hashp;
int nelem;
init_htab(HTAB *hashp, int nelem)
{
int nbuckets, nsegs;
int l2;
@ -396,8 +389,7 @@ init_htab(hashp, nelem)
* structure, freeing all allocated space.
*/
static int
hdestroy(hashp)
HTAB *hashp;
hdestroy(HTAB *hashp)
{
int i, save_errno;
@ -456,9 +448,7 @@ hdestroy(hashp)
* -1 ERROR
*/
static int
hash_sync(dbp, flags)
const DB *dbp;
u_int32_t flags;
hash_sync(const DB *dbp, u_int32_t flags)
{
HTAB *hashp;
@ -485,8 +475,7 @@ hash_sync(dbp, flags)
* -1 indicates that errno should be set
*/
static int
flush_meta(hashp)
HTAB *hashp;
flush_meta(HTAB *hashp)
{
HASHHDR *whdrp;
#if BYTE_ORDER == LITTLE_ENDIAN
@ -533,11 +522,7 @@ flush_meta(hashp)
* -1 to indicate an internal ERROR (i.e. out of memory, etc)
*/
static int
hash_get(dbp, key, data, flag)
const DB *dbp;
const DBT *key;
DBT *data;
u_int32_t flag;
hash_get(const DB *dbp, const DBT *key, DBT *data, u_int32_t flag)
{
HTAB *hashp;
@ -550,11 +535,7 @@ hash_get(dbp, key, data, flag)
}
static int
hash_put(dbp, key, data, flag)
const DB *dbp;
DBT *key;
const DBT *data;
u_int32_t flag;
hash_put(const DB *dbp, DBT *key, const DBT *data, u_int32_t flag)
{
HTAB *hashp;
@ -573,10 +554,8 @@ hash_put(dbp, key, data, flag)
}
static int
hash_delete(dbp, key, flag)
const DB *dbp;
const DBT *key;
u_int32_t flag; /* Ignored */
hash_delete(const DB *dbp, const DBT *key,
u_int32_t flag) /* Ignored */
{
HTAB *hashp;
@ -596,10 +575,7 @@ hash_delete(dbp, key, flag)
* Assume that hashp has been set in wrapper routine.
*/
static int
hash_access(hashp, action, key, val)
HTAB *hashp;
ACTION action;
DBT *key, *val;
hash_access(HTAB *hashp, ACTION action, DBT *key, DBT *val)
{
BUFHEAD *rbufp;
BUFHEAD *bufp, *save_bufp;
@ -725,10 +701,7 @@ hash_access(hashp, action, key, val)
}
static int
hash_seq(dbp, key, data, flag)
const DB *dbp;
DBT *key, *data;
u_int32_t flag;
hash_seq(const DB *dbp, DBT *key, DBT *data, u_int32_t flag)
{
u_int32_t bucket;
BUFHEAD *bufp;
@ -814,9 +787,8 @@ hash_seq(dbp, key, data, flag)
* 0 ==> OK
* -1 ==> Error
*/
extern int
__expand_table(hashp)
HTAB *hashp;
int
__expand_table(HTAB *hashp)
{
u_int32_t old_bucket, new_bucket;
int dirsize, new_segnum, spare_ndx;
@ -870,9 +842,7 @@ __expand_table(hashp)
* fails, then this routine can go away.
*/
static void *
hash_realloc(p_ptr, oldsize, newsize)
SEGMENT **p_ptr;
int oldsize, newsize;
hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize)
{
void *p;
@ -885,11 +855,8 @@ hash_realloc(p_ptr, oldsize, newsize)
return (p);
}
extern u_int32_t
__call_hash(hashp, k, len)
HTAB *hashp;
char *k;
int len;
u_int32_t
__call_hash(HTAB *hashp, char *k, int len)
{
int n, bucket;
@ -906,9 +873,7 @@ __call_hash(hashp, k, len)
* Returns 0 on success
*/
static int
alloc_segs(hashp, nsegs)
HTAB *hashp;
int nsegs;
alloc_segs(HTAB *hashp, int nsegs)
{
int i;
SEGMENT store;
@ -940,8 +905,7 @@ alloc_segs(hashp, nsegs)
* Hashp->hdr needs to be byteswapped.
*/
static void
swap_header_copy(srcp, destp)
HASHHDR *srcp, *destp;
swap_header_copy(HASHHDR *srcp, HASHHDR *destp)
{
int i;
@ -969,8 +933,7 @@ swap_header_copy(srcp, destp)
}
static void
swap_header(hashp)
HTAB *hashp;
swap_header(HTAB *hashp)
{
HASHHDR *hdrp;
int i;

View File

@ -82,11 +82,8 @@ static int collect_data(HTAB *, BUFHEAD *, int, int);
* 0 ==> OK
*-1 ==> ERROR
*/
extern int
__big_insert(hashp, bufp, key, val)
HTAB *hashp;
BUFHEAD *bufp;
const DBT *key, *val;
int
__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
{
u_int16_t *p;
int key_size, n, val_size;
@ -182,10 +179,8 @@ __big_insert(hashp, bufp, key, val)
* 0 => OK
*-1 => ERROR
*/
extern int
__big_delete(hashp, bufp)
HTAB *hashp;
BUFHEAD *bufp;
int
__big_delete(HTAB *hashp, BUFHEAD *bufp)
{
BUFHEAD *last_bfp, *rbufp;
u_int16_t *bp, pageno;
@ -261,13 +256,8 @@ __big_delete(hashp, bufp)
* -2 means key not found and this is big key/data
* -3 error
*/
extern int
__find_bigpair(hashp, bufp, ndx, key, size)
HTAB *hashp;
BUFHEAD *bufp;
int ndx;
char *key;
int size;
int
__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size)
{
u_int16_t *bp;
char *p;
@ -313,10 +303,8 @@ __find_bigpair(hashp, bufp, ndx, key, size)
* of the pair; 0 if there isn't any (i.e. big pair is the last key in the
* bucket)
*/
extern u_int16_t
__find_last_page(hashp, bpp)
HTAB *hashp;
BUFHEAD **bpp;
u_int16_t
__find_last_page(HTAB *hashp, BUFHEAD **bpp)
{
BUFHEAD *bufp;
u_int16_t *bp, pageno;
@ -354,13 +342,8 @@ __find_last_page(hashp, bpp)
* Return the data for the key/data pair that begins on this page at this
* 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;
int
__big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current)
{
BUFHEAD *save_p;
u_int16_t *bp, len, off, save_addr;
@ -446,10 +429,7 @@ __big_return(hashp, bufp, ndx, val, set_current)
* 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;
@ -501,12 +481,8 @@ collect_data(hashp, bufp, len, set)
/*
* 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;
int
__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)
@ -520,12 +496,7 @@ __big_keydata(hashp, bufp, key, val, set)
* 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;
@ -564,16 +535,14 @@ collect_key(hashp, bufp, len, val, set)
* 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;
int
__big_split(HTAB *hashp,
BUFHEAD *op, /* Pointer to where to put keys that go in old bucket */
BUFHEAD *np, /* Pointer to new bucket page */
BUFHEAD *big_keyp, /* Pointer to first page containing the big key/data */
int addr, /* Address of big_keyp */
u_int32_t obucket, /* Old Bucket */
SPLIT_RETURN *ret)
{
BUFHEAD *tmpp;
u_int16_t *tp;

View File

@ -98,12 +98,10 @@ static BUFHEAD *newbuf(HTAB *, u_int32_t, BUFHEAD *);
* 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. */
BUFHEAD *
__get_buf(HTAB *hashp, u_int32_t addr,
BUFHEAD *prev_bp, /* If prev_bp set, indicates a new overflow page. */
int newpage)
{
BUFHEAD *bp;
u_int32_t is_disk_mask;
@ -154,10 +152,7 @@ __get_buf(hashp, addr, prev_bp, newpage)
* 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,10 +278,8 @@ newbuf(hashp, addr, prev_bp)
return (bp);
}
extern void
__buf_init(hashp, nbytes)
HTAB *hashp;
int nbytes;
void
__buf_init(HTAB *hashp, int nbytes)
{
BUFHEAD *bfp;
int npages;
@ -308,10 +301,8 @@ __buf_init(hashp, nbytes)
*/
}
extern int
__buf_free(hashp, do_free, to_disk)
HTAB *hashp;
int do_free, to_disk;
int
__buf_free(HTAB *hashp, int do_free, int to_disk)
{
BUFHEAD *bp;
@ -339,10 +330,8 @@ __buf_free(hashp, do_free, to_disk)
return (0);
}
extern void
__reclaim_buf(hashp, bp)
HTAB *hashp;
BUFHEAD *bp;
void
__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
{
bp->ovfl = 0;
bp->addr = 0;

View File

@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$");
#include <db.h>
u_int32_t
__log2(num)
u_int32_t num;
__log2(u_int32_t num)
{
u_int32_t i, limit;

View File

@ -72,14 +72,13 @@ __FBSDID("$FreeBSD$");
#include "page.h"
#include "extern.h"
static u_int32_t *fetch_bitmap(HTAB *, int);
static u_int32_t first_free(u_int32_t);
static int open_temp(HTAB *);
static u_int16_t overflow_page(HTAB *);
static void putpair(char *, const DBT *, const DBT *);
static void squeeze_key(u_int16_t *, const DBT *, const DBT *);
static int ugly_split
(HTAB *, u_int32_t, BUFHEAD *, BUFHEAD *, int, int);
static u_int32_t *fetch_bitmap(HTAB *, int);
static u_int32_t first_free(u_int32_t);
static int open_temp(HTAB *);
static u_int16_t overflow_page(HTAB *);
static void putpair(char *, const DBT *, const DBT *);
static void squeeze_key(u_int16_t *, const DBT *, const DBT *);
static int ugly_split(HTAB *, u_int32_t, BUFHEAD *, BUFHEAD *, int, int);
#define PAGE_INIT(P) { \
((u_int16_t *)(P))[0] = 0; \
@ -93,9 +92,7 @@ static int ugly_split
* 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,11 +121,8 @@ putpair(p, key, val)
* 0 OK
* -1 error
*/
extern int
__delpair(hashp, bufp, ndx)
HTAB *hashp;
BUFHEAD *bufp;
int ndx;
int
__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
{
u_int16_t *bp, newoff;
int n;
@ -177,10 +171,8 @@ __delpair(hashp, bufp, ndx)
* 0 ==> OK
* -1 ==> Error
*/
extern int
__split_page(hashp, obucket, nbucket)
HTAB *hashp;
u_int32_t obucket, nbucket;
int
__split_page(HTAB *hashp, u_int32_t obucket, u_int32_t nbucket)
{
BUFHEAD *new_bufp, *old_bufp;
u_int16_t *ino;
@ -274,17 +266,17 @@ __split_page(hashp, obucket, nbucket)
* -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, /* Same as __split_page. */
BUFHEAD *old_bufp,
BUFHEAD *new_bufp,
int copyto, /* First byte on page which contains key/data values. */
int moved) /* Number of pairs moved to new page. */
{
BUFHEAD *bufp; /* Buffer header for ino */
u_int16_t *ino; /* Page keys come off of */
u_int16_t *np; /* New page */
u_int16_t *op; /* Page keys go on to if they aren't moving */
BUFHEAD *bufp; /* Buffer header for ino */
u_int16_t *ino; /* Page keys come off of */
u_int16_t *np; /* New page */
u_int16_t *op; /* Page keys go on to if they aren't moving */
BUFHEAD *last_bfp; /* Last buf header OVFL needing to be freed */
DBT key, val;
@ -394,11 +386,8 @@ ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
* 0 ==> OK
* 1 ==> failure
*/
extern int
__addel(hashp, bufp, key, val)
HTAB *hashp;
BUFHEAD *bufp;
const DBT *key, *val;
int
__addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
{
u_int16_t *bp, *sop;
int do_expand;
@ -461,10 +450,8 @@ __addel(hashp, bufp, key, val)
* pointer on success
* NULL on error
*/
extern BUFHEAD *
__add_ovflpage(hashp, bufp)
HTAB *hashp;
BUFHEAD *bufp;
BUFHEAD *
__add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
{
u_int16_t *sp;
u_int16_t ndx, ovfl_num;
@ -514,12 +501,9 @@ __add_ovflpage(hashp, bufp)
* 0 indicates SUCCESS
* -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;
int
__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,12 +558,8 @@ __get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
* 0 ==> OK
* -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;
int
__put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
{
int fd, page, size;
int wsize;
@ -623,10 +603,8 @@ __put_page(hashp, p, bucket, is_bucket, is_bitmap)
* Initialize a new bitmap page. Bitmap pages are left in memory
* once they are read in.
*/
extern int
__ibitmap(hashp, pnum, nbits, ndx)
HTAB *hashp;
int pnum, nbits, ndx;
int
__ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
{
u_int32_t *ip;
int clearbytes, clearints;
@ -647,8 +625,7 @@ __ibitmap(hashp, pnum, nbits, ndx)
}
static u_int32_t
first_free(map)
u_int32_t map;
first_free(u_int32_t map)
{
u_int32_t i, mask;
@ -662,8 +639,7 @@ first_free(map)
}
static u_int16_t
overflow_page(hashp)
HTAB *hashp;
overflow_page(HTAB *hashp)
{
u_int32_t *freep;
int max_free, offset, splitnum;
@ -809,10 +785,8 @@ overflow_page(hashp)
/*
* Mark this overflow page as free.
*/
extern void
__free_ovflpage(hashp, obufp)
HTAB *hashp;
BUFHEAD *obufp;
void
__free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
{
u_int16_t addr;
u_int32_t *freep;
@ -856,8 +830,7 @@ __free_ovflpage(hashp, obufp)
* -1 failure
*/
static int
open_temp(hashp)
HTAB *hashp;
open_temp(HTAB *hashp)
{
sigset_t set, oset;
static char namestr[] = "_hashXXXXXX";
@ -878,9 +851,7 @@ open_temp(hashp)
* 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;
@ -905,9 +876,7 @@ squeeze_key(sp, key, val)
}
static u_int32_t *
fetch_bitmap(hashp, ndx)
HTAB *hashp;
int ndx;
fetch_bitmap(HTAB *hashp, int ndx)
{
if (ndx >= hashp->nmaps)
return (NULL);
@ -923,8 +892,7 @@ fetch_bitmap(hashp, ndx)
#ifdef DEBUG4
int
print_chain(addr)
int addr;
print_chain(int addr)
{
BUFHEAD *bufp;
short *bp, oaddr;

View File

@ -58,11 +58,9 @@ static int mpool_write(MPOOL *, BKT *);
* mpool_open --
* Initialize a memory pool.
*/
/* ARGSUSED */
MPOOL *
mpool_open(key, fd, pagesize, maxcache)
void *key;
int fd;
pgno_t pagesize, maxcache;
mpool_open(void *key, int fd, pgno_t pagesize, pgno_t maxcache)
{
struct stat sb;
MPOOL *mp;
@ -99,11 +97,8 @@ mpool_open(key, fd, pagesize, maxcache)
* 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;
@ -149,11 +144,10 @@ mpool_new(mp, pgnoaddr)
* mpool_get
* Get a page.
*/
/* ARGSUSED */
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) /* XXX not used? */
{
struct _hqh *head;
BKT *bp;
@ -233,11 +227,9 @@ mpool_get(mp, pgno, flags)
* mpool_put
* Return a page.
*/
/* ARGSUSED */
int
mpool_put(mp, page, flags)
MPOOL *mp;
void *page;
u_int flags;
mpool_put(MPOOL *mp, void *page, u_int flags)
{
BKT *bp;
@ -262,8 +254,7 @@ mpool_put(mp, page, flags)
* Close the buffer pool.
*/
int
mpool_close(mp)
MPOOL *mp;
mpool_close(MPOOL *mp)
{
BKT *bp;
@ -284,8 +275,7 @@ mpool_close(mp)
* Sync the pool to disk.
*/
int
mpool_sync(mp)
MPOOL *mp;
mpool_sync(MPOOL *mp)
{
BKT *bp;
@ -304,8 +294,7 @@ mpool_sync(mp)
* 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 +350,7 @@ new: if ((bp = (BKT *)malloc(sizeof(BKT) + mp->pagesize)) == NULL)
* Write a page to disk.
*/
static int
mpool_write(mp, bp)
MPOOL *mp;
BKT *bp;
mpool_write(MPOOL *mp, BKT *bp)
{
off_t off;
@ -388,9 +375,7 @@ mpool_write(mp, bp)
* 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;
@ -415,8 +400,7 @@ mpool_look(mp, pgno)
* Print out cache statistics.
*/
void
mpool_stat(mp)
MPOOL *mp;
mpool_stat(MPOOL *mp)
{
BKT *bp;
int cnt;

View File

@ -57,8 +57,7 @@ __FBSDID("$FreeBSD$");
* RET_ERROR, RET_SUCCESS
*/
int
__rec_close(dbp)
DB *dbp;
__rec_close(DB *dbp)
{
BTREE *t;
int status;
@ -104,9 +103,7 @@ __rec_close(dbp)
* 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;

View File

@ -59,10 +59,7 @@ static int rec_rdelete(BTREE *, recno_t);
* 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;
@ -115,9 +112,7 @@ einval: errno = EINVAL;
* 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;

View File

@ -58,11 +58,7 @@ __FBSDID("$FreeBSD$");
* 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;
@ -117,9 +113,7 @@ __rec_get(dbp, key, data, flags)
* 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;
@ -173,9 +167,7 @@ __rec_fpipe(t, top)
* 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;
@ -230,9 +222,7 @@ __rec_vpipe(t, top)
* 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;
@ -280,9 +270,7 @@ __rec_fmap(t, top)
* 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;

View File

@ -53,10 +53,8 @@ __FBSDID("$FreeBSD$");
#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;
@ -219,8 +217,7 @@ err: sverrno = errno;
}
int
__rec_fd(dbp)
const DB *dbp;
__rec_fd(const DB *dbp)
{
BTREE *t;

View File

@ -57,11 +57,7 @@ __FBSDID("$FreeBSD$");
* 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;
@ -190,11 +186,7 @@ einval: errno = EINVAL;
* 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;

View File

@ -59,10 +59,7 @@ __FBSDID("$FreeBSD$");
* 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;

View File

@ -57,10 +57,7 @@ __FBSDID("$FreeBSD$");
* 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;

View File

@ -57,11 +57,7 @@ __FBSDID("$FreeBSD$");
* 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;