From: wessels <> Date: Sun, 24 Nov 1996 09:53:17 +0000 (+0000) Subject: fix doubly initializing hash tables X-Git-Tag: SQUID_3_0_PRE1~5424 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19054954dd43851f2f027e79861b2e828ebf47cc;p=thirdparty%2Fsquid.git fix doubly initializing hash tables --- diff --git a/src/client_db.cc b/src/client_db.cc index 327c4f4cd6..4c466008c3 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -13,7 +13,7 @@ typedef struct _client_info { int client_info_sz; -static HashID client_table; +static HashID client_table = 0; static ClientInfo *clientdbAdd _PARAMS((struct in_addr addr)); @@ -32,6 +32,8 @@ clientdbAdd(struct in_addr addr) void clientdbInit(void) { + if (client_table) + return; client_table = hash_create((int (*)_PARAMS((const char *, const char *))) strcmp, 229, hash_string); diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 8ba6b4043d..730ac29564 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.39 1996/11/22 08:38:50 wessels Exp $ + * $Id: fqdncache.cc,v 1.40 1996/11/24 02:55:56 wessels Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -693,6 +693,8 @@ fqdncache_dnsDispatch(dnsserver_t * dns, fqdncache_entry * f) void fqdncache_init(void) { + if (fqdn_table) + return; debug(35, 3, "Initializing FQDN Cache...\n"); memset(&FqdncacheStats, '\0', sizeof(FqdncacheStats)); /* small hash table */ diff --git a/src/net_db.cc b/src/net_db.cc index ae20dc4027..8d5c940021 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -3,8 +3,8 @@ #if USE_ICMP -static HashID addr_table; -static HashID host_table; +static HashID addr_table = 0; +static HashID host_table = 0; static struct in_addr networkFromInaddr _PARAMS((struct in_addr a)); static void netdbRelease _PARAMS((netdbEntry * n)); @@ -215,6 +215,8 @@ void netdbInit(void) { #if USE_ICMP + if (addr_table) + return; addr_table = hash_create((int (*)_PARAMS((const char *, const char *))) strcmp, 229, hash_string); host_table = hash_create((int (*)_PARAMS((const char *, const char *))) strcmp, 467, hash_string); #endif