From cc1607d6a7497b8096c20fca021d9c7e5ecc7c0d Mon Sep 17 00:00:00 2001 From: wessels <> Date: Fri, 27 Mar 1998 12:36:55 +0000 Subject: [PATCH] dont mix hash_lookup and hash_next --- src/client_db.cc | 7 +++---- src/net_db.cc | 10 +++++----- src/structs.h | 2 ++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/client_db.cc b/src/client_db.cc index 7107b6603f..581d25bcb0 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.28 1998/03/27 04:15:37 wessels Exp $ + * $Id: client_db.cc,v 1.29 1998/03/27 05:36:55 wessels Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -200,9 +200,8 @@ meshCtblGetRowFn(oid * New, oid * Oid) else { snprintf(key, 15, "%d.%d.%d.%d", Oid[0], Oid[1], Oid[2], Oid[3]); c = (ClientInfo *) hash_lookup(client_table, key); - if (!c) - return 0; - c = (ClientInfo *) hash_next(client_table); + if (NULL != c) + c = c->next; } if (!c) return 0; diff --git a/src/net_db.cc b/src/net_db.cc index 8b0c81ff09..0f4c50c2e0 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.79 1998/03/27 04:15:38 wessels Exp $ + * $Id: net_db.cc,v 1.80 1998/03/27 05:36:56 wessels Exp $ * * DEBUG: section 37 Network Measurement Database * AUTHOR: Duane Wessels @@ -714,10 +714,10 @@ netdbGetRowFn(oid * New, oid * Oid) } else { snprintf(key, 15, "%d.%d.%d.%d", Oid[0], Oid[1], Oid[2], Oid[3]); c = (netdbEntry *) hash_lookup(addr_table, key); - if (!c) - return 0; - debug(49, 8) ("netdbGetRowFn: [%s] found\n", key); - c = (netdbEntry *) hash_next(addr_table); + if (NULL != c) { + debug(49, 8) ("netdbGetRowFn: [%s] found\n", key); + c = c->next; + } if (!c) debug(49, 8) ("netdbGetRowFn: next does not exist!\n"); } diff --git a/src/structs.h b/src/structs.h index a9ffc19ae2..85333a6f34 100644 --- a/src/structs.h +++ b/src/structs.h @@ -819,6 +819,7 @@ struct _net_db_peer { }; struct _netdbEntry { + /* first two items must be equivalent to hash_link in hash.h */ char *key; netdbEntry *next; char network[16]; @@ -1178,6 +1179,7 @@ struct _MemPool { }; struct _ClientInfo { + /* first two items must be equivalent to hash_link in hash.h */ char *key; struct client_info *next; struct in_addr addr; -- 2.47.3