]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
use SQUIDHOSTNAMELEN instead of MAX_HOST_NAME
authorwessels <>
Mon, 16 Sep 1996 22:28:38 +0000 (22:28 +0000)
committerwessels <>
Mon, 16 Sep 1996 22:28:38 +0000 (22:28 +0000)
src/fqdncache.cc
src/ipcache.cc

index c0b8d0e49554f867bea670c2ea25f8b094c4841c..97470ed728fed53332f5d11ba3edfe962e891129 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.18 1996/09/15 05:04:25 wessels Exp $
+ * $Id: fqdncache.cc,v 1.19 1996/09/16 16:28:38 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
 #define MAX_FQDN                1024   /* Maximum cached FQDN */
 #define FQDN_LOW_WATER       90
 #define FQDN_HIGH_WATER      95
-#define MAX_HOST_NAME    256
 
 struct _fqdn_pending {
     int fd;
@@ -158,7 +157,6 @@ static void fqdncacheEnqueue __P((fqdncache_entry *));
 static void *fqdncacheDequeue __P((void));
 static void fqdncache_dnsDispatch __P((dnsserver_t *, fqdncache_entry *));
 
-static struct hostent *static_result = NULL;
 static HashID fqdn_table = 0;
 static struct fqdncacheQueueData *fqdncacheQueueHead = NULL;
 static struct fqdncacheQueueData **fqdncacheQueueTailP = &fqdncacheQueueHead;
@@ -689,17 +687,9 @@ void
 fqdncache_init()
 {
     debug(35, 3, "Initializing FQDN Cache...\n");
-
     memset(&FqdncacheStats, '\0', sizeof(FqdncacheStats));
-
-    fqdn_table = hash_create(urlcmp, 229, hash_string);                /* small hash table */
-    /* init static area */
-    static_result = xcalloc(1, sizeof(struct hostent));
-    static_result->h_length = 4;
-    static_result->h_addr_list = xcalloc(2, sizeof(char *));
-    *(static_result->h_addr_list + 0) = xcalloc(1, 4);
-    static_result->h_name = xcalloc(1, MAX_HOST_NAME + 1);
-
+    /* small hash table */
+    fqdn_table = hash_create(urlcmp, 229, hash_string);
     fqdncache_high = (long) (((float) MAX_FQDN *
            (float) FQDN_HIGH_WATER) / (float) 100);
     fqdncache_low = (long) (((float) MAX_FQDN *
index 693d3fc01e10daf91958de5718e034351e5b6f3d..25549ab3e8c46ff405c1daf8d6f4ff1e2e4e3b49 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ipcache.cc,v 1.57 1996/09/15 05:04:34 wessels Exp $
+ * $Id: ipcache.cc,v 1.58 1996/09/16 16:28:39 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
 
 #define IP_LOW_WATER       90
 #define IP_HIGH_WATER      95
-#define MAX_HOST_NAME    256
 
 struct _ip_pending {
     int fd;
@@ -781,7 +780,7 @@ ipcache_init()
     static_result->h_length = 4;
     static_result->h_addr_list = xcalloc(2, sizeof(char *));
     *(static_result->h_addr_list + 0) = xcalloc(1, 4);
-    static_result->h_name = xcalloc(1, MAX_HOST_NAME + 1);
+    static_result->h_name = xcalloc(1, SQUIDHOSTNAMELEN + 1);
 
     ipcache_high = (long) (((float) Config.ipcache.size *
            (float) Config.ipcache.high) / (float) 100);
@@ -995,7 +994,7 @@ ipcacheCheckNumeric(char *name)
     if ((ip = inet_addr(name)) == INADDR_NONE)
        return NULL;
     *((u_num32 *) (void *) static_result->h_addr_list[0]) = ip;
-    strncpy(static_result->h_name, name, MAX_HOST_NAME);
+    strncpy(static_result->h_name, name, SQUIDHOSTNAMELEN);
     return static_result;
 }