From: wessels <> Date: Wed, 9 Oct 1996 21:34:13 +0000 (+0000) Subject: mondo proto patch from ed knowles X-Git-Tag: SQUID_3_0_PRE1~5694 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=24382924a7ffbccc48f76cdc110e47fcbf727eaa;p=thirdparty%2Fsquid.git mondo proto patch from ed knowles --- diff --git a/include/GNUregex.h b/include/GNUregex.h index ac38879c3e..9faa80ae50 100644 --- a/include/GNUregex.h +++ b/include/GNUregex.h @@ -385,7 +385,7 @@ typedef struct { * unfortunately clutters up the declarations a bit, but I think it's * worth it. */ -#if __STDC__ +#ifdef __STDC__ #define _RE_ARGS(args) args diff --git a/include/util.h b/include/util.h index b4c840bbc5..87678b02ac 100644 --- a/include/util.h +++ b/include/util.h @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.21 1996/09/20 23:26:52 wessels Exp $ + * $Id: util.h,v 1.22 1996/10/09 15:34:15 wessels Exp $ * * AUTHOR: Harvest Derived * @@ -190,7 +190,7 @@ extern void init_log3 _PARAMS((char *pn, FILE * a, FILE * b)); extern void debug_init _PARAMS((void)); extern void log_errno2 _PARAMS((char *, int, char *)); -#if __STDC__ +#ifdef __STDC__ extern void Log _PARAMS((char *,...)); extern void errorlog _PARAMS((char *,...)); #else diff --git a/lib/GNUregex.c b/lib/GNUregex.c index be5b0563fc..00d55c0839 100644 --- a/lib/GNUregex.c +++ b/lib/GNUregex.c @@ -161,7 +161,7 @@ init_syntax_once() * machines, compilers, `char' and `unsigned char' argument types. * (Per Bothner suggested the basic approach.) */ #undef SIGN_EXTEND_CHAR -#if __STDC__ +#ifdef __STDC__ #define SIGN_EXTEND_CHAR(c) ((signed char) (c)) #else /* not __STDC__ */ /* As in Harbison and Steele. */ diff --git a/lib/tempnam.c b/lib/tempnam.c index 7ec98e5b96..e442be80d9 100644 --- a/lib/tempnam.c +++ b/lib/tempnam.c @@ -34,7 +34,7 @@ #if HAVE_ERRNO_H #include #endif -#if __STDC__ +#ifdef __STDC__ #if HAVE_STDDEF_H #include #endif diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 9cbdce6af0..1805327b1f 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.103 1996/10/08 19:37:33 wessels Exp $ + * $Id: cache_cf.cc,v 1.104 1996/10/09 15:34:19 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -207,14 +207,18 @@ char *cfg_filename = NULL; /* just the last part */ char ForwardedBy[256]; char w_space[] = " \t\n"; -char null_string[] = ""; +static char null_string[] = ""; char config_input_line[BUFSIZ]; int config_lineno = 0; +static char fatal_str[BUFSIZ]; static char *safe_xstrdup _PARAMS((char *p)); +static int ip_acl_match _PARAMS((struct in_addr, ip_acl *)); +static void addToIPACL _PARAMS((ip_acl **, char *, ip_access_type)); static void parseOnOff _PARAMS((int *)); static void parseIntegerValue _PARAMS((int *)); -static char fatal_str[BUFSIZ]; +static void self_destruct _PARAMS((void)); +static void wordlistAdd _PARAMS((wordlist **, char *)); static void configDoConfigure _PARAMS((void)); static void configSetFactoryDefaults _PARAMS((void)); @@ -256,7 +260,7 @@ static void parseWAISRelayLine _PARAMS((void)); static void parseMinutesLine _PARAMS((int *)); static void ip_acl_destroy _PARAMS((ip_acl **)); -void +static void self_destruct(void) { sprintf(fatal_str, "Bungled %s line %d: %s", @@ -264,7 +268,7 @@ self_destruct(void) fatal(fatal_str); } -int +static int ip_acl_match(struct in_addr c, ip_acl * a) { static struct in_addr h; @@ -322,7 +326,7 @@ ip_access_check(struct in_addr address, ip_acl * list) } -void +static void addToIPACL(ip_acl ** list, char *ip_str, ip_access_type access) { ip_acl *p, *q; @@ -412,7 +416,7 @@ wordlistDestroy(wordlist ** list) *list = NULL; } -void +static void wordlistAdd(wordlist ** list, char *key) { wordlist *p = NULL; diff --git a/src/cachemgr.cc b/src/cachemgr.cc index 341319d164..fb25b9798d 100644 --- a/src/cachemgr.cc +++ b/src/cachemgr.cc @@ -1,6 +1,6 @@ /* - * $Id: cachemgr.cc,v 1.33 1996/10/07 15:06:06 wessels Exp $ + * $Id: cachemgr.cc,v 1.34 1996/10/09 15:34:21 wessels Exp $ * * DEBUG: Section 0 CGI Cache Manager * AUTHOR: Harvest Derived @@ -290,14 +290,20 @@ static char *op_cmds_descr[] = "Unknown Operation" }; -int hasTables = FALSE; +static int hasTables = FALSE; -char *script_name = "/cgi-bin/cachemgr.cgi"; +static char *script_name = "/cgi-bin/cachemgr.cgi"; char *progname = NULL; +static char x2c _PARAMS((char *)); static int client_comm_connect _PARAMS((int sock, char *dest_host, u_short dest_port)); +static void print_trailer _PARAMS((void)); +static void noargs_html _PARAMS((char *, int, char *)); +static void unescape_url _PARAMS((char *)); +static void plustospace _PARAMS((char *)); +static void parse_object _PARAMS((char *)); -void +static void print_trailer(void) { time_t now = time(NULL); @@ -325,7 +331,7 @@ print_option(op_t current_opt, op_t opt_nr) } -void +static void noargs_html(char *host, int port, char *url) { op_t op = INFO; @@ -427,7 +433,7 @@ fmakeword(FILE * f, char stop, int *cl) #endif /* A utility function from the NCSA httpd cgi-src utils.c */ -char +static char x2c(char *what) { char digit; @@ -439,7 +445,7 @@ x2c(char *what) } /* A utility function from the NCSA httpd cgi-src utils.c */ -void +static void unescape_url(char *url) { int x, y; @@ -454,7 +460,7 @@ unescape_url(char *url) } /* A utility function from the NCSA httpd cgi-src utils.c */ -void +static void plustospace(char *str) { int x; @@ -465,7 +471,7 @@ plustospace(char *str) } -void +static void parse_object(char *string) { char *tmp_line = NULL; diff --git a/src/comm.cc b/src/comm.cc index a98e1a1fe1..1446fdbadc 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.84 1996/10/08 21:20:50 wessels Exp $ + * $Id: comm.cc,v 1.85 1996/10/09 15:34:22 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -137,14 +137,15 @@ struct _RWStateData { FD_ENTRY *fd_table = NULL; /* also used in disk.c */ /* STATIC */ +static int commBind _PARAMS((int s, struct in_addr, u_short port)); +static int comm_cleanup_fd_entry _PARAMS((int)); +static int examine_select _PARAMS((fd_set *, fd_set *, fd_set *)); static void checkTimeouts _PARAMS((void)); static void checkLifetimes _PARAMS((void)); static void Reserve_More_FDs _PARAMS((void)); static void commSetReuseAddr _PARAMS((int)); -static int examine_select _PARAMS((fd_set *, fd_set *, fd_set *)); static void commSetNoLinger _PARAMS((int)); static void comm_select_incoming _PARAMS((void)); -static int commBind _PARAMS((int s, struct in_addr, u_short port)); static void RWStateCallbackAndFree _PARAMS((int fd, int code)); #ifdef TCP_NODELAY static void commSetTcpNoDelay _PARAMS((int)); @@ -504,7 +505,7 @@ comm_close(int fd) /* use to clean up fdtable when socket is closed without * using comm_close */ -int +static int comm_cleanup_fd_entry(int fd) { FD_ENTRY *conn = &fd_table[fd]; @@ -968,12 +969,10 @@ commSetCloseOnExec(int fd) int flags; if ((flags = fcntl(fd, F_GETFL)) < 0) { debug(5, 0, "FD %d: fcntl F_GETFL: %s\n", fd, xstrerror()); - return COMM_ERROR; - } - if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) { - debug(5, 0, "FD %d: set close-on-exec failed: %s\n", - fd, xstrerror()); + return; } + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) + debug(5, 0, "FD %d: set close-on-exec failed: %s\n", fd, xstrerror()); #endif } diff --git a/src/debug.cc b/src/debug.cc index 9c5698d6dd..860cb131b5 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,5 +1,5 @@ /* - * $Id: debug.cc,v 1.29 1996/09/24 20:16:39 wessels Exp $ + * $Id: debug.cc,v 1.30 1996/10/09 15:34:22 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -114,7 +114,9 @@ static char *debug_log_file = NULL; #define MAX_DEBUG_SECTIONS 50 static int debugLevels[MAX_DEBUG_SECTIONS]; -#if __STDC__ +static char *accessLogTime _PARAMS((time_t)); + +#ifdef __STDC__ void _db_print(int section, int level, char *format,...) { @@ -137,7 +139,7 @@ _db_print(va_alist) if (debug_log == NULL) return; -#if __STDC__ +#ifdef __STDC__ va_start(args, format); #else va_start(args); @@ -278,7 +280,7 @@ _db_rotate_log(void) debugOpenLog(Config.Log.log); } -char * +static char * accessLogTime(time_t t) { struct tm *tm; diff --git a/src/disk.cc b/src/disk.cc index c096a1b5c9..4b36ef1f30 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,5 +1,5 @@ /* - * $Id: disk.cc,v 1.31 1996/10/08 14:43:30 wessels Exp $ + * $Id: disk.cc,v 1.32 1996/10/09 15:34:24 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -121,6 +121,10 @@ typedef struct _dwalk_ctrl { /* table for FILE variable, write lock and queue. Indexed by fd. */ FileEntry *file_table; +static int diskHandleRead _PARAMS((int, dread_ctrl *)); +static int diskHandleWalk _PARAMS((int, dwalk_ctrl *)); +static int diskHandleWrite _PARAMS((int, FileEntry *)); + /* initialize table */ int disk_init(void) @@ -157,7 +161,7 @@ file_open(char *path, int (*handler) _PARAMS((void)), int mode) #if defined(O_NONBLOCK) && !defined(_SQUID_SUNOS_) && !defined(_SQUID_SOLARIS_) mode |= O_NONBLOCK; #else - mode |= O_NDELAY; + mode |= O_NDELAY; #endif /* Open file */ @@ -185,7 +189,7 @@ file_open(char *path, int (*handler) _PARAMS((void)), int mode) memset(conn, '\0', sizeof(FD_ENTRY)); #ifdef DONT_DO_THIS if (commSetNonBlocking(fd) != COMM_ERROR) - conn->comm_type = COMM_NONBLOCKING; + conn->comm_type = COMM_NONBLOCKING; #endif return fd; } @@ -263,7 +267,7 @@ file_write_unlock(int fd, int access_code) /* write handler */ -int +static int diskHandleWrite(int fd, FileEntry * entry) { int len; @@ -392,7 +396,7 @@ file_write(int fd, /* Read from FD */ -int +static int diskHandleRead(int fd, dread_ctrl * ctrl_dat) { int len; @@ -485,7 +489,7 @@ file_read(int fd, char *buf, int req_len, int offset, FILE_READ_HD handler, void /* Read from FD and pass a line to routine. Walk to EOF. */ -int +static int diskHandleWalk(int fd, dwalk_ctrl * walk_dat) { int len; diff --git a/src/dnsserver.cc b/src/dnsserver.cc index f92eb8c76d..e52b510426 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.24 1996/09/24 18:47:56 wessels Exp $ + * $Id: dnsserver.cc,v 1.25 1996/10/09 15:34:24 wessels Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -221,7 +221,7 @@ extern int h_errno; extern int _dns_ttl_; /* this is a really *dirty* hack - bne */ #endif -int do_debug = 0; +static int do_debug = 0; /* error messages from gethostbyname() */ static char * @@ -254,7 +254,6 @@ main(int argc, char *argv[]) int alias_count = 0; int i; int c; - extern char *optarg; #if HAVE_RES_INIT res_init(); diff --git a/src/errorpage.cc b/src/errorpage.cc index f5cc87229f..3977620ced 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.43 1996/09/26 19:19:43 wessels Exp $ + * $Id: errorpage.cc,v 1.44 1996/10/09 15:34:25 wessels Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -72,7 +72,7 @@ typedef struct { char *lng; } error_data; -error_data ErrorData[] = +static error_data ErrorData[] = { {"ERR_READ_TIMEOUT", "Read Timeout", diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 51fb128ab9..2f41b9f208 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.21 1996/09/20 06:28:42 wessels Exp $ + * $Id: fqdncache.cc,v 1.22 1996/10/09 15:34:25 wessels Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -169,8 +169,8 @@ static char fqdncache_status_char[] = 'D' }; -long fqdncache_low = 180; -long fqdncache_high = 200; +static long fqdncache_low = 180; +static long fqdncache_high = 200; static void fqdncacheEnqueue(fqdncache_entry * f) diff --git a/src/ftp.cc b/src/ftp.cc index 30bcae398f..8dd8eaeaea 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.61 1996/09/20 19:29:25 wessels Exp $ + * $Id: ftp.cc,v 1.62 1996/10/09 15:34:26 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -127,12 +127,17 @@ typedef struct _Ftpdata { } FtpData; /* Local functions */ -static int ftpStateFree _PARAMS((int fd, FtpData * ftpState)); -static void ftpProcessReplyHeader _PARAMS((FtpData * data, char *buf, int size)); -static void ftpServerClosed _PARAMS((int fd, void *nodata)); -static void ftp_login_parser _PARAMS((char *login, FtpData * data)); -static char *ftpTransferMode _PARAMS((char *urlpath)); -static char *ftpGetBasicAuth _PARAMS((char *req_hdr)); +static char *ftpTransferMode _PARAMS((char *)); +static char *ftpGetBasicAuth _PARAMS((char *)); +static int ftpReadReply _PARAMS((int, FtpData *)); +static int ftpStateFree _PARAMS((int, FtpData *)); +static void ftpConnInProgress _PARAMS((int, FtpData *)); +static void ftpLifetimeExpire _PARAMS((int, FtpData *)); +static void ftpProcessReplyHeader _PARAMS((FtpData *, char *, int)); +static void ftpSendComplete _PARAMS((int, char *, int, int, void *)); +static void ftpSendRequest _PARAMS((int, FtpData *)); +static void ftpServerClosed _PARAMS((int, void *)); +static void ftp_login_parser _PARAMS((char *, FtpData *)); /* Global functions not declared in ftp.h */ void ftpLifetimeExpire(int fd, FtpData * data); @@ -183,7 +188,7 @@ ftp_login_parser(char *login, FtpData * data) } /* This will be called when socket lifetime is expired. */ -void +static void ftpLifetimeExpire(int fd, FtpData * data) { StoreEntry *entry = NULL; @@ -275,7 +280,7 @@ ftpProcessReplyHeader(FtpData * data, char *buf, int size) /* This will be called when data is ready to be read from fd. Read until * error or connection closed. */ -int +static int ftpReadReply(int fd, FtpData * data) { LOCAL_ARRAY(char, buf, SQUID_TCP_SO_RCVBUF); @@ -404,7 +409,7 @@ ftpReadReply(int fd, FtpData * data) return 0; } -void +static void ftpSendComplete(int fd, char *buf, int size, int errflag, void *data) { FtpData *ftpState = (FtpData *) data; @@ -454,7 +459,7 @@ ftpTransferMode(char *urlpath) return ftpBinary; } -void +static void ftpSendRequest(int fd, FtpData * data) { char *path = NULL; @@ -535,7 +540,7 @@ ftpSendRequest(int fd, FtpData * data) put_free_8k_page); } -void +static void ftpConnInProgress(int fd, FtpData * data) { StoreEntry *entry = data->entry; diff --git a/src/http.cc b/src/http.cc index ec7f8e7e41..fbdfcfc099 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.80 1996/10/08 14:48:34 wessels Exp $ + * $Id: http.cc,v 1.81 1996/10/09 15:34:29 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -107,7 +107,7 @@ #define HTTP_DELETE_GAP (1<<18) -struct { +static struct { int parsed; int date; int lm; diff --git a/src/ipcache.cc b/src/ipcache.cc index 729058884d..3762737733 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,5 +1,5 @@ /* - * $Id: ipcache.cc,v 1.66 1996/10/07 15:12:55 wessels Exp $ + * $Id: ipcache.cc,v 1.67 1996/10/09 15:34:31 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -172,8 +172,8 @@ static char ipcache_status_char[] = 'D' }; -long ipcache_low = 180; -long ipcache_high = 200; +static long ipcache_low = 180; +static long ipcache_high = 200; static void ipcacheEnqueue(ipcache_entry * i) @@ -885,8 +885,8 @@ ipcacheStatPrint(ipcache_entry * i, StoreEntry * sentry) (int) (i->expires - squid_curtime), i->addr_count); for (k = 0; k < (int) i->addr_count; k++) - xmemcpy(&addr.s_addr, i->entry.h_addr_list[k], sizeof(struct in_addr)); - storeAppendPrintf(sentry, " %15s", inet_ntoa(addr)); + xmemcpy(&addr.s_addr, i->entry.h_addr_list[k], sizeof(struct in_addr)); + storeAppendPrintf(sentry, " %15s", inet_ntoa(addr)); for (k = 0; k < (int) i->alias_count; k++) storeAppendPrintf(sentry, " %s", i->entry.h_aliases[k]); if (i->entry.h_name && strncmp(i->name, i->entry.h_name, MAX_LINELEN)) diff --git a/src/main.cc b/src/main.cc index 54774539df..885452f238 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,5 +1,5 @@ /* - * $Id: main.cc,v 1.87 1996/09/24 20:17:31 wessels Exp $ + * $Id: main.cc,v 1.88 1996/10/09 15:34:32 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -148,14 +148,15 @@ static time_t next_dirclean; static time_t next_announce; static time_t next_ip_purge; +static time_t mainMaintenance _PARAMS((void)); static void rotate_logs _PARAMS((int)); static void reconfigure _PARAMS((int)); static void mainInitialize _PARAMS((void)); static void mainReinitialize _PARAMS((void)); -static time_t mainMaintenance _PARAMS((void)); static void usage _PARAMS((void)); static void mainParseOptions _PARAMS((int, char **)); static void sendSignal _PARAMS((void)); +static void serverConnectionsOpen _PARAMS((void)); static void usage(void) @@ -230,7 +231,7 @@ mainParseOptions(int argc, char *argv[]) opt_no_ipcache = 1; break; case 'k': - if (strlen(optarg) < 1) + if ((int) strlen(optarg) < 1) usage(); if (!strncmp(optarg, "reconfigure", strlen(optarg))) opt_send_signal = SIGHUP; @@ -256,6 +257,7 @@ mainParseOptions(int argc, char *argv[]) break; #else fatal("Need to add -DMALLOC_DBG when compiling to use -m option"); + /* NOTREACHED */ #endif case 's': opt_syslog_enable = 1; @@ -316,7 +318,7 @@ shut_down(int sig) #endif } -void +static void serverConnectionsOpen(void) { struct in_addr addr; diff --git a/src/neighbors.cc b/src/neighbors.cc index e3d3b1b784..2010a2263b 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.60 1996/10/08 02:13:57 wessels Exp $ + * $Id: neighbors.cc,v 1.61 1996/10/09 15:34:33 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -174,7 +174,7 @@ neighborType(edge * e, request_t * request) for (d = e->domains; d; d = d->next) { if (matchDomainName(d->domain, request->host)) if (d->neighbor_type != EDGE_NONE) - return d->neighbor_type; + return d->neighbor_type; } return e->type; } @@ -188,7 +188,7 @@ edgeWouldBePinged(edge * e, request_t * request) aclCheck_t checklist; if (BIT_TEST(request->flags, REQ_NOCACHE)) - if (neighborType(e, request) == EDGE_SIBLING) + if (neighborType(e, request) == EDGE_SIBLING) return 0; if (e->domains == NULL && e->acls == NULL) return do_ping; diff --git a/src/recv-announce.cc b/src/recv-announce.cc index d00b6d54ab..a113dbce28 100644 --- a/src/recv-announce.cc +++ b/src/recv-announce.cc @@ -1,5 +1,5 @@ /* - * $Id: recv-announce.cc,v 1.10 1996/09/20 06:29:04 wessels Exp $ + * $Id: recv-announce.cc,v 1.11 1996/10/09 15:34:35 wessels Exp $ * * DEBUG: section 0 Announement Server * AUTHOR: Harvest Derived @@ -115,6 +115,8 @@ #include #include +#include "ansiproto.h" + #define RECV_BUF_SIZE 8192 extern void xmemcpy _PARAMS((void *from, void *to, int len)); @@ -140,7 +142,7 @@ extern void xmemcpy _PARAMS((void *from, void *to, int len)); * usage: recv-announce logfile */ -void +static void sig_handle(void) { fflush(stdout); diff --git a/src/redirect.cc b/src/redirect.cc index 5bb1235228..8439926086 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -1,5 +1,5 @@ /* - * $Id: redirect.cc,v 1.21 1996/09/26 19:54:45 wessels Exp $ + * $Id: redirect.cc,v 1.22 1996/10/09 15:34:35 wessels Exp $ * * DEBUG: section 29 Redirector * AUTHOR: Duane Wessels @@ -345,7 +345,7 @@ redirectFreeMemory(void) if (redirect_child_table) { for (k = 0; k < NRedirectors; k++) { if (redirect_child_table[k]->inbuf) - put_free_4k_page(redirect_child_table[k]->inbuf); + put_free_4k_page(redirect_child_table[k]->inbuf); safe_free(redirect_child_table[k]); } safe_free(redirect_child_table); diff --git a/src/squid.h b/src/squid.h index b96cfe9827..33c409751e 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.57 1996/09/20 06:29:06 wessels Exp $ + * $Id: squid.h,v 1.58 1996/10/09 15:34:36 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -132,7 +132,7 @@ #include #endif -#if __STDC__ +#ifdef __STDC__ #include #else #include diff --git a/src/stat.cc b/src/stat.cc index 8693cff7ee..77ccd751ca 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.78 1996/09/24 20:17:32 wessels Exp $ + * $Id: stat.cc,v 1.79 1996/10/09 15:34:37 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -667,7 +667,7 @@ static void info_get(cacheinfo * obj, StoreEntry * sentry) { char *tod = NULL; - float f; + time_t f; #if HAVE_MALLINFO int t; #endif diff --git a/src/stmem.cc b/src/stmem.cc index a6a4bf406f..baf45d593d 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -1,6 +1,6 @@ /* - * $Id: stmem.cc,v 1.28 1996/09/26 19:54:47 wessels Exp $ + * $Id: stmem.cc,v 1.29 1996/10/09 15:34:38 wessels Exp $ * * DEBUG: section 19 Memory Primitives * AUTHOR: Harvest Derived @@ -117,12 +117,16 @@ stmem_stats mem_obj_pool; #define USE_MEMALIGN 0 #endif -static void *get_free_thing _PARAMS((stmem_stats * thing)); -static void put_free_thing _PARAMS((stmem_stats * thing, void *p)); -static void stmemFreeThingMemory _PARAMS((stmem_stats * thing)); +static int memFreeDataUpto _PARAMS((mem_ptr, int)); +static int memAppend _PARAMS((mem_ptr, char *, int)); +static int memCopy _PARAMS((mem_ptr, int, char *, int)); +static void *get_free_thing _PARAMS((stmem_stats *)); +static void put_free_thing _PARAMS((stmem_stats *, void *)); +static void stmemFreeThingMemory _PARAMS((stmem_stats *)); +static void memFree _PARAMS((mem_ptr)); +static void memFreeData _PARAMS((mem_ptr)); - -void +static void memFree(mem_ptr mem) { mem_node lastp, p = mem->head; @@ -146,7 +150,7 @@ memFree(mem_ptr mem) safe_free(mem); } -void +static void memFreeData(mem_ptr mem) { mem_node lastp, p = mem->head; @@ -167,7 +171,7 @@ memFreeData(mem_ptr mem) mem->origin_offset = 0; } -int +static int memFreeDataUpto(mem_ptr mem, int target_offset) { int current_offset = mem->origin_offset; @@ -205,7 +209,7 @@ memFreeDataUpto(mem_ptr mem, int target_offset) /* Append incoming data. */ -int +static int memAppend(mem_ptr mem, char *data, int len) { mem_node p; @@ -249,7 +253,7 @@ memAppend(mem_ptr mem, char *data, int len) return len; } -int +static int memCopy(mem_ptr mem, int offset, char *buf, int size) { mem_node p = mem->head; diff --git a/src/store.cc b/src/store.cc index d886cf41e3..20135635fb 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.125 1996/10/08 14:48:37 wessels Exp $ + * $Id: store.cc,v 1.126 1996/10/09 15:34:39 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -202,32 +202,52 @@ struct storeRebuild_data { int store_rebuilding = STORE_REBUILDING_SLOW; /* Static Functions */ +static char *storeDescribeStatus _PARAMS((StoreEntry *)); +static char *storeSwapFullPath _PARAMS((int, char *)); +static HashID storeCreateHashTable _PARAMS((int (*)_PARAMS((char *, char *)))); +static hash_link *storeFindFirst _PARAMS((HashID)); +static hash_link *storeFindNext _PARAMS((HashID)); +static int compareLastRef _PARAMS((StoreEntry **, StoreEntry **)); +static int compareSize _PARAMS((StoreEntry **, StoreEntry **)); +static int storeAddSwapDisk _PARAMS((char *)); +static int storeCheckExpired _PARAMS((StoreEntry *)); +static int storeCheckPurgeMem _PARAMS((StoreEntry *)); +static int storeClientListSearch _PARAMS((MemObject *, int)); +static int storeCopy _PARAMS((StoreEntry *, int, int, char *, int *)); +static int storeEntryLocked _PARAMS((StoreEntry *)); +static int storeEntryValidLength _PARAMS((StoreEntry *)); +static int storeGetMemSpace _PARAMS((int)); +static int storeHashDelete _PARAMS((StoreEntry *)); +static int storeShouldPurgeMem _PARAMS((StoreEntry *)); +static int storeSwapInHandle _PARAMS((int, char *, int, int, StoreEntry *, int)); static int storeSwapInStart _PARAMS((StoreEntry *, SIH, void *)); +static int swapInError _PARAMS((int, StoreEntry *)); +static mem_ptr new_MemObjectData _PARAMS((void)); +static MemObject *new_MemObject _PARAMS((void)); +static StoreEntry *new_StoreEntry _PARAMS((int)); +static StoreEntry *storeAddDiskRestore _PARAMS((char *, int, int, time_t, time_t, time_t)); +static StoreEntry *storeGetInMemFirst _PARAMS((void)); +static StoreEntry *storeGetInMemNext _PARAMS((void)); +static unsigned int storeGetBucketNum _PARAMS((void)); static void destroy_MemObject _PARAMS((MemObject *)); static void destroy_MemObjectData _PARAMS((MemObject *)); static void destroy_StoreEntry _PARAMS((StoreEntry *)); -static MemObject *new_MemObject _PARAMS((void)); -static mem_ptr new_MemObjectData _PARAMS((void)); -static StoreEntry *new_StoreEntry _PARAMS((int mem_obj_flag)); -static int storeCheckPurgeMem _PARAMS((StoreEntry * e)); -static int storeCheckExpired _PARAMS((StoreEntry * e)); +static void storeClientListAdd _PARAMS((StoreEntry *, int, int)); +static void storeDeleteBehind _PARAMS((StoreEntry *)); +static void storePurgeMem _PARAMS((StoreEntry *)); +static void storeSanityCheck _PARAMS((void)); +static void storeSetMemStatus _PARAMS((StoreEntry *, mem_status_t)); +static void storeStartRebuildFromDisk _PARAMS((void)); static void storeSwapLog _PARAMS((StoreEntry *)); -static int storeHashDelete _PARAMS((StoreEntry *)); -static char *storeDescribeStatus _PARAMS((StoreEntry *)); -static int compareLastRef _PARAMS((StoreEntry ** e1, StoreEntry ** e2)); -static int compareSize _PARAMS((StoreEntry ** e1, StoreEntry ** e2)); -static int storeClientListSearch _PARAMS((MemObject *, int fd)); +static void storeSwapOutHandle _PARAMS((int, int, StoreEntry *)); static void storeHashMemInsert _PARAMS((StoreEntry *)); static void storeHashMemDelete _PARAMS((StoreEntry *)); -static int storeCopy _PARAMS((StoreEntry *, int, int, char *, int *)); -static int storeGetMemSpace _PARAMS((int size)); -static int storeShouldPurgeMem _PARAMS((StoreEntry * e)); /* Now, this table is inaccessible to outsider. They have to use a method * to access a value in internal storage data structure. */ -HashID store_table = 0; +static HashID store_table = 0; /* hash table for in-memory-only objects */ -HashID in_mem_table = 0; +static HashID in_mem_table = 0; /* current memory storage size */ static unsigned long store_mem_size = 0; @@ -249,7 +269,7 @@ static char swaplog_file[MAX_FILE_NAME_LEN]; static char tmp_filename[MAX_FILE_NAME_LEN]; /* patch cache_dir to accomodate multiple disk storage */ -char **CacheDirs = NULL; +static char **CacheDirs = NULL; static int CacheDirsAllocated = 0; int ncache_dirs = 0; @@ -357,7 +377,7 @@ destroy_MemObjectData(MemObject * mem) * objects in the memory. */ -HashID +static HashID storeCreateHashTable(int (*cmp_func) (char *, char *)) { store_table = hash_create(cmp_func, STORE_BUCKETS, hash_url); @@ -406,7 +426,7 @@ storeHashDelete(StoreEntry * e) * maintain the in-mem hash table according to the changes of mem_status * This routine replaces the instruction "e->store_status = status;" */ -void +static void storeSetMemStatus(StoreEntry * e, mem_status_t status) { if (e->key == NULL) { @@ -482,7 +502,7 @@ storeLog(int tag, StoreEntry * e) /* get rid of memory copy of the object */ /* Only call this if storeCheckPurgeMem(e) returns 1 */ -void +static void storePurgeMem(StoreEntry * e) { debug(20, 3, "storePurgeMem: Freeing memory-copy of %s\n", e->key); @@ -788,7 +808,7 @@ storeCreateEntry(char *url, /* Add a new object to the cache with empty memory copy and pointer to disk * use to rebuild store from disk. */ -StoreEntry * +static StoreEntry * storeAddDiskRestore(char *url, int file_number, int size, time_t expires, time_t timestamp, time_t lastmod) { StoreEntry *e = NULL; @@ -929,7 +949,7 @@ storeGetLowestReaderOffset(StoreEntry * entry) /* Call to delete behind upto "target lowest offset" * also, update e_lowest_offset */ -void +static void storeDeleteBehind(StoreEntry * e) { MemObject *mem = e->mem_obj; @@ -1030,7 +1050,7 @@ storeAppend(StoreEntry * e, char *data, int len) InvokeHandlers(e); } -#if __STDC__ +#ifdef __STDC__ void storeAppendPrintf(StoreEntry * e, char *fmt,...) { @@ -1057,7 +1077,7 @@ storeAppendPrintf(va_alist) } /* add directory to swap disk */ -int +static int storeAddSwapDisk(char *path) { char **tmp = NULL; @@ -1087,7 +1107,7 @@ swappath(int n) /* return full name to swapfile */ -char * +static char * storeSwapFullPath(int fn, char *fullpath) { LOCAL_ARRAY(char, fullfilename, MAX_FILE_NAME_LEN); @@ -1103,7 +1123,7 @@ storeSwapFullPath(int fn, char *fullpath) } /* swapping in handle */ -int +static int storeSwapInHandle(int fd_notused, char *buf, int len, int flag, StoreEntry * e, int offset_notused) { MemObject *mem = e->mem_obj; @@ -1239,7 +1259,7 @@ storeSwapLog(StoreEntry * e) xfree); } -void +static void storeSwapOutHandle(int fd, int flag, StoreEntry * e) { LOCAL_ARRAY(char, filename, MAX_FILE_NAME_LEN); @@ -1558,7 +1578,7 @@ storeRebuiltFromDisk(struct storeRebuild_data *data) swaplog_lock = file_write_lock(swaplog_fd); } -void +static void storeStartRebuildFromDisk(void) { struct stat sb; @@ -1760,7 +1780,7 @@ storeAbort(StoreEntry * e, char *msg) } /* get the first in memory object entry in the storage */ -hash_link * +static hash_link * storeFindFirst(HashID id) { if (id == (HashID) 0) @@ -1770,7 +1790,7 @@ storeFindFirst(HashID id) /* get the next in memory object entry in the storage for a given * search pointer */ -hash_link * +static hash_link * storeFindNext(HashID id) { if (id == (HashID) 0) @@ -1779,7 +1799,7 @@ storeFindNext(HashID id) } /* get the first in memory object entry in the storage */ -StoreEntry * +static StoreEntry * storeGetInMemFirst(void) { hash_link *first = NULL; @@ -1790,7 +1810,7 @@ storeGetInMemFirst(void) /* get the next in memory object entry in the storage for a given * search pointer */ -StoreEntry * +static StoreEntry * storeGetInMemNext(void) { hash_link *next = NULL; @@ -1953,7 +1973,7 @@ compareLastRef(StoreEntry ** e1, StoreEntry ** e2) /* returns the bucket number to work on, * pointer to next bucket after each calling */ -unsigned int +static unsigned int storeGetBucketNum(void) { static unsigned int bucket = 0; @@ -2199,7 +2219,7 @@ storeOriginalKey(StoreEntry * e) } /* return 1 if a store entry is locked */ -int +static int storeEntryLocked(StoreEntry * e) { if (e->lock_count) @@ -2281,7 +2301,7 @@ storeClientListSearch(MemObject * mem, int fd) } /* add client with fd to client list */ -void +static void storeClientListAdd(StoreEntry * e, int fd, int last_offset) { int i; @@ -2373,7 +2393,7 @@ storeEntryValidToSend(StoreEntry * e) return 1; /* STORE_PENDING, IN_MEMORY, exp=0 */ } -int +static int storeEntryValidLength(StoreEntry * e) { int diff; @@ -2548,7 +2568,7 @@ storeConfigure(void) * storeSanityCheck - verify that all swap storage areas exist, and * are writable; otherwise, force -z. */ -void +static void storeSanityCheck(void) { LOCAL_ARRAY(char, name, 4096); @@ -2724,7 +2744,7 @@ storeWriteCleanLog(void) return n; } -int +static int swapInError(int fd_unused, StoreEntry * entry) { squid_error_entry(entry, ERR_DISK_IO, xstrerror()); diff --git a/src/tools.cc b/src/tools.cc index 8e58b43a4b..e23570a1d6 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.66 1996/09/26 19:19:24 wessels Exp $ + * $Id: tools.cc,v 1.67 1996/10/09 15:34:41 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -120,6 +120,9 @@ and report the trace back to squid-bugs@nlanr.net.\n\ \n\ Thanks!\n" +static void fatal_common _PARAMS((char *)); +static void mail_warranty _PARAMS((void)); + static char * dead_msg(void) { @@ -128,7 +131,7 @@ dead_msg(void) return msg; } -void +static void mail_warranty(void) { FILE *fp = NULL; @@ -310,7 +313,7 @@ normal_shutdown(void) exit(0); } -void +static void fatal_common(char *message) { #if HAVE_SYSLOG diff --git a/src/url.cc b/src/url.cc index 4e8f29732f..d52ce8259d 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.34 1996/09/17 02:30:07 wessels Exp $ + * $Id: url.cc,v 1.35 1996/10/09 15:34:41 wessels Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -41,7 +41,7 @@ char *RequestMethodStr[] = "CONNECT" }; -char *ProtocolStr[] = +static char *ProtocolStr[] = { "NONE", "http", @@ -54,6 +54,7 @@ char *ProtocolStr[] = static int url_acceptable[256]; static char hex[17] = "0123456789abcdef"; +static int urlDefaultPort _PARAMS((protocol_t p)); /* convert %xx in url string to a character * Allocate a new string and return a pointer to converted string */ @@ -166,7 +167,7 @@ urlParseProtocol(char *s) } -int +static int urlDefaultPort(protocol_t p) { switch (p) {