summaryrefslogtreecommitdiffstats
path: root/lib/libc/db
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2009-03-04 00:58:04 +0000
committerdelphij <delphij@FreeBSD.org>2009-03-04 00:58:04 +0000
commit60ee3b72bf398f3dd2403737817dc830d80a904f (patch)
tree756648717503997efc92e73d40047dd45f88ad87 /lib/libc/db
parent3b8bffce0869741be8850515a08b3660f97e8315 (diff)
downloadFreeBSD-src-60ee3b72bf398f3dd2403737817dc830d80a904f.zip
FreeBSD-src-60ee3b72bf398f3dd2403737817dc830d80a904f.tar.gz
Style changes (including additional casts to shut up warnings). This
commit does not affect MD5 of object file.
Diffstat (limited to 'lib/libc/db')
-rw-r--r--lib/libc/db/btree/bt_delete.c12
-rw-r--r--lib/libc/db/btree/bt_open.c2
-rw-r--r--lib/libc/db/btree/bt_put.c4
-rw-r--r--lib/libc/db/btree/bt_seq.c4
-rw-r--r--lib/libc/db/btree/bt_split.c2
-rw-r--r--lib/libc/db/btree/bt_utils.c4
-rw-r--r--lib/libc/db/btree/btree.h4
-rw-r--r--lib/libc/db/hash/hash_bigkey.c16
-rw-r--r--lib/libc/db/hash/page.h2
-rw-r--r--lib/libc/db/recno/rec_close.c5
-rw-r--r--lib/libc/db/recno/rec_open.c2
-rw-r--r--lib/libc/db/recno/rec_put.c2
-rw-r--r--lib/libc/db/recno/rec_search.c8
-rw-r--r--lib/libc/db/recno/rec_seq.c2
-rw-r--r--lib/libc/db/recno/rec_utils.c2
15 files changed, 35 insertions, 36 deletions
diff --git a/lib/libc/db/btree/bt_delete.c b/lib/libc/db/btree/bt_delete.c
index fa2b1f4..aa191b6 100644
--- a/lib/libc/db/btree/bt_delete.c
+++ b/lib/libc/db/btree/bt_delete.c
@@ -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) {
diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c
index 749b7cd..fb7333e 100644
--- a/lib/libc/db/btree/bt_open.c
+++ b/lib/libc/db/btree/bt_open.c
@@ -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;
diff --git a/lib/libc/db/btree/bt_put.c b/lib/libc/db/btree/bt_put.c
index 0867fc4..31931dc 100644
--- a/lib/libc/db/btree/bt_put.c
+++ b/lib/libc/db/btree/bt_put.c
@@ -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)
diff --git a/lib/libc/db/btree/bt_seq.c b/lib/libc/db/btree/bt_seq.c
index a067942..1928951 100644
--- a/lib/libc/db/btree/bt_seq.c
+++ b/lib/libc/db/btree/bt_seq.c
@@ -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
diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c
index 20d37a0..8fbc2f0 100644
--- a/lib/libc/db/btree/bt_split.c
+++ b/lib/libc/db/btree/bt_split.c
@@ -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.
*/
diff --git a/lib/libc/db/btree/bt_utils.c b/lib/libc/db/btree/bt_utils.c
index 9321106..77ab916 100644
--- a/lib/libc/db/btree/bt_utils.c
+++ b/lib/libc/db/btree/bt_utils.c
@@ -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.
diff --git a/lib/libc/db/btree/btree.h b/lib/libc/db/btree/btree.h
index 7d16462..a1766dc 100644
--- a/lib/libc/db/btree/btree.h
+++ b/lib/libc/db/btree/btree.h
@@ -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)
diff --git a/lib/libc/db/hash/hash_bigkey.c b/lib/libc/db/hash/hash_bigkey.c
index d6464ae..c2a1e03 100644
--- a/lib/libc/db/hash/hash_bigkey.c
+++ b/lib/libc/db/hash/hash_bigkey.c
@@ -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;
diff --git a/lib/libc/db/hash/page.h b/lib/libc/db/hash/page.h
index 8155035..6959fe8 100644
--- a/lib/libc/db/hash/page.h
+++ b/lib/libc/db/hash/page.h
@@ -48,7 +48,7 @@
* +--------+---------------------+
* | F R E E A R E A |
* +--------------+---------------+
- * | <---- - - - | data |
+ * | <---- - - - | data |
* +--------+-----+----+----------+
* | key | data | key |
* +--------+----------+----------+
diff --git a/lib/libc/db/recno/rec_close.c b/lib/libc/db/recno/rec_close.c
index c4f14be..8520c85 100644
--- a/lib/libc/db/recno/rec_close.c
+++ b/lib/libc/db/recno/rec_close.c
@@ -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);
diff --git a/lib/libc/db/recno/rec_open.c b/lib/libc/db/recno/rec_open.c
index 78a3056..dd286c0 100644
--- a/lib/libc/db/recno/rec_open.c
+++ b/lib/libc/db/recno/rec_open.c
@@ -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;
diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c
index ae60065..a6defc9 100644
--- a/lib/libc/db/recno/rec_put.c
+++ b/lib/libc/db/recno/rec_put.c
@@ -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));
}
diff --git a/lib/libc/db/recno/rec_search.c b/lib/libc/db/recno/rec_search.c
index 68e7f2d..8115e0f 100644
--- a/lib/libc/db/recno/rec_search.c
+++ b/lib/libc/db/recno/rec_search.c
@@ -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);
}
diff --git a/lib/libc/db/recno/rec_seq.c b/lib/libc/db/recno/rec_seq.c
index 9290d0e..42d98d7 100644
--- a/lib/libc/db/recno/rec_seq.c
+++ b/lib/libc/db/recno/rec_seq.c
@@ -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)
diff --git a/lib/libc/db/recno/rec_utils.c b/lib/libc/db/recno/rec_utils.c
index 4a8edbc..0294d95 100644
--- a/lib/libc/db/recno/rec_utils.c
+++ b/lib/libc/db/recno/rec_utils.c
@@ -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.
OpenPOWER on IntegriCloud