Date: Wed, 4 Mar 2009 00:58:04 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r189327 - in head/lib/libc/db: btree hash recno Message-ID: <200903040058.n240w4SI026223@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Wed Mar 4 00:58:04 2009 New Revision: 189327 URL: http://svn.freebsd.org/changeset/base/189327 Log: Style changes (including additional casts to shut up warnings). This commit does not affect MD5 of object file. Modified: head/lib/libc/db/btree/bt_delete.c head/lib/libc/db/btree/bt_open.c head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_seq.c head/lib/libc/db/btree/bt_split.c head/lib/libc/db/btree/bt_utils.c head/lib/libc/db/btree/btree.h head/lib/libc/db/hash/hash_bigkey.c head/lib/libc/db/hash/page.h head/lib/libc/db/recno/rec_close.c head/lib/libc/db/recno/rec_open.c head/lib/libc/db/recno/rec_put.c head/lib/libc/db/recno/rec_search.c head/lib/libc/db/recno/rec_seq.c head/lib/libc/db/recno/rec_utils.c Modified: head/lib/libc/db/btree/bt_delete.c ============================================================================== --- head/lib/libc/db/btree/bt_delete.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_delete.c Wed Mar 4 00:58:04 2009 (r189327) @@ -146,7 +146,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR 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 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, PA 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) { Modified: head/lib/libc/db/btree/bt_open.c ============================================================================== --- head/lib/libc/db/btree/bt_open.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_open.c Wed Mar 4 00:58:04 2009 (r189327) @@ -197,7 +197,7 @@ __bt_open(const char *fname, int flags, default: goto einval; } - + if ((t->bt_fd = _open(fname, flags, mode)) < 0) goto err; Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_put.c Wed Mar 4 00:58:04 2009 (r189327) @@ -99,7 +99,7 @@ __bt_put(const DB *dbp, DBT *key, const */ 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) Modified: head/lib/libc/db/btree/bt_seq.c ============================================================================== --- head/lib/libc/db/btree/bt_seq.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_seq.c Wed Mar 4 00:58:04 2009 (r189327) @@ -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 = *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 Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_split.c Wed Mar 4 00:58:04 2009 (r189327) @@ -149,7 +149,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT 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. */ Modified: head/lib/libc/db/btree/bt_utils.c ============================================================================== --- head/lib/libc/db/btree/bt_utils.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_utils.c Wed Mar 4 00:58:04 2009 (r189327) @@ -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. Modified: head/lib/libc/db/btree/btree.h ============================================================================== --- head/lib/libc/db/btree/btree.h Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/btree.h Wed Mar 4 00:58:04 2009 (r189327) @@ -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) Modified: head/lib/libc/db/hash/hash_bigkey.c ============================================================================== --- head/lib/libc/db/hash/hash_bigkey.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/hash/hash_bigkey.c Wed Mar 4 00:58:04 2009 (r189327) @@ -412,8 +412,8 @@ __big_return(HTAB *hashp, BUFHEAD *bufp, 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 __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; Modified: head/lib/libc/db/hash/page.h ============================================================================== --- head/lib/libc/db/hash/page.h Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/hash/page.h Wed Mar 4 00:58:04 2009 (r189327) @@ -48,7 +48,7 @@ * +--------+---------------------+ * | F R E E A R E A | * +--------------+---------------+ - * | <---- - - - | data | + * | <---- - - - | data | * +--------+-----+----+----------+ * | key | data | key | * +--------+----------+----------+ Modified: head/lib/libc/db/recno/rec_close.c ============================================================================== --- head/lib/libc/db/recno/rec_close.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_close.c Wed Mar 4 00:58:04 2009 (r189327) @@ -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); Modified: head/lib/libc/db/recno/rec_open.c ============================================================================== --- head/lib/libc/db/recno/rec_open.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_open.c Wed Mar 4 00:58:04 2009 (r189327) @@ -203,7 +203,7 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r" 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; Modified: head/lib/libc/db/recno/rec_put.c ============================================================================== --- head/lib/libc/db/recno/rec_put.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_put.c Wed Mar 4 00:58:04 2009 (r189327) @@ -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)); } Modified: head/lib/libc/db/recno/rec_search.c ============================================================================== --- head/lib/libc/db/recno/rec_search.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_search.c Wed Mar 4 00:58:04 2009 (r189327) @@ -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, en } 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); } Modified: head/lib/libc/db/recno/rec_seq.c ============================================================================== --- head/lib/libc/db/recno/rec_seq.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_seq.c Wed Mar 4 00:58:04 2009 (r189327) @@ -103,7 +103,7 @@ __rec_seq(const DB *dbp, DBT *key, DBT * 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) Modified: head/lib/libc/db/recno/rec_utils.c ============================================================================== --- head/lib/libc/db/recno/rec_utils.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_utils.c Wed Mar 4 00:58:04 2009 (r189327) @@ -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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903040058.n240w4SI026223>