krb5 commit: Squash a Berkeley DB warning

ghudson at mit.edu ghudson at mit.edu
Mon Apr 10 16:23:18 EDT 2023


https://github.com/krb5/krb5/commit/45cde9809cad49a8ed8eb949a543b54d6e589c77
commit 45cde9809cad49a8ed8eb949a543b54d6e589c77
Author: Greg Hudson <ghudson at mit.edu>
Date:   Tue Apr 4 14:23:19 2023 -0400

    Squash a Berkeley DB warning
    
    In __delpair(), the assignment to next_key is not used unless DEBUG is
    defined, and the debugging assert can never fail--next_realkey() will
    always return n + 1 as we just checked KEY_OFF(pagep, n + 1).  Remove
    the variable, the assert, and the otherwise unused next_realkey()
    function.  This change eliminates a warning issued by clang 14.

 src/plugins/kdb/db2/libdb2/hash/hash_page.c | 28 +---------------------------
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/src/plugins/kdb/db2/libdb2/hash/hash_page.c b/src/plugins/kdb/db2/libdb2/hash/hash_page.c
index 5624dfd7d..0da357108 100644
--- a/src/plugins/kdb/db2/libdb2/hash/hash_page.c
+++ b/src/plugins/kdb/db2/libdb2/hash/hash_page.c
@@ -72,7 +72,6 @@ static char sccsid[] = "@(#)hash_page.c	8.11 (Berkeley) 11/7/95";
 static int32_t	 add_bigptr __P((HTAB *, ITEM_INFO *, indx_t));
 static u_int32_t *fetch_bitmap __P((HTAB *, int32_t));
 static u_int32_t first_free __P((u_int32_t));
-static indx_t	 next_realkey __P((PAGE16 *, indx_t));
 static u_int16_t overflow_page __P((HTAB *));
 static void	 page_init __P((HTAB *, PAGE16 *, db_pgno_t, u_int8_t));
 static indx_t	 prev_realkey __P((PAGE16 *, indx_t));
@@ -248,27 +247,6 @@ putpair(p, key, val)
 	OFFSET(pagep) = off - 1;
 }
 
-/*
- * Returns the index of the next non-bigkey pair after n on the page.
- * Returns -1 if there are no more non-big things on the page.
- */
-static indx_t
-#ifdef __STDC__
-next_realkey(PAGE16 * pagep, indx_t n)
-#else
-next_realkey(pagep, n)
-	PAGE16 *pagep;
-	u_int32_t n;
-#endif
-{
-	indx_t i;
-
-	for (i = n + 1; i < NUM_ENT(pagep); i++)
-		if (KEY_OFF(pagep, i) != BIGPAIR)
-			return (i);
-	return (-1);
-}
-
 /*
  * Returns the index of the previous non-bigkey pair after n on the page.
  * Returns n if there are no previous non-big things on the page.
@@ -305,7 +283,7 @@ __delpair(hashp, cursorp, item_info)
 	PAGE16 *pagep;
 	indx_t ndx;
 	short check_ndx;
-	int16_t delta, len, next_key;
+	int16_t delta, len;
 	int32_t n;
 	u_int8_t *src, *dest;
 
@@ -376,10 +354,6 @@ __delpair(hashp, cursorp, item_info)
 	/* Adjust the offsets. */
 	for (n = ndx; n < NUM_ENT(pagep) - 1; n++)
 		if (KEY_OFF(pagep, (n + 1)) != BIGPAIR) {
-			next_key = next_realkey(pagep, n);
-#ifdef DEBUG
-			assert(next_key != -1);
-#endif
 			KEY_OFF(pagep, n) = KEY_OFF(pagep, (n + 1)) + delta;
 			DATA_OFF(pagep, n) = DATA_OFF(pagep, (n + 1)) + delta;
 		} else {


More information about the cvs-krb5 mailing list