From 83394596f9545f477e9ea63682cbada63ed6e5a4 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Fri, 13 Mar 1998 12:38:13 +0000 Subject: [PATCH] added clientdbFreeMemory() --- src/client_db.cc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/client_db.cc b/src/client_db.cc index 50fbb2f362..3dc5dd8d94 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.23 1998/03/06 22:19:30 wessels Exp $ + * $Id: client_db.cc,v 1.24 1998/03/13 05:38:13 wessels Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -157,3 +157,27 @@ clientdbDump(StoreEntry * sentry) c = (ClientInfo *) hash_next(client_table); } } + +void +clientdbFreeMemory(void) +{ + ClientInfo *c; + ClientInfo **C; + int i = 0; + int j; + int n = memInUse(MEM_CLIENT_INFO); + C = xcalloc(n, sizeof(ClientInfo *)); + c = (ClientInfo *) hash_first(client_table); + while (c && i < n) { + *(C + i) = c; + i++; + c = (ClientInfo *) hash_next(client_table); + } + for (j = 0; j < i; j++) { + c = *(C + j); + memFree(MEM_CLIENT_INFO, c); + } + xfree(C); + hashFreeMemory(client_table); + client_table = NULL; +} -- 2.47.3