/*
- * $Id: access_log.cc,v 1.7 1997/11/05 00:39:49 wessels Exp $
+ * $Id: access_log.cc,v 1.8 1997/11/05 05:29:16 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
* modulo the inclusion of space (x40) to make the raw logs a bit
* more readable.
*/
- while ((c = *(const unsigned char *) header++)) {
+ while ((c = *(const unsigned char *) header++) != '\0') {
if (c <= 0x1F
|| c >= 0x7F
|| c == '"'
*buf_cursor++ = c2x[i];
*buf_cursor++ = c2x[i + 1];
} else {
- *buf_cursor++ = c;
+ *buf_cursor++ = (char) c;
}
}
*buf_cursor = '\0';
void
accessLogInit(void)
{
- assert(sizeof(log_tags) == (LOG_TYPE_MAX + 1) * sizeof(char *));
+ assert(sizeof(log_tags) == (LOG_TYPE_MAX + 1) * sizeof(char *));
}
+
/*
- * $Id: acl.cc,v 1.112 1997/11/03 20:05:36 wessels Exp $
+ * $Id: acl.cc,v 1.113 1997/11/05 05:29:17 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
const struct _acl_access *A;
int match;
ipcache_addrs *ia;
- while ((A = checklist->access_list)) {
+ while ((A = checklist->access_list) != NULL) {
debug(28, 3) ("aclCheck: checking '%s'\n", A->cfgline);
allow = A->allow;
match = aclMatchAclList(A->acl_list, checklist);
static void
aclDestroyProxyAuth(struct _acl_proxy_auth *p)
{
- int i;
hash_link *hashr = NULL;
/* destroy hash list contents */
- for (i = 0, hashr = hash_first(p->hash); hashr; hashr = hash_next(p->hash))
+ for (hashr = hash_first(p->hash); hashr; hashr = hash_next(p->hash))
hash_delete(p->hash, hashr->key);
/* destroy and free the hash table itself */
hashFreeMemory(p->hash);
static char *passwords = NULL;
char *user = NULL;
char *passwd = NULL;
- int i;
hash_link *hashr = NULL;
FILE *f = NULL;
if ((squid_curtime - p->last_time) >= p->check_interval) {
p->change_time = buf.st_mtime;
if (p->hash != 0) {
debug(28, 5) ("aclReadProxyAuth: invalidating old entries\n");
- for (i = 0, hashr = hash_first(p->hash); hashr; hashr = hash_next(p->hash)) {
+ for (hashr = hash_first(p->hash); hashr; hashr = hash_next(p->hash)) {
debug(28, 6) ("aclReadProxyAuth: deleting %s\n", hashr->key);
hash_delete(p->hash, hashr->key);
}
/*
- * $Id: cache_cf.cc,v 1.229 1997/11/04 23:29:35 wessels Exp $
+ * $Id: cache_cf.cc,v 1.230 1997/11/05 05:29:18 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
wordlistDestroy(wordlist ** list)
{
wordlist *w = NULL;
- while ((w = *list)) {
+ while ((w = *list) != NULL) {
*list = w->next;
safe_free(w->key);
safe_free(w);
free_peer(peer ** P)
{
peer *p;
- while ((p = *P)) {
+ while ((p = *P) != NULL) {
*P = p->next;
peerDestroy(p);
}
free_cachemgrpasswd(cachemgr_passwd ** head)
{
cachemgr_passwd *p;
- while ((p = *head)) {
+ while ((p = *head) != NULL) {
*head = p->next;
xfree(p->passwd);
xfree(p);
free_ushortlist(ushortlist ** P)
{
ushortlist *u;
- while ((u = *P)) {
+ while ((u = *P) != NULL) {
*P = u->next;
xfree(u);
}
free_refreshpattern(refresh_t ** head)
{
refresh_t *t;
- while ((t = *head)) {
+ while ((t = *head) != NULL) {
*head = t->next;
safe_free(t->pattern);
regfree(&t->compiled_pattern);
/*
- * $Id: cachemgr.cc,v 1.63 1997/10/25 17:22:34 wessels Exp $
+ * $Id: cachemgr.cc,v 1.64 1997/11/05 05:29:19 wessels Exp $
*
* DEBUG: section 0 CGI Cache Manager
* AUTHOR: Harvest Derived
strcpy(hostname, CACHEMGR_HOSTNAME);
/* a POST request */
- if ((s = getenv("REQUEST_METHOD")) && !strcasecmp(s, "POST") &&
- (s = getenv("CONTENT_LENGTH")) && (len = atoi(s)) > 0) {
+ if ((s = getenv("REQUEST_METHOD")) != NULL && !strcasecmp(s, "POST") &&
+ (s = getenv("CONTENT_LENGTH")) != NULL && (len = atoi(s)) > 0) {
buffer = xmalloc(len + 1);
fread(buffer, len, 1, stdin);
buffer[len] = '\0';
/*
- * $Id: cf_gen.cc,v 1.14 1997/11/04 23:21:12 wessels Exp $
+ * $Id: cf_gen.cc,v 1.15 1997/11/05 05:29:19 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Max Okumoto
static const char WS[] = " \t";
-static const char NS[] = "";
static int gen_default(Entry *, FILE *);
static void gen_parse(Entry *, FILE *);
static void gen_dump(Entry *, FILE *);
case sSTART:
if ((strlen(buff) == 0) || (!strncmp(buff, "#", 1))) {
/* ignore empty and comment lines */
+ (void) 0;
} else if (!strncmp(buff, "NAME:", 5)) {
char *name;
if ((name = strtok(buff + 5, WS)) == NULL) {
case s1:
if ((strlen(buff) == 0) || (!strncmp(buff, "#", 1))) {
/* ignore empty and comment lines */
+ (void) 0;
} else if (!strncmp(buff, "COMMENT:", 8)) {
ptr = buff + 8;
while (isspace(*ptr))
"\tdebug(0,10)(\"parse_line: %%s\\n\", buff);\n"
"\tif ((token = strtok(buff, w_space)) == NULL) {\n"
"\t\t/* ignore empty lines */\n"
+ "\t\t(void) 0;\n"
);
for (entry = head; entry != NULL; entry = entry->next) {
/*
- * $Id: client_side.cc,v 1.140 1997/11/05 00:39:50 wessels Exp $
+ * $Id: client_side.cc,v 1.141 1997/11/05 05:29:20 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
entry = http->entry; /* reset, IMS might have changed it */
if (entry && entry->ping_status == PING_WAITING)
storeReleaseRequest(entry);
- protoUnregister(entry, request, conn->peer.sin_addr);
+ protoUnregister(entry, request);
}
assert(http->log_type < LOG_TYPE_MAX);
if (entry)
clientHttpRequest *http;
debug(12, 3) ("connStateFree: FD %d\n", fd);
assert(connState != NULL);
- while ((http = connState->chr)) {
+ while ((http = connState->chr) != NULL) {
assert(http->conn == connState);
assert(connState->chr != connState->chr->next);
httpRequestFree(http);
}
void
-clientWriteComplete(int fd, char *buf, int size, int errflag, void *data)
+clientWriteComplete(int fd, char *bufnotused, int size, int errflag, void *data)
{
clientHttpRequest *http = data;
ConnStateData *conn;
debug(12, 5) ("clientWriteComplete: FD %d Keeping Alive\n", fd);
conn = http->conn;
httpRequestFree(http);
- if ((http = conn->chr)) {
+ if ((http = conn->chr) != NULL) {
debug(12, 1) ("clientWriteComplete: FD %d Sending next request\n", fd);
storeClientCopy(entry,
http->out.offset,
}
static void
-icpHandleIMSComplete(int fd, char *buf_unused, int size, int errflag, void *data)
+icpHandleIMSComplete(int fd, char *bufnotused, int size, int errflag, void *data)
{
clientHttpRequest *http = data;
StoreEntry *entry = http->entry;
}
static int
-clientReadDefer(int fd, void *data)
+clientReadDefer(int fdnotused, void *data)
{
ConnStateData *conn = data;
return conn->defer.until > squid_curtime;
}
int
-httpAcceptDefer(int fd, void *notused)
+httpAcceptDefer(int fdnotused, void *notused)
{
return !fdstat_are_n_free_fd(RESERVED_FD);
}
/*
- * $Id: comm.cc,v 1.200 1997/10/28 06:46:51 wessels Exp $
+ * $Id: comm.cc,v 1.201 1997/11/05 05:29:21 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
static void commSetConnectTimeout(int fd, time_t timeout);
static int commResetFD(ConnectStateData * cs);
static int commRetryConnect(ConnectStateData * cs);
-static time_t commBackoffTimeout(unsigned char numaddrs);
+static time_t commBackoffTimeout(int);
static struct timeval zero_tv;
ipcacheCycleAddr(cs->host);
cs->addrcount = ia->count;
cs->connstart = squid_curtime;
- commSetConnectTimeout(cs->fd, commBackoffTimeout(ia->count));
+ commSetConnectTimeout(cs->fd, commBackoffTimeout((int) ia->count));
commConnectHandle(cs->fd, cs);
}
}
static void
-commConnectFree(int fdunused, void *data)
+commConnectFree(int fdnotused, void *data)
{
ConnectStateData *cs = data;
if (cs->locks)
return 0;
}
close(fd2);
- commSetConnectTimeout(cs->fd, commBackoffTimeout(cs->addrcount));
+ commSetConnectTimeout(cs->fd, commBackoffTimeout((int) cs->addrcount));
commSetNonBlocking(cs->fd);
return 1;
}
return 0;
if (squid_curtime - cs->connstart > Config.Timeout.connect)
return 0;
- commSetConnectTimeout(cs->fd, commBackoffTimeout((unsigned char) 100));
+ commSetConnectTimeout(cs->fd, commBackoffTimeout(100));
} else {
if (cs->tries > cs->addrcount)
return 0;
/* Back off the socket timeout if there are several addresses available */
static time_t
-commBackoffTimeout(unsigned char numaddrs)
+commBackoffTimeout(int numaddrs)
{
time_t timeout;
timeout = (time_t) Config.Timeout.connect;
fd, xstrerror());
return COMM_ERROR;
}
+ /* NOTREACHED */
}
if (peer)
/*
- * $Id: disk.cc,v 1.90 1997/10/30 18:42:55 wessels Exp $
+ * $Id: disk.cc,v 1.91 1997/11/05 05:29:22 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
file_open_complete(void *data, int fd, int errcode)
{
open_ctrl_t *ctrlp = (open_ctrl_t *) data;
- fde *F;
if (fd < 0) {
errno = errcode;
debug(50, 0) ("file_open: error opening file %s: %s\n", ctrlp->path,
debug(6, 5) ("file_open: FD %d\n", fd);
commSetCloseOnExec(fd);
fd_open(fd, FD_FILE, ctrlp->path);
- F = &fd_table[fd];
if (ctrlp->callback)
(ctrlp->callback) (ctrlp->callback_data, fd);
xfree(ctrlp->path);
/* write handler */
static void
-diskHandleWrite(int fd, void *unused)
+diskHandleWrite(int fd, void *notused)
{
int len = 0;
disk_ctrl_t *ctrlp;
/*
- * $Id: errorpage.cc,v 1.99 1997/11/04 19:54:46 wessels Exp $
+ * $Id: errorpage.cc,v 1.100 1997/11/05 05:29:22 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
* closeing the FD, otherwise we do it ourseves.
*/
static void
-errorSendComplete(int fd, char *buf, int size, int errflag, void *data)
+errorSendComplete(int fd, char *bufnotused, int size, int errflag, void *data)
{
ErrorState *err = data;
debug(4, 3) ("errorSendComplete: FD %d, size=%d\n", fd, size);
/*
- * $Id: event.cc,v 1.8 1997/06/04 06:15:51 wessels Exp $
+ * $Id: event.cc,v 1.9 1997/11/05 05:29:23 wessels Exp $
*
* DEBUG: section 41 Event Processing
* AUTHOR: Henrik Nordstrom
{
struct ev_entry **E;
struct ev_entry *event;
- for (E = &tasks; (event = *E); E = &(*E)->next) {
+ for (E = &tasks; (event = *E) != NULL; E = &(*E)->next) {
if (event->func != func)
continue;
if (event->arg != arg)
/*
- * $Id: fqdncache.cc,v 1.64 1997/10/30 02:40:59 wessels Exp $
+ * $Id: fqdncache.cc,v 1.65 1997/11/05 05:29:23 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
int ghba_calls; /* # calls to blocking gethostbyaddr() */
} FqdncacheStats;
-static int fqdncache_compareLastRef(fqdncache_entry **, fqdncache_entry **);
+static QS fqdncache_compareLastRef;
static void fqdncache_dnsHandleRead(int, void *);
static fqdncache_entry *fqdncache_parsebuffer(const char *buf, dnsserver_t *);
static int fqdncache_purgelru(void);
}
static int
-fqdncache_compareLastRef(fqdncache_entry ** e1, fqdncache_entry ** e2)
+fqdncache_compareLastRef(const void *A, const void *B)
{
- if (!e1 || !e2)
- fatal_dump(NULL);
+ fqdncache_entry *const *e1 = A;
+ fqdncache_entry *const *e2 = B;
+ assert(e1 != NULL && e2 != NULL);
if ((*e1)->lastref > (*e2)->lastref)
return (1);
if ((*e1)->lastref < (*e2)->lastref)
qsort((char *) LRU_list,
LRU_list_count,
sizeof(fqdncache_entry *),
- (QS *) fqdncache_compareLastRef);
+ fqdncache_compareLastRef);
for (k = 0; k < LRU_list_count; k++) {
if (meta_data.fqdncache_count < fqdncache_low)
break;
}
static void
-dummy_handler(const char *u2, void *u3)
+dummy_handler(const char *bufnotused, void *datanotused)
{
return;
}
fatal_dump("fqdncache_restart: fqdn_table == 0\n");
while (fqdncacheDequeue());
next = (fqdncache_entry *) hash_first(fqdn_table);
- while ((this = next)) {
+ while ((this = next) != NULL) {
next = (fqdncache_entry *) hash_next(fqdn_table);
if (this->status == FQDN_CACHED)
continue;
/*
- * $Id: ftp.cc,v 1.164 1997/11/03 22:43:10 wessels Exp $
+ * $Id: ftp.cc,v 1.165 1997/11/05 05:29:24 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
};
static void
-ftpStateFree(int fd, void *data)
+ftpStateFree(int fdnotused, void *data)
{
FtpStateData *ftpState = data;
if (ftpState == NULL)
if (usable < len) {
/* must copy partial line to beginning of buf */
linelen = len - usable;
- assert(linelen > 0);
if (linelen > 4096)
linelen = 4096;
xstrncpy(line, end, linelen);
FtpStateData *ftpState = data;
int len;
int clen;
- int off;
int bin;
StoreEntry *entry = ftpState->entry;
ErrorState *err;
}
/* check if we want to defer reading */
clen = entry->mem_obj->inmem_hi;
- off = storeLowestMemReaderOffset(entry);
if (EBIT_TEST(ftpState->flags, FTP_ISDIR))
if (!EBIT_TEST(ftpState->flags, FTP_HTML_HEADER_SENT))
ftpListingStart(ftpState);
}
static void
-ftpWriteCommandCallback(int fd, char *buf, int size, int errflag, void *data)
+ftpWriteCommandCallback(int fd, char *bufnotused, int size, int errflag, void *data)
{
FtpStateData *ftpState = data;
StoreEntry *entry = ftpState->entry;
}
static void
-ftpReadPort(FtpStateData * ftpState)
+ftpReadPort(FtpStateData * ftpStateNotUsed)
{
debug(9, 3) ("This is ftpReadPort\n");
}
/*
- * $Id: globals.h,v 1.16 1997/11/05 00:39:51 wessels Exp $
+ * $Id: globals.h,v 1.17 1997/11/05 05:29:25 wessels Exp $
*/
extern FILE *debug_log; /* NULL */
extern int store_swap_size; /* 0 */
extern int client_info_sz; /* 0 */
extern unsigned long store_mem_size; /* 0 */
-extern icpUdpData *UdpQueueHead; /* NULL */
-extern icpUdpData *UdpQueueTail; /* NULL */
-extern time_t hit_only_mode_until; /* 0 */
+extern icpUdpData *UdpQueueHead; /* NULL */
+extern icpUdpData *UdpQueueTail; /* NULL */
+extern time_t hit_only_mode_until; /* 0 */
#ifdef HAVE_SYSLOG
extern int _db_level;
/*
- * $Id: gopher.cc,v 1.110 1997/11/03 22:43:11 wessels Exp $
+ * $Id: gopher.cc,v 1.111 1997/11/05 05:29:26 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
static char def_gopher_text[] = "text/plain";
static void
-gopherStateFree(int fd, void *data)
+gopherStateFree(int fdnotused, void *data)
{
GopherStateData *gopherState = data;
if (gopherState == NULL)
char *buf = NULL;
int len;
int clen;
- int off;
int bin;
if (protoAbortFetch(entry)) {
storeAbort(entry, 0);
}
/* check if we want to defer reading */
clen = entry->mem_obj->inmem_hi;
- off = storeLowestMemReaderOffset(entry);
buf = get_free_4k_page();
errno = 0;
/* leave one space for \0 in gopherToHTML */
/*
- * $Id: http.cc,v 1.216 1997/11/04 22:14:17 wessels Exp $
+ * $Id: http.cc,v 1.217 1997/11/05 05:29:27 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
static int httpCachableReply(HttpStateData *);
static void
-httpStateFree(int fd, void *data)
+httpStateFree(int fdnotused, void *data)
{
HttpStateData *httpState = data;
if (httpState == NULL)
return 1;
else
return 0;
+ /* NOTREACHED */
break;
/* Responses that only are cacheable if the server says so */
case 302: /* Moved temporarily */
return 1;
else
return 0;
+ /* NOTREACHED */
break;
/* Errors can be negatively cached */
case 204: /* No Content */
case 503: /* Service Unavailable */
case 504: /* Gateway Timeout */
return -1;
+ /* NOTREACHED */
break;
/* Some responses can never be cached */
case 206: /* Partial Content -- Not yet supported */
case 600: /* Squid header parsing error */
default: /* Unknown status code */
return 0;
+ /* NOTREACHED */
break;
}
- assert(0);
+ /* NOTREACHED */
}
void
int len;
int bin;
int clen;
- int off;
ErrorState *err;
if (protoAbortFetch(entry)) {
storeAbort(entry, 0);
}
/* check if we want to defer reading */
clen = entry->mem_obj->inmem_hi;
- off = storeLowestMemReaderOffset(entry);
errno = 0;
len = read(fd, buf, SQUID_TCP_SO_RCVBUF);
fd_bytes(fd, len, FD_READ);
/* This will be called when request write is complete. Schedule read of
* reply. */
static void
-httpSendComplete(int fd, char *buf, int size, int errflag, void *data)
+httpSendComplete(int fd, char *bufnotused, int size, int errflag, void *data)
{
HttpStateData *httpState = data;
StoreEntry *entry = httpState->entry;
url = entry ? storeUrl(entry) : urlCanonical(orig_request, NULL);
snprintf(ybuf, YBUF_SZ, "Cache-control: Max-age=%d", (int) getMaxAge(url));
httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz, 1);
- if (request->urlpath) {
+ if (request->urlpath[0])
assert(strstr(url, request->urlpath));
- }
}
/* maybe append Connection: Keep-Alive */
if (BIT_TEST(flags, HTTP_KEEPALIVE)) {
int x;
/* Disable handler, in case of errors. */
commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
- while ((queue = UdpQueueHead)) {
+ while ((queue = UdpQueueHead) != NULL) {
debug(12, 5) ("icpUdpReply: FD %d sending %d bytes to %s port %d\n",
fd,
queue->len,
buf_len += sizeof(u_num32);
buf = xcalloc(buf_len, 1);
headerp = (icp_common_t *) (void *) buf;
- headerp->opcode = opcode;
+ headerp->opcode = (char) opcode;
headerp->version = ICP_VERSION_CURRENT;
- headerp->length = htons(buf_len);
+ headerp->length = (u_short) htons(buf_len);
headerp->reqnum = htonl(reqnum);
headerp->flags = htonl(flags);
headerp->pad = htonl(pad);
IcpOpcodeStr[header.opcode]);
} else {
/* call neighborsUdpAck even if ping_status != PING_WAITING */
- neighborsUdpAck(fd,
- url,
- &header,
- &from,
- entry,
- data,
- (int) data_sz);
+ neighborsUdpAck(url, &header, &from, entry);
}
break;
#endif
void
-icpHandleUdp(int sock, void *not_used)
+icpHandleUdp(int sock, void *datanotused)
{
struct sockaddr_in from;
int from_len;
IcpOpcodeStr[header.opcode]);
} else {
/* call neighborsUdpAck even if ping_status != PING_WAITING */
- neighborsUdpAck(fd,
- url,
- &header,
- &from,
- entry,
- data,
- (int) data_sz);
+ neighborsUdpAck(url, &header, &from, entry);
}
break;
/*
- * $Id: ident.cc,v 1.35 1997/10/25 17:22:47 wessels Exp $
+ * $Id: ident.cc,v 1.36 1997/11/05 05:29:29 wessels Exp $
*
* DEBUG: section 30 Ident (RFC 931)
* AUTHOR: Duane Wessels
static void identCallback(ConnStateData * connState);
static void
-identClose(int fd, void *data)
+identClose(int fdnotused, void *data)
{
ConnStateData *connState = data;
connState->ident.fd = -1;
}
static void
-identRequestComplete(int fd, char *buf, int size, int errflag, void *data)
+identRequestComplete(
+ int fd,
+ char *bufnotused,
+ int size,
+ int flagnotused,
+ void *datanotused)
{
debug(30, 5) ("identRequestComplete: FD %d: wrote %d bytes\n", fd, size);
}
/*
- * $Id: ipcache.cc,v 1.140 1997/10/30 02:41:04 wessels Exp $
+ * $Id: ipcache.cc,v 1.141 1997/11/05 05:29:30 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
} IpcacheStats;
static int ipcache_testname(void);
-static int ipcache_compareLastRef(ipcache_entry **, ipcache_entry **);
-static int ipcache_reverseLastRef(ipcache_entry **, ipcache_entry **);
+static QS ipcache_compareLastRef;
+static QS ipcache_reverseLastRef;
static PF ipcache_dnsHandleRead;
static ipcache_entry *ipcache_parsebuffer(const char *buf, dnsserver_t *);
static void ipcache_release(ipcache_entry *);
}
static int
-ipcache_compareLastRef(ipcache_entry ** e1, ipcache_entry ** e2)
+ipcache_compareLastRef(const void *A, const void *B)
{
- if (!e1 || !e2)
- fatal_dump(NULL);
+ const ipcache_entry *const *e1 = A;
+ const ipcache_entry *const *e2 = B;
+ assert(e1 != NULL && e2 != NULL);
if ((*e1)->lastref > (*e2)->lastref)
return (1);
if ((*e1)->lastref < (*e2)->lastref)
}
static int
-ipcache_reverseLastRef(ipcache_entry ** e1, ipcache_entry ** e2)
+ipcache_reverseLastRef(const void *A, const void *B)
{
+ const ipcache_entry *const *e1 = A;
+ const ipcache_entry *const *e2 = B;
+ assert(e1 != NULL && e2 != NULL);
if ((*e1)->lastref < (*e2)->lastref)
return (1);
if ((*e1)->lastref > (*e2)->lastref)
/* finds the LRU and deletes */
void
-ipcache_purgelru(void *unused)
+ipcache_purgelru(void *voidnotused)
{
ipcache_entry *i = NULL;
int local_ip_notpending_count = 0;
qsort((char *) LRU_list,
LRU_list_count,
sizeof(ipcache_entry *),
- (QS *) ipcache_compareLastRef);
+ ipcache_compareLastRef);
for (k = 0; k < LRU_list_count; k++) {
if (meta_data.ipcache_count < ipcache_low)
break;
qsort((char *) list,
N,
sizeof(ipcache_entry *),
- (QS *) ipcache_reverseLastRef);
+ ipcache_reverseLastRef);
for (k = 0; k < N; k++)
ipcacheStatPrint(*(list + k), sentry);
storeAppendPrintf(sentry, close_bracket);
}
static void
-dummy_handler(const ipcache_addrs * addrs, void *u3)
+dummy_handler(const ipcache_addrs * addrsnotused, void *datanotused)
{
return;
}
assert(ip_table != NULL);
while (ipcacheDequeue());
next = (ipcache_entry *) hash_first(ip_table);
- while ((this = next)) {
+ while ((this = next) != NULL) {
next = (ipcache_entry *) hash_next(ip_table);
if (this->status == IP_CACHED)
continue;
/*
- * $Id: multicast.cc,v 1.3 1997/07/07 05:29:49 wessels Exp $
+ * $Id: multicast.cc,v 1.4 1997/11/05 05:29:31 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Martin Hamilton
}
void
-mcastJoinGroups(const ipcache_addrs * ia, void *data)
+mcastJoinGroups(const ipcache_addrs * ia, void *datanotused)
{
#ifdef IP_MULTICAST_TTL
int fd = theInIcpConnection;
/*
- * $Id: neighbors.cc,v 1.165 1997/11/03 22:43:16 wessels Exp $
+ * $Id: neighbors.cc,v 1.166 1997/11/05 05:29:31 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
}
static void
-neighborCountIgnored(peer * p, icp_opcode op_unused)
+neighborCountIgnored(peer * p, icp_opcode opnotused)
{
if (p == NULL)
return;
* If a hit process is already started, then sobeit
*/
void
-neighborsUdpAck(int fd, const char *url, icp_common_t * header, const struct sockaddr_in *from, StoreEntry * entry, char *data, int data_sz)
+neighborsUdpAck(const char *url, icp_common_t * header, const struct sockaddr_in *from, StoreEntry * entry)
{
peer *p = NULL;
MemObject *mem = entry->mem_obj;
}
static void
-peerRefreshDNS(void *junk)
+peerRefreshDNS(void *datanotused)
{
peer *p = NULL;
peer *next = Config.peers;
- while ((p = next)) {
+ while ((p = next) != NULL) {
next = p->next;
p->ip_lookup_pending = 1;
/* some random, bogus FD for ipcache */
}
static void
-peerCheckConnect2(const ipcache_addrs * ia, void *data)
+peerCheckConnect2(const ipcache_addrs * ianotused, void *data)
{
peer *p = data;
p->ip_lookup_pending = 0;
}
static void
-peerCountHandleIcpReply(peer * p, peer_t type, icp_common_t * hdr, void *data)
+peerCountHandleIcpReply(peer * pnotused, peer_t type, icp_common_t * hdrnotused, void *data)
{
ps_state *psstate = data;
psstate->icp.n_recv++;
/*
- * $Id: net_db.cc,v 1.50 1997/10/25 17:22:51 wessels Exp $
+ * $Id: net_db.cc,v 1.51 1997/11/05 05:29:32 wessels Exp $
*
* DEBUG: section 37 Network Measurement Database
* AUTHOR: Duane Wessels
static net_db_peer *netdbPeerAdd(netdbEntry * n, peer * e);
static char *netdbPeerName(const char *name);
static IPH netdbSendPing;
+static QS sortPeerByRtt;
+static QS sortByRtt;
+static QS netdbLRU;
/* We have to keep a local list of peer names. The Peers structure
* gets freed during a reconfigure. We want this database to
}
static int
-netdbLRU(netdbEntry ** n1, netdbEntry ** n2)
+netdbLRU(const void *A, const void *B)
{
+ const netdbEntry *const *n1 = A;
+ const netdbEntry *const *n2 = B;
if ((*n1)->last_use_time > (*n2)->last_use_time)
return (1);
if ((*n1)->last_use_time < (*n2)->last_use_time)
qsort((char *) list,
list_count,
sizeof(netdbEntry *),
- (QS *) netdbLRU);
+ netdbLRU);
for (k = 0; k < list_count; k++) {
if (meta_data.netdb_addrs < Config.Netdb.low)
break;
}
static int
-sortByRtt(netdbEntry ** n1, netdbEntry ** n2)
+sortByRtt(const void *A, const void *B)
{
+ const netdbEntry *const *n1 = A;
+ const netdbEntry *const *n2 = B;
if ((*n1)->rtt > (*n2)->rtt)
return 1;
else if ((*n1)->rtt < (*n2)->rtt)
}
static int
-sortPeerByRtt(net_db_peer * p1, net_db_peer * p2)
+sortPeerByRtt(const void *A, const void *B)
{
+ const net_db_peer *p1 = A;
+ const net_db_peer *p2 = B;
if (p1->rtt > p2->rtt)
return 1;
else if (p1->rtt < p2->rtt)
qsort((char *) list,
i,
sizeof(netdbEntry *),
- (QS *) sortByRtt);
+ sortByRtt);
for (k = 0; k < i; k++) {
n = *(list + k);
storeAppendPrintf(sentry, "{%-16.16s %4d/%4d %7.1f %5.1f", /* } */
qsort((char *) n->peers,
n->n_peers,
sizeof(net_db_peer),
- (QS *) sortPeerByRtt);
+ sortPeerByRtt);
#endif
}
void *data,
int *exprep);
extern void neighborAddAcl(const char *, const char *);
-extern void neighborsUdpAck(int, const char *, icp_common_t *, const struct sockaddr_in *, StoreEntry *, char *, int);
+extern void neighborsUdpAck(const char *, icp_common_t *, const struct sockaddr_in *, StoreEntry *);
extern void neighborAdd(const char *, const char *, int, int, int, int, int);
extern void neighbors_open(int);
extern peer *peerFindByName(const char *);
extern void protoDispatch(int, StoreEntry *, request_t *);
-extern int protoUnregister(StoreEntry *, request_t *, struct in_addr);
+extern int protoUnregister(StoreEntry *, request_t *);
extern void protoStart(int, StoreEntry *, peer *, request_t *);
extern int protoAbortFetch(StoreEntry * entry);
extern DEFER protoCheckDeferRead;
extern const char *storeKeyText(const cache_key *);
extern const cache_key *storeKeyPublic(const char *, method_t);
extern const cache_key *storeKeyPrivate(const char *, method_t, int);
+extern int storeKeyHashBuckets(int);
extern HASHHASH storeKeyHashHash;
extern HASHCMP storeKeyHashCmp;
/*
- * $Id: send-announce.cc,v 1.44 1997/10/17 00:00:45 wessels Exp $
+ * $Id: send-announce.cc,v 1.45 1997/11/05 05:29:35 wessels Exp $
*
* DEBUG: section 27 Cache Announcer
* AUTHOR: Duane Wessels
static IPH send_announce;
void
-start_announce(void *unused)
+start_announce(void *datanotused)
{
if (!Config.onoff.announce)
return;
}
static void
-send_announce(const ipcache_addrs * ia, void *data)
+send_announce(const ipcache_addrs * ia, void *datanotused)
{
LOCAL_ARRAY(char, tbuf, 256);
LOCAL_ARRAY(char, sndbuf, BUFSIZ);
mkhttpdlogtime(&squid_curtime));
strcat(sndbuf, tbuf);
l = strlen(sndbuf);
- if ((file = Config.Announce.file)) {
+ if ((file = Config.Announce.file) != NULL) {
fd = file_open(file, O_RDONLY, NULL, NULL);
if (fd > -1 && (n = read(fd, sndbuf + l, BUFSIZ - l - 1)) > 0) {
fd_bytes(fd, n, FD_READ);
/*
- * $Id: ssl.cc,v 1.68 1997/11/04 18:43:29 wessels Exp $
+ * $Id: ssl.cc,v 1.69 1997/11/05 05:29:36 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
debug(26, 3) ("sslClientClosed: FD %d\n", fd);
/* we have been called from comm_close for the client side, so
* just need to clean up the server side */
- protoUnregister(NULL, sslState->request, no_addr);
+ protoUnregister(NULL, sslState->request);
comm_close(sslState->server.fd);
}
}
static void
-sslErrorComplete(int fd, void *sslState, int size)
+sslErrorComplete(int fdnotused, void *sslState, int sizenotused)
{
assert(sslState != NULL);
sslClose(sslState);
static void
-sslConnectDone(int fd, int status, void *data)
+sslConnectDone(int fdnotused, int status, void *data)
{
SslStateData *sslState = data;
request_t *request = sslState->request;
}
static void
-sslPeerSelectFail(peer * p, void *data)
+sslPeerSelectFail(peer * peernotused, void *data)
{
SslStateData *sslState = data;
ErrorState *err;
/*
- * $Id: stat.cc,v 1.167 1997/11/03 23:18:17 wessels Exp $
+ * $Id: stat.cc,v 1.168 1997/11/05 05:29:37 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
}
storeAppendPrintf(sentry, close_bracket); /* } */
storeAppendPrintf(sentry, "{Keep-Alive Ratio: %d%%}\n",
- percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
+ percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
}
storeAppendPrintf(sentry, close_bracket);
}
/*
- * $Id: store.cc,v 1.334 1997/11/03 23:18:18 wessels Exp $
+ * $Id: store.cc,v 1.335 1997/11/05 05:29:38 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
static dlink_list inmem_list;
static dlink_list all_list;
-static int store_pages_max = 0;
static int store_pages_high = 0;
static int store_pages_low = 0;
if (mem == NULL)
return 0;
debug(20, 3) ("storeUnregister: called for '%s'\n", storeKeyText(e->key));
- for (S = &mem->clients; (sc = *S); S = &(*S)->next) {
+ for (S = &mem->clients; (sc = *S) != NULL; S = &(*S)->next) {
if (sc->callback_data == data)
break;
}
commSetSelect(sc->swapin_fd, COMM_SELECT_READ, NULL, NULL, 0);
file_close(sc->swapin_fd);
}
- if ((callback = sc->callback)) {
+ if ((callback = sc->callback) != NULL) {
/* callback with ssize = -1 to indicate unexpected termination */
debug(20, 3) ("storeUnregister: store_client for %s has a callback\n",
mem->url);
}
static void
-storeSwapOutHandle(int fd, int flag, size_t len, void *data)
+storeSwapOutHandle(int fdnotused, int flag, size_t len, void *data)
{
StoreEntry *e = data;
MemObject *mem = e->mem_obj;
off_t new_mem_lo;
size_t swapout_size;
char *swap_buf;
- size_t swap_buf_len;
+ ssize_t swap_buf_len;
int x;
assert(mem != NULL);
/* should we swap something out to disk? */
}
static void
-storeCleanup(void *data)
+storeCleanup(void *datanotused)
{
static storeCleanList *list = NULL;
storeCleanList *curr;
static time_t last_check = 0;
int pages_needed;
dlink_node *m;
- dlink_node *prev;
+ dlink_node *prev = NULL;
if (squid_curtime == last_check)
return;
last_check = squid_curtime;
* This should get called 1/s from main().
*/
void
-storeMaintainSwapSpace(void *NOTUSED)
+storeMaintainSwapSpace(void *datanotused)
{
dlink_node *m;
- dlink_node *prev;
+ dlink_node *prev = NULL;
StoreEntry *e = NULL;
int scanned = 0;
int locked = 0;
}
static void
-storeClientCopyHandleRead(int fd, const char *buf, int len, int flag, void *data)
+storeClientCopyHandleRead(int fd, const char *buf, int len, int flagnotused, void *data)
{
store_client *sc = data;
MemObject *mem = sc->mem;
store_swap_low = (long) (((float) Config.Swap.maxSize *
(float) Config.Swap.lowWaterMark) / (float) 100);
- store_pages_max = Config.Mem.maxSize / SM_PAGE_SIZE;
store_pages_high = store_mem_high / SM_PAGE_SIZE;
store_pages_low = store_mem_low / SM_PAGE_SIZE;
}
STCB *callback;
void *callback_data;
MemObject *mem; /* ptr to the parent structure, argh! */
- short swapin_fd;
+ int swapin_fd;
struct _store_client *next;
};
/*
- * $Id: tools.cc,v 1.128 1997/10/30 18:37:08 wessels Exp $
+ * $Id: tools.cc,v 1.129 1997/11/05 05:29:40 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
void
-sigusr2_handle(int sig)
+sigusr2_handle(int signotused)
{
static int state = 0;
/* no debug() here; bad things happen if the signal is delivered during _db_print() */
}
static void
-shutdownTimeoutHandler(int fd, void *data)
+shutdownTimeoutHandler(int fd, void *datanotused)
{
debug(21, 1) ("Forcing close of FD %d\n", fd);
comm_close(fd);
}
void
-sig_child(int sig)
+sig_child(int signotused)
{
#ifdef _SQUID_NEXT_
union wait status;
const struct hostent *h = NULL;
char *t = NULL;
- if ((t = Config.visibleHostname))
+ if ((t = Config.visibleHostname) != NULL)
return t;
/* Get the host name and store it in host to return */
/*
- * $Id: tunnel.cc,v 1.68 1997/11/04 18:43:29 wessels Exp $
+ * $Id: tunnel.cc,v 1.69 1997/11/05 05:29:36 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
debug(26, 3) ("sslClientClosed: FD %d\n", fd);
/* we have been called from comm_close for the client side, so
* just need to clean up the server side */
- protoUnregister(NULL, sslState->request, no_addr);
+ protoUnregister(NULL, sslState->request);
comm_close(sslState->server.fd);
}
}
static void
-sslErrorComplete(int fd, void *sslState, int size)
+sslErrorComplete(int fdnotused, void *sslState, int sizenotused)
{
assert(sslState != NULL);
sslClose(sslState);
static void
-sslConnectDone(int fd, int status, void *data)
+sslConnectDone(int fdnotused, int status, void *data)
{
SslStateData *sslState = data;
request_t *request = sslState->request;
}
static void
-sslPeerSelectFail(peer * p, void *data)
+sslPeerSelectFail(peer * peernotused, void *data)
{
SslStateData *sslState = data;
ErrorState *err;
/*
- * $Id: url.cc,v 1.65 1997/10/17 00:00:49 wessels Exp $
+ * $Id: url.cc,v 1.66 1997/11/05 05:29:40 wessels Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
for (t = host; *t; t++)
*t = tolower(*t);
/* remove trailing dots from hostnames */
- while ((l = strlen(host)) && host[--l] == '.')
+ while ((l = strlen(host)) > 0 && host[--l] == '.')
host[l] = '\0';
if (Config.appendDomain && !strchr(host, '.'))
strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN);
/*
- * $Id: wais.cc,v 1.95 1997/11/03 22:43:26 wessels Exp $
+ * $Id: wais.cc,v 1.96 1997/11/05 05:29:41 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
static STABH waisAbort;
static void
-waisStateFree(int fd, void *data)
+waisStateFree(int fdnotused, void *data)
{
WaisStateData *waisState = data;
if (waisState == NULL)
/* This will be called when request write is complete. Schedule read of
* reply. */
static void
-waisSendComplete(int fd, char *buf, int size, int errflag, void *data)
+waisSendComplete(int fd, char *bufnotused, int size, int errflag, void *data)
{
WaisStateData *waisState = data;
StoreEntry *entry = waisState->entry;