dtinfo: Change to ANSI function definitions

This commit is contained in:
Peter Howkins
2018-06-28 04:15:16 +01:00
parent e239c31702
commit 4cf746f177
25 changed files with 203 additions and 660 deletions

View File

@@ -84,8 +84,7 @@ static int bt_meta __P((BTREE *));
* RET_ERROR, RET_SUCCESS
*/
int
__bt_close(dbp)
DB *dbp;
__bt_close(DB *dbp)
{
BTREE *t;
int fd;
@@ -134,9 +133,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;
@@ -208,8 +205,7 @@ ecrsr: if (ISSET(t, B_DELCRSR)) {
* RET_ERROR, RET_SUCCESS
*/
static int
bt_meta(t)
BTREE *t;
bt_meta(BTREE *t)
{
BTMETA m;
void *p;

View File

@@ -81,10 +81,7 @@ static void mswap __P((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;
int i, top;
@@ -149,10 +146,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;
int i, top;
@@ -223,8 +217,7 @@ __bt_pgout(t, pg, pp)
* p: page to convert
*/
static void
mswap(pg)
PAGE *pg;
mswap(PAGE *pg)
{
char *p;

View File

@@ -84,10 +84,7 @@ static int bt_bdelete __P((BTREE *, const DBT *));
* RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key 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;
int status;
@@ -141,9 +138,7 @@ einval: errno = EINVAL;
* 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, save;
PAGE *h;
@@ -299,10 +294,7 @@ done2: mpool_put(t->bt_mp, h, dirty1);
* RET_SUCCESS, RET_ERROR.
*/
int
__bt_dleaf(t, h, index)
BTREE *t;
PAGE *h;
int index;
__bt_dleaf(BTREE *t, PAGE *h, int index)
{
register BLEAF *bl;
register indx_t *ip, offset;

View File

@@ -83,11 +83,7 @@ static char sccsid[] = "@(#)bt_get.c 8.2 (Berkeley) 9/7/93";
* 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;
@@ -153,10 +149,7 @@ __bt_get(dbp, key, data, flags)
* The first entry in the tree greater than or equal to key.
*/
EPG *
__bt_first(t, key, exactp)
BTREE *t;
const DBT *key;
int *exactp;
__bt_first(BTREE *t, const DBT *key, int *exactp)
{
register PAGE *h;
register EPG *e;

View File

@@ -106,10 +106,7 @@ static int tmp __P((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)
{
BTMETA m;
BTREE *t;
@@ -373,8 +370,7 @@ err: if (t) {
* RET_ERROR, RET_SUCCESS
*/
static int
nroot(t)
BTREE *t;
nroot(BTREE *t)
{
PAGE *meta, *root;
pgno_t npg;
@@ -406,7 +402,7 @@ nroot(t)
}
static int
tmp()
tmp(void)
{
sigset_t set, oset;
int fd;
@@ -426,7 +422,7 @@ tmp()
}
static int
byteorder()
byteorder(void)
{
u_long x; /* XXX: 32-bit assumption. */
u_char *p;
@@ -444,8 +440,7 @@ byteorder()
}
int
__bt_fd(dbp)
const DB *dbp;
__bt_fd(const DB *dbp)
{
BTREE *t;

View File

@@ -100,12 +100,7 @@ static char sccsid[] = "@(#)bt_overflow.c 8.1 (Berkeley) 6/4/93";
* RET_ERROR, RET_SUCCESS
*/
int
__ovfl_get(t, p, ssz, buf, bufsz)
BTREE *t;
void *p;
size_t *ssz;
char **buf;
size_t *bufsz;
__ovfl_get(BTREE *t, void *p, size_t *ssz, char **buf, size_t *bufsz)
{
PAGE *h;
pgno_t pg;
@@ -157,10 +152,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;
@@ -210,9 +202,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

@@ -77,9 +77,7 @@ static char sccsid[] = "@(#)bt_page.c 8.1 (Berkeley) 6/4/93";
* RET_ERROR, RET_SUCCESS
*/
int
__bt_free(t, h)
BTREE *t;
PAGE *h;
__bt_free(BTREE *t, PAGE *h)
{
/* Insert the page at the start of the free list. */
h->prevpg = P_INVALID;
@@ -101,9 +99,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

@@ -87,11 +87,7 @@ static EPG *bt_fast __P((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;
@@ -285,10 +281,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)
{
static EPG e;
PAGE *h;

View File

@@ -85,10 +85,7 @@ static char sccsid[] = "@(#)bt_search.c 8.1 (Berkeley) 6/4/93";
* next search of any kind in any tree.
*/
EPG *
__bt_search(t, key, exactp)
BTREE *t;
const DBT *key;
int *exactp;
__bt_search(BTREE *t, const DBT *key, int *exactp)
{
register indx_t index;
register int base, cmp, lim;

View File

@@ -100,10 +100,7 @@ static int bt_seqset __P((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;
@@ -176,11 +173,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)
{
EPG *e;
PAGE *h;
@@ -306,10 +299,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, e, flags)
BTREE *t;
EPG *e;
int flags;
bt_seqadv(BTREE *t, EPG *e, int flags)
{
EPGNO *c, delc;
PAGE *h;
@@ -387,9 +377,7 @@ bt_seqadv(t, e, flags)
* RET_ERROR, RET_SUCCESS
*/
int
__bt_crsrdel(t, c)
BTREE *t;
EPGNO *c;
__bt_crsrdel(BTREE *t, EPGNO *c)
{
PAGE *h;
int status;

View File

@@ -103,13 +103,7 @@ u_long bt_rootsplit, bt_split, bt_sortsplit, bt_pfxsaved;
* RET_ERROR, RET_SUCCESS
*/
int
__bt_split(t, sp, key, data, flags, ilen, skip)
BTREE *t;
PAGE *sp;
const DBT *key, *data;
u_long flags;
size_t ilen;
u_int skip;
__bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, u_long flags, size_t ilen, u_int skip)
{
BINTERNAL *bi = NULL;
BLEAF *bl = NULL;
@@ -365,11 +359,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;
u_int *skip;
size_t ilen;
bt_page(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, u_int *skip, size_t ilen)
{
PAGE *l, *r, *tp;
pgno_t npg;
@@ -467,11 +457,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;
u_int *skip;
size_t ilen;
bt_root(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, u_int *skip, size_t ilen)
{
PAGE *l, *r, *tp;
pgno_t lnpg, rnpg;
@@ -514,9 +500,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;
@@ -554,9 +538,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;
@@ -631,11 +613,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;
u_int *pskip;
size_t ilen;
bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, u_int *pskip, size_t ilen)
{
BINTERNAL *bi;
BLEAF *bl;
@@ -811,9 +789,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;
@@ -839,8 +815,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

@@ -94,10 +94,7 @@ static char sccsid[] = "@(#)bt_stack.c 8.1 (Berkeley) 6/4/93";
* RET_ERROR, RET_SUCCESS
*/
int
__bt_push(t, pgno, index)
BTREE *t;
pgno_t pgno;
int index;
__bt_push(BTREE *t, pgno_t pgno, int index)
{
if (t->bt_sp == t->bt_maxstack) {
t->bt_maxstack += 50;

View File

@@ -83,10 +83,7 @@ static char sccsid[] = "@(#)bt_utils.c 8.2 (Berkeley) 9/7/93";
* RET_SUCCESS, RET_ERROR.
*/
int
__bt_ret(t, e, key, data)
BTREE *t;
EPG *e;
DBT *key, *data;
__bt_ret(BTREE *t, EPG *e, DBT *key, DBT *data)
{
register BLEAF *bl;
register void *p;
@@ -158,10 +155,7 @@ __bt_ret(t, e, key, data)
* > 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;
@@ -221,8 +215,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)
{
register u_char *p1, *p2;
register int diff, len;
@@ -245,8 +238,7 @@ __bt_defcmp(a, b)
* Number of bytes needed to distinguish b from a.
*/
int
__bt_defpfx(a, b)
const DBT *a, *b;
__bt_defpfx(const DBT *a, const DBT *b)
{
register u_char *p1, *p2;
register int len;

View File

@@ -69,11 +69,7 @@ static char sccsid[] = "@(#)db.c 8.2 (Berkeley) 9/7/93";
#include <db.h>
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)
@@ -102,7 +98,7 @@ dbopen(fname, flags, mode, type, openinfo)
}
static int
__dberr()
__dberr(void)
{
return (RET_ERROR);
}
@@ -114,8 +110,7 @@ __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;

View File

@@ -73,8 +73,7 @@ extern int errno;
static int _gettemp(char*, int*);
int mkstemp(path)
char *path;
int mkstemp(char *path)
{
int fd;
@@ -82,16 +81,13 @@ int mkstemp(path)
}
char *
mktemp(path)
char *path;
mktemp(char *path)
{
return(_gettemp(path, (int *)NULL) ? path : (char *)NULL);
}
static int
_gettemp(path, doopen)
char *path;
register int *doopen;
_gettemp(char *path, register int *doopen)
{
register char *start, *trv;
struct stat sbuf;

View File

@@ -91,10 +91,7 @@ static void __mpoolerr __P((const char *fmt, ...));
* MPOOL pointer, NULL on error.
*/
MPOOL *
mpool_open(key, fd, pagesize, maxcache)
DBT *key;
int fd;
pgno_t pagesize, maxcache;
mpool_open(DBT *key, int fd, pgno_t pagesize, pgno_t maxcache)
{
struct stat sb;
MPOOL *mp;
@@ -145,11 +142,10 @@ mpool_open(key, fd, pagesize, maxcache)
* pgcookie: Cookie for page in/out routines.
*/
void
mpool_filter(mp, pgin, pgout, pgcookie)
MPOOL *mp;
void (*pgin) __P((void *, pgno_t, void *));
void (*pgout) __P((void *, pgno_t, void *));
void *pgcookie;
mpool_filter(MPOOL *mp,
void (*pgin) __P((void *, pgno_t, void *)),
void (*pgout) __P((void *, pgno_t, void *)),
void *pgcookie)
{
mp->pgin = pgin;
mp->pgout = pgout;
@@ -166,9 +162,7 @@ mpool_filter(mp, pgin, pgout, pgcookie)
* RET_ERROR, RET_SUCCESS
*/
void *
mpool_new(mp, pgnoaddr)
MPOOL *mp;
pgno_t *pgnoaddr;
mpool_new(MPOOL *mp, pgno_t *pgnoaddr)
{
BKT *b;
BKTHDR *hp;
@@ -201,10 +195,7 @@ mpool_new(mp, pgnoaddr)
* RET_ERROR, RET_SUCCESS
*/
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? */)
{
BKT *b;
BKTHDR *hp;
@@ -277,10 +268,7 @@ mpool_get(mp, pgno, flags)
* RET_ERROR, RET_SUCCESS
*/
int
mpool_put(mp, page, flags)
MPOOL *mp;
void *page;
u_int flags;
mpool_put(MPOOL *mp, void *page, u_int flags)
{
BKT *baddr;
#ifdef DEBUG
@@ -316,8 +304,7 @@ mpool_put(mp, page, flags)
* RET_ERROR, RET_SUCCESS
*/
int
mpool_close(mp)
MPOOL *mp;
mpool_close(MPOOL *mp)
{
BKT *b, *next;
@@ -340,8 +327,7 @@ mpool_close(mp)
* RET_ERROR, RET_SUCCESS
*/
int
mpool_sync(mp)
MPOOL *mp;
mpool_sync(MPOOL *mp)
{
BKT *b;
@@ -361,8 +347,7 @@ mpool_sync(mp)
* NULL on failure and a pointer to the BKT on success
*/
static BKT *
mpool_bkt(mp)
MPOOL *mp;
mpool_bkt(MPOOL *mp)
{
BKT *b;
@@ -424,9 +409,7 @@ new: if ((b = malloc(sizeof(BKT) + mp->pagesize)) == NULL)
* RET_ERROR, RET_SUCCESS
*/
static int
mpool_write(mp, b)
MPOOL *mp;
BKT *b;
mpool_write(MPOOL *mp, BKT *b)
{
off_t off;
@@ -456,9 +439,7 @@ mpool_write(mp, b)
* NULL on failure and a pointer to the BKT on success
*/
static BKT *
mpool_look(mp, pgno)
MPOOL *mp;
pgno_t pgno;
mpool_look(MPOOL *mp, pgno_t pgno)
{
register BKT *b;
register BKTHDR *tb;
@@ -489,8 +470,7 @@ mpool_look(mp, pgno)
* mp: mpool cookie
*/
void
mpool_stat(mp)
MPOOL *mp;
mpool_stat(MPOOL *mp)
{
BKT *b;
int cnt;

View File

@@ -26,9 +26,7 @@
#include <stdlib.h>
void *
__fix_realloc(p, n)
void *p;
size_t n;
__fix_realloc(void *p, size_t n)
{
return (p == 0 ? malloc(n) : realloc(p, n));
}