From: wessels <> Date: Wed, 7 Jan 1998 05:44:03 +0000 (+0000) Subject: casts on hash_first() to make warnings go away X-Git-Tag: SQUID_3_0_PRE1~4233 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0400784a08481933d92cb7f303ad4c06ffae312;p=thirdparty%2Fsquid.git casts on hash_first() to make warnings go away --- diff --git a/src/net_db.cc b/src/net_db.cc index 95ae82ed12..b0dd73800d 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.57 1998/01/02 21:55:05 wessels Exp $ + * $Id: net_db.cc,v 1.58 1998/01/06 22:44:03 wessels Exp $ * * DEBUG: section 37 Network Measurement Database * AUTHOR: Duane Wessels @@ -158,11 +158,12 @@ netdbPurgeLRU(void) int list_count = 0; int removed = 0; list = xcalloc(meta_data.netdb_addrs, sizeof(netdbEntry *)); - for (n = hash_first(addr_table); n; n = hash_next(addr_table)) { + n = (netdbEntry *) hash_first(addr_table); + while (n != NULL) { + assert(list_count < meta_data.netdb_addrs); *(list + list_count) = n; list_count++; - if (list_count > meta_data.netdb_addrs) - fatal_dump("netdbPurgeLRU: list_count overflow"); + n = (netdbEntry *) hash_next(addr_table); } qsort((char *) list, list_count, @@ -563,8 +564,11 @@ netdbDump(StoreEntry * sentry) "Hostnames"); list = xcalloc(meta_data.netdb_addrs, sizeof(netdbEntry *)); i = 0; - for (n = hash_first(addr_table); n; n = hash_next(addr_table)) + n = (netdbEntry *) hash_first(addr_table); + while (n != NULL) { *(list + i++) = n; + n = (netdbEntry *) hash_next(addr_table); + } if (i != meta_data.netdb_addrs) debug(37, 0) ("WARNING: netdb_addrs count off, found %d, expected %d\n", i, meta_data.netdb_addrs); @@ -674,8 +678,7 @@ var_netdb_entry(struct variable *vp, oid * name, int *length, int exact, int *va debug(49, 5) ("snmp var_netdb_entry: hey, here we are.\n"); #ifdef USE_ICMP - n = hash_first(addr_table); - + n = (netdbEntry *) hash_first(addr_table); while (n != NULL) { newname[vp->namelen] = cnt++; result = compare(name, *length, newname, (int) vp->namelen + 1);