From bb57abf8209a1f33febc8bce060f974a5b777c83 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Mon, 3 Jul 2000 03:43:42 +0000 Subject: [PATCH] * recno/rec_seq.c: Include unused sccsid when LIBC_SCCS defined * recno/rec_close.c (__rec_close): Explicit braces to avoid ambiguous `else' * btree/bt_split.c (bt_psplit): Parenthesis about && and || conditional. * btree/bt_put.c (__bt_put): Extra {} to make nested if/else unambiguous. * btree/bt_open.c (__bt_open): Add parenthesis to ensure precedence ordering. * hash/dbm.c (kdb2_dbm_firstkey): Conditionalize defintion of variables based on use. * hash/hash_func.c: Ifdef out unused static hash functions. * hash/hash.c (init_htab): Remove unused variable. gcc -Wall warnings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12515 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/db2/ChangeLog | 23 +++++++++++++++++++++++ src/util/db2/btree/bt_open.c | 8 ++++---- src/util/db2/btree/bt_put.c | 3 ++- src/util/db2/btree/bt_split.c | 2 +- src/util/db2/hash/dbm.c | 8 ++++++-- src/util/db2/hash/hash.c | 1 - src/util/db2/hash/hash_func.c | 5 +++++ src/util/db2/recno/rec_close.c | 3 ++- src/util/db2/recno/rec_seq.c | 2 +- 9 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/util/db2/ChangeLog b/src/util/db2/ChangeLog index 85f711094..db3f0c0e4 100644 --- a/src/util/db2/ChangeLog +++ b/src/util/db2/ChangeLog @@ -1,3 +1,26 @@ +2000-07-02 Ezra Peisach + + * recno/rec_seq.c: Include unused sccsid when LIBC_SCCS defined. + + * recno/rec_close.c (__rec_close): Explicit braces to avoid + ambiguous `else' + + * btree/bt_split.c (bt_psplit): Parenthesis about && and || + conditional. + + * btree/bt_put.c (__bt_put): Extra {} to make nested if/else + unambiguous. + + * btree/bt_open.c (__bt_open): Add parenthesis to ensure + precedence ordering. + + * hash/dbm.c (kdb2_dbm_firstkey): Conditionalize defintion of + variables based on use. + + * hash/hash_func.c: Ifdef out unused static hash functions. + + * hash/hash.c (init_htab): Remove unused variable. + 2000-07-01 Tom Yu * clib/strerror.c: #include config.h. diff --git a/src/util/db2/btree/bt_open.c b/src/util/db2/btree/bt_open.c index 50fbe3f00..3e4c67a4b 100644 --- a/src/util/db2/btree/bt_open.c +++ b/src/util/db2/btree/bt_open.c @@ -125,7 +125,7 @@ __bt_open(fname, flags, mode, openinfo, dflags) */ if (b.psize && (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 || - b.psize & sizeof(indx_t) - 1)) + b.psize & (sizeof(indx_t) - 1))) goto einval; /* Minimum number of keys per page; absolute minimum is 2. */ @@ -245,7 +245,7 @@ __bt_open(fname, flags, mode, openinfo, dflags) if (m.magic != BTREEMAGIC || m.version != BTREEVERSION) goto eftype; if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 || - m.psize & sizeof(indx_t) - 1) + m.psize & (sizeof(indx_t) - 1)) goto eftype; if (m.flags & ~SAVEMETA) goto eftype; @@ -278,8 +278,8 @@ __bt_open(fname, flags, mode, openinfo, dflags) t->bt_psize = b.psize; /* Set the cache size; must be a multiple of the page size. */ - if (b.cachesize && b.cachesize & b.psize - 1) - b.cachesize += (~b.cachesize & b.psize - 1) + 1; + if (b.cachesize && b.cachesize & (b.psize - 1)) + b.cachesize += (~b.cachesize & (b.psize - 1)) + 1; if (b.cachesize < b.psize * MINCACHE) b.cachesize = b.psize * MINCACHE; diff --git a/src/util/db2/btree/bt_put.c b/src/util/db2/btree/bt_put.c index 2feebce0c..139a7fc36 100644 --- a/src/util/db2/btree/bt_put.c +++ b/src/util/db2/btree/bt_put.c @@ -223,7 +223,7 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) { t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index) ++t->bt_cursor.pg.index; - if (t->bt_order == NOT) + if (t->bt_order == NOT) { if (h->nextpg == P_INVALID) { if (index == NEXTINDEX(h) - 1) { t->bt_order = FORWARD; @@ -237,6 +237,7 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) { t->bt_last.pgno = h->pgno; } } + } mpool_put(t->bt_mp, h, MPOOL_DIRTY); diff --git a/src/util/db2/btree/bt_split.c b/src/util/db2/btree/bt_split.c index 0fc95baf3..c6319b55f 100644 --- a/src/util/db2/btree/bt_split.c +++ b/src/util/db2/btree/bt_split.c @@ -673,7 +673,7 @@ bt_psplit(t, h, l, r, pskip, ilen) * where we decide to try and copy too much onto the left page. * Make sure that doesn't happen. */ - if (skip <= off && used + nbytes >= full || nxt == top - 1) { + if ((skip <= off && used + nbytes >= full) || nxt == top - 1) { --off; break; } diff --git a/src/util/db2/hash/dbm.c b/src/util/db2/hash/dbm.c index aa9676632..ac162982f 100644 --- a/src/util/db2/hash/dbm.c +++ b/src/util/db2/hash/dbm.c @@ -226,7 +226,7 @@ kdb2_dbm_firstkey(db) DBM *db; { int status; - datum retdata, retkey; + datum retkey; #ifdef NEED_COPY DBT k, r; @@ -235,6 +235,8 @@ kdb2_dbm_firstkey(db) retkey.dptr = k.data; retkey.dsize = k.size; #else + datum retdata; + status = (db->seq)(db, (DBT *)&retkey, (DBT *)&retdata, R_FIRST); #endif if (status) @@ -252,7 +254,7 @@ kdb2_dbm_nextkey(db) DBM *db; { int status; - datum retdata, retkey; + datum retkey; #ifdef NEED_COPY DBT k, r; @@ -261,6 +263,8 @@ kdb2_dbm_nextkey(db) retkey.dptr = k.data; retkey.dsize = k.size; #else + datum retdata; + status = (db->seq)(db, (DBT *)&retkey, (DBT *)&retdata, R_NEXT); #endif if (status) diff --git a/src/util/db2/hash/hash.c b/src/util/db2/hash/hash.c index 0f51d6c9f..365bb415c 100644 --- a/src/util/db2/hash/hash.c +++ b/src/util/db2/hash/hash.c @@ -365,7 +365,6 @@ init_htab(hashp, nelem) int32_t nelem; { int32_t l2, nbuckets; - db_pgno_t i; /* * Divide number of elements by the fill factor and determine a diff --git a/src/util/db2/hash/hash_func.c b/src/util/db2/hash/hash_func.c index 0fddb4456..baded7fdb 100644 --- a/src/util/db2/hash/hash_func.c +++ b/src/util/db2/hash/hash_func.c @@ -45,9 +45,11 @@ static char sccsid[] = "@(#)hash_func.c 8.4 (Berkeley) 11/7/95"; #include "page.h" #include "extern.h" +#if 0 static u_int32_t hash1 __P((const void *, size_t)); static u_int32_t hash2 __P((const void *, size_t)); static u_int32_t hash3 __P((const void *, size_t)); +#endif static u_int32_t hash4 __P((const void *, size_t)); /* Default hash function. */ @@ -62,6 +64,7 @@ u_int32_t (*__default_hash) __P((const void *, size_t)) = hash4; #define PRIME1 37 #define PRIME2 1048583 +#if 0 static u_int32_t hash1(key, len) const void *key; @@ -151,6 +154,8 @@ hash3(key, len) } return (n); } +#endif + /* Chris Torek's hash function. */ static u_int32_t diff --git a/src/util/db2/recno/rec_close.c b/src/util/db2/recno/rec_close.c index 2e923070b..ed3da6ea4 100644 --- a/src/util/db2/recno/rec_close.c +++ b/src/util/db2/recno/rec_close.c @@ -83,13 +83,14 @@ __rec_close(dbp) status = RET_ERROR; #endif - if (!F_ISSET(t, R_INMEM)) + if (!F_ISSET(t, R_INMEM)) { if (F_ISSET(t, R_CLOSEFP)) { if (fclose(t->bt_rfp)) status = RET_ERROR; } else if (close(t->bt_rfd)) status = RET_ERROR; + } if (__bt_close(dbp) == RET_ERROR) status = RET_ERROR; diff --git a/src/util/db2/recno/rec_seq.c b/src/util/db2/recno/rec_seq.c index e150333cb..1edaa998e 100644 --- a/src/util/db2/recno/rec_seq.c +++ b/src/util/db2/recno/rec_seq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#ifndef lint +#if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)rec_seq.c 8.3 (Berkeley) 7/14/94"; #endif /* not lint */ -- 2.26.2