From: wessels <> Date: Fri, 13 Mar 1998 12:38:13 +0000 (+0000) Subject: added clientdbFreeMemory() X-Git-Tag: SQUID_3_0_PRE1~3854 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83394596f9545f477e9ea63682cbada63ed6e5a4;p=thirdparty%2Fsquid.git added clientdbFreeMemory() --- 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; +}