]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
-Use pointers, not arrays on hp->h_addr_list
authorwessels <>
Tue, 16 Jul 1996 05:10:53 +0000 (05:10 +0000)
committerwessels <>
Tue, 16 Jul 1996 05:10:53 +0000 (05:10 +0000)
src/acl.cc
src/ipcache.cc
src/send-announce.cc

index 16ef16088203404f398cb39f39313df423727c4d..759f994f5c669b5b5eaa3d98a99a4a428a7bbfb5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: acl.cc,v 1.15 1996/07/09 03:41:17 wessels Exp $
+ * $Id: acl.cc,v 1.16 1996/07/15 23:10:53 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -648,8 +648,8 @@ int aclMatchAcl(acl, c, m, pr, h, po, r)
                acl->name, h);
            return 0;           /* cant check, return no match */
        }
-       for (k = 0; hp->h_addr_list[k]; k++) {
-           xmemcpy(&dst.s_addr, hp->h_addr_list[k], hp->h_length);
+       for (k = 0; *(hp->h_addr_list + k); k++) {
+           xmemcpy(&dst.s_addr, *(hp->h_addr_list + k), hp->h_length);
            if (aclMatchIp(acl->data, dst))
                return 1;
        }
index 4c9ae0aba8c0d0a9e599c37f82ee8958b918f309..948c2931633cd9356a6bf245d953f083dc003f27 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ipcache.cc,v 1.31 1996/07/12 17:39:51 wessels Exp $
+ * $Id: ipcache.cc,v 1.32 1996/07/15 23:10:54 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -309,7 +309,7 @@ static void ipcache_release(i)
     }
     if (result->status == IP_CACHED) {
        for (k = 0; k < (int) result->addr_count; k++)
-           safe_free(result->entry.h_addr_list[k]);
+           safe_free(*(result->entry.h_addr_list + k));
        safe_free(result->entry.h_addr_list);
        for (k = 0; k < (int) result->alias_count; k++)
            safe_free(result->entry.h_aliases[k]);
@@ -488,7 +488,7 @@ static void ipcache_add(name, i, hp, cached)
     if (cached) {
        /* count for IPs */
        addr_count = 0;
-       while ((addr_count < 255) && hp->h_addr_list[addr_count])
+       while ((addr_count < 255) && *(hp->h_addr_list + addr_count))
            ++addr_count;
 
        i->addr_count = addr_count;
@@ -504,8 +504,8 @@ static void ipcache_add(name, i, hp, cached)
        /* copy ip addresses information */
        i->entry.h_addr_list = xcalloc(addr_count + 1, sizeof(char *));
        for (k = 0; k < addr_count; k++) {
-           i->entry.h_addr_list[k] = xcalloc(1, hp->h_length);
-           xmemcpy(i->entry.h_addr_list[k], hp->h_addr_list[k], hp->h_length);
+           *(i->entry.h_addr_list + k) = xcalloc(1, hp->h_length);
+           xmemcpy(*(i->entry.h_addr_list + k), *(hp->h_addr_list + k), hp->h_length);
        }
 
        if (alias_count) {
@@ -743,8 +743,8 @@ static int ipcache_parsebuffer(buf, offset, dnsData)
                                debug(14, 1, "ipcache_parsebuffer: DNS record in invalid format? No $ipcount data.\n");
                                break;
                            }
-                           i->entry.h_addr_list[k] = xcalloc(1, i->entry.h_length);
-                           *((u_num32 *) (void *) i->entry.h_addr_list[k]) = inet_addr(line_cur->line);
+                           *(i->entry.h_addr_list + k) = xcalloc(1, i->entry.h_length);
+                           *((u_num32 *) (void *) *(i->entry.h_addr_list + k)) = inet_addr(line_cur->line);
                            line_cur = line_cur->next;
                            k++;
                        }
@@ -1101,13 +1101,12 @@ void ipcache_init()
        debug(14, 1, "Successful DNS name lookup tests...\n");
     }
 
-    ip_table = hash_create(urlcmp, 229);       /* small hash table */
+    ip_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;
-    /* Need a terminating NULL address (h_addr_list[1]) */
     static_result->h_addr_list = xcalloc(2, sizeof(char *));
-    static_result->h_addr_list[0] = xcalloc(1, 4);
+    *(static_result->h_addr_list + 0) = xcalloc(1, 4);
     static_result->h_name = xcalloc(1, MAX_HOST_NAME + 1);
 
     ipcacheOpenServers();
@@ -1172,7 +1171,7 @@ struct hostent *ipcache_gethostbyname(name, flags)
     IpcacheStats.misses++;
     /* check if it's already a IP address in text form. */
     if ((ip = inet_addr(name)) != INADDR_NONE) {
-       *((u_num32 *) (void *) static_result->h_addr_list[0]) = ip;
+       *((u_num32 *) (void *) (*static_result->h_addr_list + 0)) = ip;
        strncpy(static_result->h_name, name, MAX_HOST_NAME);
        return static_result;
     }
@@ -1251,7 +1250,7 @@ void stat_ipcache_get(sentry)
            i->addr_count);
        for (k = 0; k < (int) i->addr_count; k++) {
            struct in_addr addr;
-           xmemcpy(&addr, i->entry.h_addr_list[k], i->entry.h_length);
+           xmemcpy(&addr, *(i->entry.h_addr_list + k), i->entry.h_length);
            storeAppendPrintf(sentry, " %15s", inet_ntoa(addr));
        }
        for (k = 0; k < (int) i->alias_count; k++) {
index e3109ce986c730cbc56466b92b668dd6fe14ea13..9434e8cec4421abe8724303a52b03267aadf5ca8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: send-announce.cc,v 1.13 1996/07/11 17:42:51 wessels Exp $
+ * $Id: send-announce.cc,v 1.14 1996/07/15 23:10:57 wessels Exp $
  *
  * DEBUG: section 27    Cache Announcer
  * AUTHOR: Duane Wessels
@@ -83,7 +83,7 @@ void send_announce()
     qdata->len = strlen(sndbuf) + 1;
     qdata->address.sin_family = AF_INET;
     qdata->address.sin_port = htons(port);
-    xmemcpy(&qdata->address.sin_addr, hp->h_addr_list[0], hp->h_length);
+    xmemcpy(&qdata->address.sin_addr, *(hp->h_addr_list + 0), hp->h_length);
     AppendUdp(qdata);
     comm_set_select_handler(theOutIcpConnection,
        COMM_SELECT_WRITE,