From: wessels <> Date: Thu, 25 Jul 1996 11:49:14 +0000 (+0000) Subject: - Misc casts and cleanup from running Insight X-Git-Tag: SQUID_3_0_PRE1~5994 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7a5493bb14e896efb02e2b12a03144e737e1f5d;p=thirdparty%2Fsquid.git - Misc casts and cleanup from running Insight --- diff --git a/src/client_side.cc b/src/client_side.cc index 454d89953c..46895ec654 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -51,7 +51,7 @@ void clientAccessCheck(icpState, handler) int answer = 1; request_t *r = icpState->request; aclCheck_t *ch = NULL; - acl_lookup_state i; + squid_acl i; if (icpState->aclChecklist == NULL) { icpState->aclChecklist = xcalloc(1, sizeof(aclCheck_t)); icpState->aclChecklist->src_addr = icpState->peer.sin_addr; diff --git a/src/dnsserver.cc b/src/dnsserver.cc index 28a6b5a0e2..34f8194237 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.9 1996/07/22 16:40:23 wessels Exp $ + * $Id: dnsserver.cc,v 1.10 1996/07/25 05:49:14 wessels Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -268,7 +268,7 @@ int main(argc, argv) #endif addrbuf = inet_addr(request); for (;;) { - result = gethostbyaddr(&addrbuf, 4, AF_INET); + result = gethostbyaddr((char *)&addrbuf, 4, AF_INET); if (result || h_errno != TRY_AGAIN) break; if (++retry_count == 2) diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 2185370894..1ab7d721ad 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.2 1996/07/23 04:11:52 wessels Exp $ + * $Id: fqdncache.cc,v 1.3 1996/07/25 05:49:15 wessels Exp $ * * DEBUG: section 34 FQDN Cache * AUTHOR: Harvest Derived @@ -929,7 +929,7 @@ char *fqdncache_gethostbyaddr(addr, flags) if (flags & FQDN_BLOCKING_LOOKUP) { FqdncacheStats.ghba_calls++; ip = inet_addr(name); - hp = gethostbyaddr(&ip, 4, AF_INET); + hp = gethostbyaddr((char *) &ip, 4, AF_INET); if (hp && hp->h_name && (hp->h_name[0] != '\0') && fqdn_table) { /* good address, cached */ fqdncache_add(name, fqdncache_create(), hp, 1); diff --git a/src/ipcache.cc b/src/ipcache.cc index 8829083d6e..3566615c39 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,5 +1,5 @@ /* - * $Id: ipcache.cc,v 1.36 1996/07/22 16:40:26 wessels Exp $ + * $Id: ipcache.cc,v 1.37 1996/07/25 05:49:16 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -222,7 +222,6 @@ static int ipcache_testname() static void ipcache_release(i) ipcache_entry *i; { - ipcache_entry *result = 0; hash_link *table_entry = NULL; int k; @@ -230,9 +229,8 @@ static void ipcache_release(i) debug(14, 0, "ipcache_release: Could not find key '%s'\n", i->name); return; } - result = (ipcache_entry *) table_entry; - if (i != result) - fatal_dump("ipcache_release: expected i == result!"); + if (i != (ipcache_entry *) table_entry) + fatal_dump("ipcache_release: i != table_entry!"); if (i->status == IP_PENDING) { debug(14, 1, "ipcache_release: Someone called on a PENDING entry\n"); return; @@ -243,25 +241,24 @@ static void ipcache_release(i) } if (hash_remove_link(ip_table, table_entry)) { debug(14, 0, "ipcache_release: hash_remove_link() failed for '%s'\n", - result->name); + i->name); return; } - 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); - for (k = 0; k < (int) result->alias_count; k++) - safe_free(result->entry.h_aliases[k]); - if (result->entry.h_aliases) - safe_free(result->entry.h_aliases); - safe_free(result->entry.h_name); + if (i->status == IP_CACHED) { + for (k = 0; k < (int) i->addr_count; k++) + safe_free(*(i->entry.h_addr_list + k)); + safe_free(i->entry.h_addr_list); + for (k = 0; k < (int) i->alias_count; k++) + safe_free(i->entry.h_aliases[k]); + safe_free(i->entry.h_aliases); + safe_free(i->entry.h_name); debug(14, 5, "ipcache_release: Released IP cached record for '%s'.\n", - result->name); + i->name); } - safe_free(result->name); - safe_free(result->error_message); - memset(result, '\0', sizeof(ipcache_entry)); - safe_free(result); + safe_free(i->name); + safe_free(i->error_message); + memset(i, '\0', sizeof(ipcache_entry)); + safe_free(i); --meta_data.ipcache_count; return; } diff --git a/src/stmem.cc b/src/stmem.cc index c57a505b06..3c8402353a 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -1,5 +1,5 @@ /* - * $Id: stmem.cc,v 1.14 1996/07/20 03:16:56 wessels Exp $ + * $Id: stmem.cc,v 1.15 1996/07/25 05:49:17 wessels Exp $ * * DEBUG: section 19 Memory Primitives * AUTHOR: Harvest Derived @@ -408,12 +408,12 @@ void *get_free_mem_obj() char *get_free_4k_page() { - return get_free_thing(&sm_stats); + return (char *) get_free_thing(&sm_stats); } char *get_free_8k_page() { - return get_free_thing(&disk_stats); + return (char *) get_free_thing(&disk_stats); } static void put_free_thing(thing, p) diff --git a/src/store.cc b/src/store.cc index c64750130c..6a21b45eff 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,5 +1,5 @@ /* - * $Id: store.cc,v 1.73 1996/07/20 03:16:57 wessels Exp $ + * $Id: store.cc,v 1.74 1996/07/25 05:49:18 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -183,6 +183,7 @@ static mem_ptr new_MemObjectData _PARAMS((void)); static StoreEntry *new_StoreEntry _PARAMS((int mem_obj_flag)); static int storeCheckPurgeMem _PARAMS((StoreEntry * e)); static void storeSwapLog _PARAMS((StoreEntry *)); +static int storeHashDelete _PARAMS((StoreEntry *)); /* Now, this table is inaccessible to outsider. They have to use a method @@ -347,18 +348,15 @@ static int storeHashInsert(e) * if object in memory, also remove from in_mem_table */ -int storeHashDelete(hash_ptr) - hash_link *hash_ptr; +static int storeHashDelete(e) + StoreEntry *e; { hash_link *hptr = NULL; - StoreEntry *e = NULL; - - e = (StoreEntry *) hash_ptr; if (e->mem_status == IN_MEMORY && e->key) { if ((hptr = hash_lookup(in_mem_table, e->key))) hash_delete_link(in_mem_table, hptr); } - return (hash_remove_link(store_table, hash_ptr)); + return (hash_remove_link(store_table, (hash_link *) e)); } /* @@ -825,7 +823,6 @@ int storeRegister(e, fd, handler, data) PendingEntry *pe = NULL; int old_size; int i; - int j; debug(20, 3, "storeRegister: FD %d '%s'\n", fd, e->key); @@ -856,10 +853,8 @@ int storeRegister(e, fd, handler, data) e->mem_obj->pending_list_size += MIN_PENDING; /* allocate, and copy old pending list over to the new one */ - tmp = xcalloc(e->mem_obj->pending_list_size, - sizeof(struct pentry *)); - for (j = 0; j < old_size; j++) - tmp[j] = e->mem_obj->pending[j]; + tmp = xcalloc(e->mem_obj->pending_list_size, sizeof(struct pentry *)); + xmemcpy(e->mem_obj->pending, tmp, old_size * sizeof(struct pentry *)); /* free the old list and set the new one */ safe_free(e->mem_obj->pending); @@ -1065,7 +1060,7 @@ int storeAddSwapDisk(path) char *swappath(n) int n; { - return cache_dirs->collection[n % ncache_dirs]; + return (char *) cache_dirs->collection[n % ncache_dirs]; } @@ -2307,8 +2302,7 @@ int storeRelease(e) urlParseProtocol(e->url), e->object_len); } - if (hptr) - storeHashDelete(hptr); + storeHashDelete(e); storeLog(STORE_LOG_RELEASE, e); destroy_StoreEntry(e); return 0;