Style changes (including additional casts to shut up warnings). This
commit does not affect MD5 of object file.
This commit is contained in:
parent
725e9bc78c
commit
3df1d93483
@ -146,7 +146,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c)
|
||||
pgno_t pgno;
|
||||
recno_t nextpg, prevpg;
|
||||
int exact, level;
|
||||
|
||||
|
||||
/*
|
||||
* Find the first occurrence of the key in the tree. Toss the
|
||||
* currently locked page so we don't hit an already-locked page.
|
||||
@ -262,7 +262,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c)
|
||||
if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL)
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ret: mpool_put(t->bt_mp, h, 0);
|
||||
return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL);
|
||||
@ -390,7 +390,7 @@ __bt_pdelete(BTREE *t, PAGE *h)
|
||||
/* Get the parent page. */
|
||||
if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
|
||||
return (RET_ERROR);
|
||||
|
||||
|
||||
idx = parent->index;
|
||||
bi = GETBINTERNAL(pg, idx);
|
||||
|
||||
@ -406,7 +406,7 @@ __bt_pdelete(BTREE *t, PAGE *h)
|
||||
* root page. If it's the rootpage, turn it back into an empty
|
||||
* leaf page.
|
||||
*/
|
||||
if (NEXTINDEX(pg) == 1)
|
||||
if (NEXTINDEX(pg) == 1) {
|
||||
if (pg->pgno == P_ROOT) {
|
||||
pg->lower = BTDATAOFF;
|
||||
pg->upper = t->bt_psize;
|
||||
@ -416,7 +416,7 @@ __bt_pdelete(BTREE *t, PAGE *h)
|
||||
return (RET_ERROR);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Pack remaining key items at the end of the page. */
|
||||
nksize = NBINTERNAL(bi->ksize);
|
||||
from = (char *)pg + pg->upper;
|
||||
@ -551,7 +551,7 @@ __bt_curdel(BTREE *t, const DBT *key, PAGE *h, u_int idx)
|
||||
key = &c->key;
|
||||
}
|
||||
/* Check previous key, if not at the beginning of the page. */
|
||||
if (idx > 0) {
|
||||
if (idx > 0) {
|
||||
e.page = h;
|
||||
e.index = idx - 1;
|
||||
if (__bt_cmp(t, key, &e) == 0) {
|
||||
|
@ -197,7 +197,7 @@ __bt_open(const char *fname, int flags, int mode, const BTREEINFO *openinfo, int
|
||||
default:
|
||||
goto einval;
|
||||
}
|
||||
|
||||
|
||||
if ((t->bt_fd = _open(fname, flags, mode)) < 0)
|
||||
goto err;
|
||||
|
||||
|
@ -99,7 +99,7 @@ __bt_put(const DB *dbp, DBT *key, const DBT *data, u_int flags)
|
||||
*/
|
||||
if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
|
||||
!F_ISSET(&t->bt_cursor,
|
||||
CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE))
|
||||
CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
@ -257,7 +257,7 @@ u_long bt_cache_hit, bt_cache_miss;
|
||||
* key: key to insert
|
||||
*
|
||||
* Returns:
|
||||
* EPG for new record or NULL if not found.
|
||||
* EPG for new record or NULL if not found.
|
||||
*/
|
||||
static EPG *
|
||||
bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp)
|
||||
|
@ -258,7 +258,7 @@ __bt_seqadv(BTREE *t, EPG *ep, int flags)
|
||||
return (RET_ERROR);
|
||||
|
||||
/*
|
||||
* Find the next/previous record in the tree and point the cursor at
|
||||
* Find the next/previous record in the tree and point the cursor at
|
||||
* it. The cursor may not be moved until a new key has been found.
|
||||
*/
|
||||
switch (flags) {
|
||||
@ -348,7 +348,7 @@ __bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp)
|
||||
*erval = *ep;
|
||||
return (RET_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Walk backwards, as long as the entry matches and there are
|
||||
* keys left in the tree. Save a copy of each match in case
|
||||
|
@ -149,7 +149,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags,
|
||||
if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
|
||||
goto err2;
|
||||
|
||||
/*
|
||||
/*
|
||||
* The new key goes ONE AFTER the index, because the split
|
||||
* was to the right.
|
||||
*/
|
||||
|
@ -196,7 +196,7 @@ __bt_cmp(BTREE *t, const DBT *k1, EPG *e)
|
||||
*
|
||||
* Parameters:
|
||||
* a: DBT #1
|
||||
* b: DBT #2
|
||||
* b: DBT #2
|
||||
*
|
||||
* Returns:
|
||||
* < 0 if a is < b
|
||||
@ -227,7 +227,7 @@ __bt_defcmp(const DBT *a, const DBT *b)
|
||||
*
|
||||
* Parameters:
|
||||
* a: DBT #1
|
||||
* b: DBT #2
|
||||
* b: DBT #2
|
||||
*
|
||||
* Returns:
|
||||
* Number of bytes needed to distinguish b from a.
|
||||
|
@ -309,8 +309,8 @@ typedef struct _btree {
|
||||
CURSOR bt_cursor; /* cursor */
|
||||
|
||||
#define BT_PUSH(t, p, i) { \
|
||||
t->bt_sp->pgno = p; \
|
||||
t->bt_sp->index = i; \
|
||||
t->bt_sp->pgno = p; \
|
||||
t->bt_sp->index = i; \
|
||||
++t->bt_sp; \
|
||||
}
|
||||
#define BT_POP(t) (t->bt_sp == t->bt_stack ? NULL : --t->bt_sp)
|
||||
|
@ -412,8 +412,8 @@ __big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current)
|
||||
return (0);
|
||||
}
|
||||
|
||||
val->size = collect_data(hashp, bufp, (int)len, set_current);
|
||||
if (val->size == -1)
|
||||
val->size = (size_t)collect_data(hashp, bufp, (int)len, set_current);
|
||||
if (val->size == (size_t)-1)
|
||||
return (-1);
|
||||
if (save_p->addr != save_addr) {
|
||||
/* We are pretty short on buffers. */
|
||||
@ -484,8 +484,8 @@ collect_data(HTAB *hashp, BUFHEAD *bufp, int len, 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)
|
||||
key->size = (size_t)collect_key(hashp, bufp, 0, val, set);
|
||||
if (key->size == (size_t)-1)
|
||||
return (-1);
|
||||
key->data = (u_char *)hashp->tmp_key;
|
||||
return (0);
|
||||
@ -544,12 +544,10 @@ __big_split(HTAB *hashp,
|
||||
u_int32_t obucket, /* Old Bucket */
|
||||
SPLIT_RETURN *ret)
|
||||
{
|
||||
BUFHEAD *tmpp;
|
||||
u_int16_t *tp;
|
||||
BUFHEAD *bp;
|
||||
BUFHEAD *bp, *tmpp;
|
||||
DBT key, val;
|
||||
u_int32_t change;
|
||||
u_int16_t free_space, n, off;
|
||||
u_int16_t free_space, n, off, *tp;
|
||||
|
||||
bp = big_keyp;
|
||||
|
||||
@ -561,7 +559,7 @@ __big_split(HTAB *hashp,
|
||||
if ( (ret->next_addr = __find_last_page(hashp, &big_keyp)) ) {
|
||||
if (!(ret->nextp =
|
||||
__get_buf(hashp, ret->next_addr, big_keyp, 0)))
|
||||
return (-1);;
|
||||
return (-1);
|
||||
} else
|
||||
ret->nextp = NULL;
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
* +--------+---------------------+
|
||||
* | F R E E A R E A |
|
||||
* +--------------+---------------+
|
||||
* | <---- - - - | data |
|
||||
* | <---- - - - | data |
|
||||
* +--------+-----+----+----------+
|
||||
* | key | data | key |
|
||||
* +--------+----------+----------+
|
||||
|
@ -82,9 +82,10 @@ __rec_close(DB *dbp)
|
||||
if (F_ISSET(t, R_CLOSEFP)) {
|
||||
if (fclose(t->bt_rfp))
|
||||
status = RET_ERROR;
|
||||
} else
|
||||
} else {
|
||||
if (_close(t->bt_rfd))
|
||||
status = RET_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (__bt_close(dbp) == RET_ERROR)
|
||||
@ -154,7 +155,7 @@ __rec_sync(const DB *dbp, u_int flags)
|
||||
status = (dbp->seq)(dbp, &key, &data, R_NEXT);
|
||||
}
|
||||
} else {
|
||||
iov[1].iov_base = (char *)&t->bt_bval;
|
||||
iov[1].iov_base = &t->bt_bval;
|
||||
iov[1].iov_len = 1;
|
||||
|
||||
status = (dbp->seq)(dbp, &key, &data, R_FIRST);
|
||||
|
@ -203,7 +203,7 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r")) == NULL)
|
||||
if (openinfo && openinfo->flags & R_SNAPSHOT &&
|
||||
!F_ISSET(t, R_EOF | R_INMEM) &&
|
||||
t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR)
|
||||
goto err;
|
||||
goto err;
|
||||
return (dbp);
|
||||
|
||||
einval: errno = EINVAL;
|
||||
|
@ -169,7 +169,7 @@ einval: errno = EINVAL;
|
||||
t->bt_cursor.rcursor = nrec;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
F_SET(t, R_MODIFIED);
|
||||
return (__rec_ret(t, NULL, nrec, key, NULL));
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
|
||||
* Parameters:
|
||||
* t: tree to search
|
||||
* recno: key to find
|
||||
* op: search operation
|
||||
* op: search operation
|
||||
*
|
||||
* Returns:
|
||||
* EPG for matching record, if any, or the EPG for the location of the
|
||||
@ -87,7 +87,7 @@ __rec_search(BTREE *t, recno_t recno, enum SRCHOP op)
|
||||
}
|
||||
|
||||
BT_PUSH(t, pg, idx - 1);
|
||||
|
||||
|
||||
pg = r->pgno;
|
||||
switch (op) {
|
||||
case SDELETE:
|
||||
@ -114,8 +114,8 @@ err: sverrno = errno;
|
||||
--GETRINTERNAL(h, parent->index)->nrecs;
|
||||
else
|
||||
++GETRINTERNAL(h, parent->index)->nrecs;
|
||||
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
|
||||
}
|
||||
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
|
||||
}
|
||||
errno = sverrno;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ __rec_seq(const DB *dbp, DBT *key, DBT *data, u_int flags)
|
||||
einval: errno = EINVAL;
|
||||
return (RET_ERROR);
|
||||
}
|
||||
|
||||
|
||||
if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) {
|
||||
if (!F_ISSET(t, R_EOF | R_INMEM) &&
|
||||
(status = t->bt_irec(t, nrec)) != RET_SUCCESS)
|
||||
|
@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
|
||||
* e: key/data pair to be returned
|
||||
* nrec: record number
|
||||
* key: user's key structure
|
||||
* data: user's data structure
|
||||
* data: user's data structure
|
||||
*
|
||||
* Returns:
|
||||
* RET_SUCCESS, RET_ERROR.
|
||||
|
Loading…
Reference in New Issue
Block a user