From: hno <> Date: Thu, 8 Feb 2001 01:56:50 +0000 (+0000) Subject: Cleaned up the namespace (local functions made static) X-Git-Tag: SQUID_3_0_PRE1~1612 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d72d4fd6db89d02d89d59d9e4d9efb23ad26dbc;p=thirdparty%2Fsquid.git Cleaned up the namespace (local functions made static) --- diff --git a/include/Array.h b/include/Array.h index e2162e57bd..ac87defa5a 100644 --- a/include/Array.h +++ b/include/Array.h @@ -1,5 +1,5 @@ /* - * $Id: Array.h,v 1.4 2001/01/12 00:37:12 wessels Exp $ + * $Id: Array.h,v 1.5 2001/02/07 18:56:50 hno Exp $ * * AUTHOR: Alex Rousskov * @@ -43,7 +43,7 @@ typedef struct { } Array; -extern Array *arrayCreate(); +extern Array *arrayCreate(void); extern void arrayInit(Array * s); extern void arrayClean(Array * s); extern void arrayDestroy(Array * s); diff --git a/include/util.h b/include/util.h index a34f5d5c53..c76386a4d2 100644 --- a/include/util.h +++ b/include/util.h @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.58 2001/01/12 00:37:12 wessels Exp $ + * $Id: util.h,v 1.59 2001/02/07 18:56:50 hno Exp $ * * AUTHOR: Harvest Derived * @@ -127,4 +127,9 @@ extern const char *xitoa(int num); double drand48(void); #endif +/* + * Returns the amount of known allocated memory + */ +int statMemoryAccounted(void); + #endif /* ndef _UTIL_H_ */ diff --git a/lib/Array.cc b/lib/Array.cc index 470999855e..2a3024e599 100644 --- a/lib/Array.cc +++ b/lib/Array.cc @@ -1,5 +1,5 @@ /* - * $Id: Array.cc,v 1.6 2001/01/12 00:37:12 wessels Exp $ + * $Id: Array.cc,v 1.7 2001/02/07 18:56:50 hno Exp $ * * AUTHOR: Alex Rousskov * @@ -41,6 +41,8 @@ #include "config.h" +#include "Array.h" + #if HAVE_ASSERT_H #include #endif @@ -53,7 +55,7 @@ static void arrayGrow(Array * a, int min_capacity); Array * -arrayCreate() +arrayCreate(void) { Array *a = xmalloc(sizeof(Array)); arrayInit(a); diff --git a/lib/base64.c b/lib/base64.c index 75c46d458f..042d34fd07 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -1,8 +1,9 @@ /* - * $Id: base64.c,v 1.17 2001/01/07 23:36:36 hno Exp $ + * $Id: base64.c,v 1.18 2001/02/07 18:56:50 hno Exp $ */ #include "config.h" +#include "util.h" #if HAVE_STDIO_H #include @@ -11,6 +12,7 @@ #include #endif + static void base64_init(void); static int base64_initialized = 0; diff --git a/lib/heap.c b/lib/heap.c index 746d7ae238..1c62db91b7 100644 --- a/lib/heap.c +++ b/lib/heap.c @@ -1,6 +1,6 @@ /* - * $Id: heap.c,v 1.7 2001/01/12 00:37:12 wessels Exp $ + * $Id: heap.c,v 1.8 2001/02/07 18:56:50 hno Exp $ * * AUTHOR: John Dilley, Hewlett Packard * @@ -38,6 +38,7 @@ ****************************************************************************/ #include "config.h" +#include "heap.h" #if HAVE_STDLIB_H #include @@ -482,7 +483,7 @@ _heap_node_exist(heap * hp, int id) /* * Print the heap in element order, id..last. */ -void +static void heap_print_inorder(heap * hp, int id) { while (id < hp->last) { diff --git a/lib/iso3307.c b/lib/iso3307.c index 83191ea407..2b5f764eb6 100644 --- a/lib/iso3307.c +++ b/lib/iso3307.c @@ -1,8 +1,9 @@ /* - * $Id: iso3307.c,v 1.4 1998/09/23 17:16:11 wessels Exp $ + * $Id: iso3307.c,v 1.5 2001/02/07 18:56:50 hno Exp $ */ #include "config.h" +#include "util.h" #if HAVE_STDIO_H #include diff --git a/lib/ntlmauth.c b/lib/ntlmauth.c index 5158798a4a..bb0a98da87 100644 --- a/lib/ntlmauth.c +++ b/lib/ntlmauth.c @@ -1,5 +1,5 @@ /* - * $Id: ntlmauth.c,v 1.1 2001/01/07 23:36:36 hno Exp $ + * $Id: ntlmauth.c,v 1.2 2001/02/07 18:56:50 hno Exp $ * * * * * * * * * Legal stuff * * * * * * * * @@ -24,6 +24,7 @@ #include "ntlmauth.h" #include "util.h" /* for base64-related stuff */ +#if UNUSED_CODE /* Dumps NTLM flags to standard error for debugging purposes */ void ntlm_dump_ntlmssp_flags(u_int32_t flags) @@ -50,6 +51,7 @@ ntlm_dump_ntlmssp_flags(u_int32_t flags) (flags & REQUEST_NON_NT_SESSION_KEY ? "Req_nonnt_sesskey " : "") ); } +#endif #define lstring_zero(s) s.str=NULL; s.l=-1; diff --git a/lib/radix.c b/lib/radix.c index 59aaa604cd..e071107014 100644 --- a/lib/radix.c +++ b/lib/radix.c @@ -1,5 +1,5 @@ /* - * $Id: radix.c,v 1.11 2001/01/12 00:37:12 wessels Exp $ + * $Id: radix.c,v 1.12 2001/02/07 18:56:50 hno Exp $ * * DEBUG: section 53 Radix tree data structure implementation * AUTHOR: NetBSD Derived @@ -69,6 +69,7 @@ */ #include "config.h" +#include "radix.h" #if HAVE_UNISTD_H #include @@ -220,7 +221,7 @@ rn_refines(m_arg, n_arg) return (!masks_are_equal); } -struct radix_node * +static struct radix_node * rn_lookup(v_arg, m_arg, head) void *v_arg, *m_arg; struct radix_node_head *head; diff --git a/lib/rfc1035.c b/lib/rfc1035.c index dcd6b1ac6f..f74b6ecb24 100644 --- a/lib/rfc1035.c +++ b/lib/rfc1035.c @@ -1,6 +1,6 @@ /* - * $Id: rfc1035.c,v 1.20 2001/01/12 00:37:12 wessels Exp $ + * $Id: rfc1035.c,v 1.21 2001/02/07 18:56:50 hno Exp $ * * Low level DNS protocol routines * AUTHOR: Duane Wessels @@ -174,7 +174,7 @@ rfc1035LabelPack(char *buf, size_t sz, const char *label) * Note message compression is not supported here. * Returns number of octets packed. */ -off_t +static off_t rfc1035NamePack(char *buf, size_t sz, const char *name) { off_t off = 0; @@ -423,7 +423,7 @@ rfc1035AnswersUnpack(const char *buf, rfc1035_rr ** records, unsigned short *id) { - off_t off = 0; + size_t off = 0; int l; int i; int nr = 0; @@ -482,7 +482,7 @@ unsigned short rfc1035BuildAQuery(const char *hostname, char *buf, size_t * szp) { static rfc1035_header h; - off_t offset = 0; + size_t offset = 0; size_t sz = *szp; memset(&h, '\0', sizeof(h)); /* the first char of hostname must be alphanmeric */ @@ -520,7 +520,7 @@ unsigned short rfc1035BuildPTRQuery(const struct in_addr addr, char *buf, size_t * szp) { static rfc1035_header h; - off_t offset = 0; + size_t offset = 0; size_t sz = *szp; static char rev[32]; unsigned int i; @@ -543,7 +543,7 @@ rfc1035BuildPTRQuery(const struct in_addr addr, char *buf, size_t * szp) RFC1035_TYPE_PTR, RFC1035_CLASS_IN); assert(offset <= sz); - *szp = (size_t) offset; + *szp = offset; return h.id; } diff --git a/lib/rfc1738.c b/lib/rfc1738.c index b1e3b1f073..9a2d429e63 100644 --- a/lib/rfc1738.c +++ b/lib/rfc1738.c @@ -1,5 +1,5 @@ /* - * $Id: rfc1738.c,v 1.22 2001/01/12 00:37:13 wessels Exp $ + * $Id: rfc1738.c,v 1.23 2001/02/07 18:56:51 hno Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -92,7 +92,7 @@ rfc1738_do_escape(const char *url, int encode_reserved) static size_t bufsize = 0; const char *p; char *q; - int i, do_escape; + unsigned int i, do_escape; if (buf == NULL || strlen(url) * 3 > bufsize) { xfree(buf); diff --git a/lib/safe_inet_addr.c b/lib/safe_inet_addr.c index 1d0756a8cd..04a042e246 100644 --- a/lib/safe_inet_addr.c +++ b/lib/safe_inet_addr.c @@ -1,9 +1,10 @@ /* - * $Id: safe_inet_addr.c,v 1.11 1999/05/04 21:20:41 wessels Exp $ + * $Id: safe_inet_addr.c,v 1.12 2001/02/07 18:56:51 hno Exp $ */ #include "config.h" +#include "util.h" #if HAVE_STDIO_H #include diff --git a/lib/stub_memaccount.c b/lib/stub_memaccount.c index d576dbce2c..3f3b4f4f19 100644 --- a/lib/stub_memaccount.c +++ b/lib/stub_memaccount.c @@ -1,9 +1,10 @@ /* - * $Id: stub_memaccount.c,v 1.4 1999/05/04 21:20:42 wessels Exp $ + * $Id: stub_memaccount.c,v 1.5 2001/02/07 18:56:51 hno Exp $ */ /* Stub function for programs not implementing statMemoryAccounted */ -#include +#include "config.h" +#include "util.h" int statMemoryAccounted(void) { diff --git a/src/HttpHdrRange.cc b/src/HttpHdrRange.cc index 9950ab920f..d969670220 100644 --- a/src/HttpHdrRange.cc +++ b/src/HttpHdrRange.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrRange.cc,v 1.24 2001/01/12 00:37:13 wessels Exp $ + * $Id: HttpHdrRange.cc,v 1.25 2001/02/07 18:56:51 hno Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -208,7 +208,7 @@ httpHdrRangeSpecMergeWith(HttpHdrRangeSpec * recep, const HttpHdrRangeSpec * don * Range */ -HttpHdrRange * +static HttpHdrRange * httpHdrRangeCreate(void) { HttpHdrRange *r = memAllocate(MEM_HTTP_HDR_RANGE); diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 41edef9c0a..1063688b3d 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.cc,v 1.30 2001/01/12 00:37:14 wessels Exp $ + * $Id: HttpHeaderTools.cc,v 1.31 2001/02/07 18:56:51 hno Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -35,7 +35,9 @@ #include "squid.h" +#if UNUSED_CODE static int httpHeaderStrCmp(const char *h1, const char *h2, int len); +#endif static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs); @@ -312,6 +314,7 @@ httpHeaderParseSize(const char *start, ssize_t * value) * parses a given string then packs compiled headers and compares the result * with the original, reports discrepancies */ +#if UNUSED_CODE void httpHeaderTestParser(const char *hstr) { @@ -362,9 +365,11 @@ httpHeaderTestParser(const char *hstr) packerClean(&p); memBufClean(&mb); } +#endif /* like strncasecmp but ignores ws characters */ +#if UNUSED_CODE static int httpHeaderStrCmp(const char *h1, const char *h2, int len) { @@ -391,12 +396,13 @@ httpHeaderStrCmp(const char *h1, const char *h2, int len) /* NOTREACHED */ return 0; } +#endif /* * httpHdrMangle checks the anonymizer (header_access) configuration. * Returns 1 if the header is allowed. */ -int +static int httpHdrMangle(HttpHeaderEntry * e, request_t * request) { int retval; diff --git a/src/access_log.cc b/src/access_log.cc index 97876506d5..e30cc9f556 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.66 2001/01/12 00:37:14 wessels Exp $ + * $Id: access_log.cc,v 1.67 2001/02/07 18:56:51 hno Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -182,7 +182,7 @@ log_quote(const char *header) return buf; } -char * +static char * username_quote(const char *header) /* copy of log_quote. Bugs there will be found here */ { @@ -223,7 +223,7 @@ username_quote(const char *header) return buf; } -char * +static char * accessLogFormatName(const char *name) { if (NULL == name) diff --git a/src/acl.cc b/src/acl.cc index 79c5ed8dfb..473b50cc90 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.245 2001/02/01 18:47:46 hno Exp $ + * $Id: acl.cc,v 1.246 2001/02/07 18:56:51 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -43,7 +43,9 @@ static void aclParseDomainList(void *curlist); static void aclParseUserList(void **current); static void aclParseIpList(void *curlist); static void aclParseIntlist(void *curlist); +#if SQUID_SNMP static void aclParseWordList(void *curlist); +#endif static void aclParseProtoList(void *curlist); static void aclParseMethodList(void *curlist); static void aclParseTimeSpec(void *curlist); @@ -629,6 +631,7 @@ aclParseRegexList(void *curlist) } } +#if SQUID_SNMP static void aclParseWordList(void *curlist) { @@ -636,6 +639,7 @@ aclParseWordList(void *curlist) while ((t = strtokFile())) wordlistAdd(curlist, t); } +#endif static void aclParseUserList(void **current) @@ -2198,7 +2202,7 @@ aclDumpUserListWalkee(void *node_data, void *outlist) wordlistAdd(outlist, node_data); } -wordlist * +static wordlist * aclDumpUserList(acl_user_data * data) { wordlist *wl = NULL; diff --git a/src/asn.cc b/src/asn.cc index 4eaf5f95e3..69380c9541 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.68 2001/01/12 00:37:14 wessels Exp $ + * $Id: asn.cc,v 1.69 2001/02/07 18:56:51 hno Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -410,7 +410,7 @@ destroyRadixNodeInfo(as_info * e_info) xfree(data); } -int +static int mask_len(int mask) { int len = 32; diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index 82ed246c39..d3081dccd5 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -1,6 +1,6 @@ /* - * $Id: auth_basic.cc,v 1.5 2001/01/31 22:16:40 hno Exp $ + * $Id: auth_basic.cc,v 1.6 2001/02/07 18:56:53 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -74,29 +74,14 @@ static auth_basic_config *basicConfig = NULL; static int authbasic_initialised = 0; MemPool *basic_data_pool = NULL; + /* * - * Private Functions + * Public Functions * */ -void -authBasicDone(void) -{ - if (basicauthenticators) - helperShutdown(basicauthenticators); - authbasic_initialised = 0; - if (!shutting_down) - return; - if (basicauthenticators) - helperFree(basicauthenticators); - basicauthenticators = NULL; - if (basic_data_pool) { - memPoolDestroy(basic_data_pool); - basic_data_pool = NULL; - } - debug(29, 2) ("authBasicDone: Basic authentication Shutdown.\n"); -} +AUTHSSETUP authSchemeSetup_basic; void authSchemeSetup_basic(authscheme_entry_t * authscheme) @@ -121,13 +106,33 @@ authSchemeSetup_basic(authscheme_entry_t * authscheme) authscheme->donefunc = authBasicDone; } -int +/* internal functions */ + +static void +authBasicDone(void) +{ + if (basicauthenticators) + helperShutdown(basicauthenticators); + authbasic_initialised = 0; + if (!shutting_down) + return; + if (basicauthenticators) + helperFree(basicauthenticators); + basicauthenticators = NULL; + if (basic_data_pool) { + memPoolDestroy(basic_data_pool); + basic_data_pool = NULL; + } + debug(29, 2) ("authBasicDone: Basic authentication Shutdown.\n"); +} + +static int authenticateBasicActive() { return (authbasic_initialised == 1) ? 1 : 0; } -int +static int authBasicConfigured() { if ((basicConfig != NULL) && (basicConfig->authenticate != NULL) && @@ -140,7 +145,7 @@ authBasicConfigured() return 0; } -int +static int authenticateBasicAuthenticated(auth_user_request_t * auth_user_request) { basic_data *basic_auth = auth_user_request->auth_user->scheme_data; @@ -150,11 +155,13 @@ authenticateBasicAuthenticated(auth_user_request_t * auth_user_request) return 0; } -int +#if UNUSED_CODE +static int authenticateBasiccmpUsername(basic_data * u1, basic_data * u2) { return strcmp(u1->username, u2->username); } +#endif /* log a basic user in */ @@ -354,7 +361,7 @@ authenticateBasicUsername(auth_user_t * auth_user) return NULL; } -basic_data * +static basic_data * authBasicDataNew() { basic_data *temp; @@ -366,12 +373,14 @@ authBasicDataNew() return temp; } -void +#if UNUSED_CODE +static void authBasicDataFree(basic_data * basic_auth) { } +#endif -auth_user_t * +static auth_user_t * authBasicAuthUserFindUsername(const char *username) { auth_user_hash_pointer *usernamehash; diff --git a/src/authenticate.cc b/src/authenticate.cc index ebd57c9ed3..ea0d610b30 100644 --- a/src/authenticate.cc +++ b/src/authenticate.cc @@ -1,6 +1,6 @@ /* - * $Id: authenticate.cc,v 1.20 2001/01/31 22:16:38 hno Exp $ + * $Id: authenticate.cc,v 1.21 2001/02/07 18:56:51 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -54,7 +54,7 @@ MemPool *auth_user_request_pool = NULL; /* Generic Functions */ -int +static int authenticateAuthSchemeConfigured(const char *proxy_auth) { authScheme *scheme; @@ -177,8 +177,8 @@ authenticateAuthUserNew(const char *scheme) return temp_auth; } -auth_user_request_t * -authenticateAuthUserRequestNew() +static auth_user_request_t * +authenticateAuthUserRequestNew(void) { auth_user_request_t *temp_request; if (!auth_user_request_pool) @@ -192,7 +192,7 @@ authenticateAuthUserRequestNew() return temp_request; } -void +static void authenticateAuthUserRequestFree(auth_user_request_t * auth_user_request) { dlink_node *link; @@ -322,7 +322,7 @@ authenticateDirection(auth_user_request_t * auth_user_request) } int -authenticateActiveSchemeCount() +authenticateActiveSchemeCount(void) { int i = 0, rv = 0; for (i = 0; authscheme_list && authscheme_list[i].typestr; i++) @@ -333,7 +333,7 @@ authenticateActiveSchemeCount() } int -authenticateSchemeCount() +authenticateSchemeCount(void) { int i = 0, rv = 0; for (i = 0; authscheme_list && authscheme_list[i].typestr; i++) @@ -562,7 +562,7 @@ authenticateFreeProxyAuthUser(void *data) } void -authenticateInitUserCache() +authenticateInitUserCache(void) { if (!proxy_auth_username_cache) { /* First time around, 7921 should be big enough */ @@ -613,7 +613,7 @@ authenticateProxyUserCacheCleanup(void *datanotused) */ void -authenticateUserCacheRestart() +authenticateUserCacheRestart(void) { auth_user_hash_pointer *usernamehash; auth_user_t *auth_user; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 0eef05ef42..6c00e90f3e 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.373 2001/01/30 09:46:46 hno Exp $ + * $Id: cache_cf.cc,v 1.374 2001/02/07 18:56:51 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -388,23 +388,23 @@ configDoConfigure(void) Config2.onoff.enable_purge = 1; if (geteuid() == 0) { if (NULL != Config.effectiveUser) { - struct passwd *pwd = getpwnam(Config.effectiveUser); - if (NULL == pwd) - /* - * Andres Kroonmaa : - * Some getpwnam() implementations (Solaris?) require - * an available FD < 256 for opening a FILE* to the - * passwd file. - * DW: - * This should be safe at startup, but might still fail - * during reconfigure. - */ - fatalf("getpwnam failed to find userid for effective user '%s'", - Config.effectiveUser, - xstrerror()); - Config2.effectiveUserID = pwd->pw_uid; + struct passwd *pwd = getpwnam(Config.effectiveUser); + if (NULL == pwd) + /* + * Andres Kroonmaa : + * Some getpwnam() implementations (Solaris?) require + * an available FD < 256 for opening a FILE* to the + * passwd file. + * DW: + * This should be safe at startup, but might still fail + * during reconfigure. + */ + fatalf("getpwnam failed to find userid for effective user '%s'", + Config.effectiveUser, + xstrerror()); + Config2.effectiveUserID = pwd->pw_uid; Config2.effectiveGroupID = pwd->pw_gid; - } + } } else { Config2.effectiveUserID = geteuid(); Config2.effectiveGroupID = getegid(); @@ -916,7 +916,7 @@ check_null_string(char *s) return s == NULL; } -void +static void allocate_new_authScheme(authConfig * cfg) { if (cfg->schemes == NULL) { @@ -1115,7 +1115,7 @@ free_cachedir(cacheSwap * swap) swap->n_configured = 0; } -const char * +static const char * peer_type_str(const peer_t type) { switch (type) { @@ -1702,9 +1702,9 @@ parse_eol(char *volatile *var) unsigned char *token = strtok(NULL, null_string); safe_free(*var); if (token == NULL) - self_destruct(); - while(*token && isspace(*token)) - token++; + self_destruct(); + while (*token && isspace(*token)) + token++; if (!*token) self_destruct(); *var = xstrdup(token); diff --git a/src/client_side.cc b/src/client_side.cc index 38e329a15b..db7cf1f742 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.523 2001/01/12 00:37:15 wessels Exp $ + * $Id: client_side.cc,v 1.524 2001/02/07 18:56:52 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -633,7 +633,7 @@ checkNegativeHit(StoreEntry * e) return 1; } -void +static void clientUpdateCounters(clientHttpRequest * http) { int svc_time = tvSubMsec(http->start, current_time); @@ -2863,7 +2863,7 @@ clientProcessBody(ConnStateData * conn) /* A dummy handler that throws away a request-body */ static char bodyAbortBuf[SQUID_TCP_SO_RCVBUF]; -void +static void clientReadBodyAbortHandler(char *buf, size_t size, void *data) { ConnStateData *conn = (ConnStateData *) data; diff --git a/src/debug.cc b/src/debug.cc index 10e81604cb..649607df1a 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,6 +1,6 @@ /* - * $Id: debug.cc,v 1.80 2001/01/12 00:37:16 wessels Exp $ + * $Id: debug.cc,v 1.81 2001/02/07 18:56:52 hno Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -38,7 +38,7 @@ static char *debug_log_file = NULL; static int Ctx_Lock = 0; static const char *debugLogTime(time_t); -static void ctx_print(); +static void ctx_print(void); #if STDC_HEADERS void diff --git a/src/fs/aufs/store_dir_aufs.cc b/src/fs/aufs/store_dir_aufs.cc index de0c5da78f..f78edf9d50 100644 --- a/src/fs/aufs/store_dir_aufs.cc +++ b/src/fs/aufs/store_dir_aufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.28 2001/01/12 00:37:32 wessels Exp $ + * $Id: store_dir_aufs.cc,v 1.29 2001/02/07 18:56:53 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -118,6 +118,9 @@ static void storeAufsDirStats(SwapDir *, StoreEntry *); static void storeAufsDirInitBitmap(SwapDir *); static int storeAufsDirValidFileno(SwapDir *, sfileno, int); +/* The MAIN externally visible function */ +STSETUP storeFsSetup_aufs; + /* * These functions were ripped straight out of the heart of store_dir.c. * They assume that the given filenum is on a asyncufs partiton, which may or @@ -125,7 +128,7 @@ static int storeAufsDirValidFileno(SwapDir *, sfileno, int); * XXX this evilness should be tidied up at a later date! */ -int +static int storeAufsDirMapBitTest(SwapDir * SD, int fn) { sfileno filn = fn; @@ -134,7 +137,7 @@ storeAufsDirMapBitTest(SwapDir * SD, int fn) return file_map_bit_test(aioinfo->map, filn); } -void +static void storeAufsDirMapBitSet(SwapDir * SD, int fn) { sfileno filn = fn; @@ -1493,7 +1496,7 @@ storeAufsDirStats(SwapDir * SD, StoreEntry * sentry) * * This routine is called when the given swapdir needs reconfiguring */ -void +static void storeAufsDirReconfigure(SwapDir * sd, int index, char *path) { char *token; @@ -1615,7 +1618,7 @@ storeAufsCleanupDoubleCheck(SwapDir * sd, StoreEntry * e) * storeAufsDirParse * * Called when a *new* fs is being setup. */ -void +static void storeAufsDirParse(SwapDir * sd, int index, char *path) { char *token; @@ -1688,7 +1691,7 @@ storeAufsDirParse(SwapDir * sd, int index, char *path) /* * Initial setup / end destruction */ -void +static void storeAufsDirDone(void) { aioDone(); diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index ac08b6b6e5..9306de2e25 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.17 2001/01/12 00:37:32 wessels Exp $ + * $Id: store_dir_coss.cc,v 1.18 2001/02/07 18:56:54 hno Exp $ * * DEBUG: section 81 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -87,6 +87,9 @@ static STFSPARSE storeCossDirParse; static STFSRECONFIGURE storeCossDirReconfigure; static STDUMP storeCossDirDump; +/* The "only" externally visible function */ +STSETUP storeFsSetup_coss; + static char * storeCossDirSwapLogFile(SwapDir * sd, const char *ext) { @@ -679,7 +682,7 @@ storeCossDirCheckObj(SwapDir * SD, const StoreEntry * e) /* ========== LOCAL FUNCTIONS ABOVE, GLOBAL FUNCTIONS BELOW ========== */ -void +static void storeCossDirStats(SwapDir * SD, StoreEntry * sentry) { CossInfo *cs = (CossInfo *) SD->fsdata; diff --git a/src/fs/diskd/diskd.cc b/src/fs/diskd/diskd.cc index 3abb27f54d..95ce34b8d0 100644 --- a/src/fs/diskd/diskd.cc +++ b/src/fs/diskd/diskd.cc @@ -1,5 +1,5 @@ /* - * $Id: diskd.cc,v 1.9 2001/01/12 00:37:33 wessels Exp $ + * $Id: diskd.cc,v 1.10 2001/02/07 18:56:54 hno Exp $ * * DEBUG: section -- External DISKD process implementation. * AUTHOR: Harvest Derived @@ -248,7 +248,7 @@ msg_handle(diomsg * r, int rl, diomsg * s) } } -int +static int fsCmp(const void *a, const void *b) { const int *A = a; @@ -256,7 +256,7 @@ fsCmp(const void *a, const void *b) return *A != *B; } -unsigned int +static unsigned int fsHash(const void *key, unsigned int n) { /* note, n must be a power of 2! */ diff --git a/src/fs/diskd/store_dir_diskd.cc b/src/fs/diskd/store_dir_diskd.cc index 1a93f51f81..ef15255e14 100644 --- a/src/fs/diskd/store_dir_diskd.cc +++ b/src/fs/diskd/store_dir_diskd.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.38 2001/01/23 17:27:21 wessels Exp $ + * $Id: store_dir_diskd.cc,v 1.39 2001/02/07 18:56:54 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -128,6 +128,8 @@ static int storeDiskdDirValidFileno(SwapDir *, sfileno, int); static void storeDiskdStats(StoreEntry * sentry); static void storeDiskdDirSync(SwapDir *); +/* The only externally visible interface */ +STSETUP storeFsSetup_diskd; /* * These functions were ripped straight out of the heart of store_dir.c. @@ -136,7 +138,7 @@ static void storeDiskdDirSync(SwapDir *); * XXX this evilness should be tidied up at a later date! */ -int +static int storeDiskdDirMapBitTest(SwapDir * SD, int fn) { sfileno filn = fn; @@ -145,7 +147,7 @@ storeDiskdDirMapBitTest(SwapDir * SD, int fn) return file_map_bit_test(diskdinfo->map, filn); } -void +static void storeDiskdDirMapBitSet(SwapDir * SD, int fn) { sfileno filn = fn; @@ -1710,7 +1712,7 @@ storeDiskdDirStats(SwapDir * SD, StoreEntry * sentry) * * This routine is called when the given swapdir needs reconfiguring */ -void +static void storeDiskdDirReconfigure(SwapDir * sd, int index, char *path) { char *token; @@ -1847,7 +1849,7 @@ storeDiskdCleanupDoubleCheck(SwapDir * sd, StoreEntry * e) * * Called when a *new* fs is being setup. */ -void +static void storeDiskdDirParse(SwapDir * sd, int index, char *path) { char *token; @@ -1929,7 +1931,7 @@ storeDiskdDirParse(SwapDir * sd, int index, char *path) /* * Initial setup / end destruction */ -void +static void storeDiskdDirDone(void) { memPoolDestroy(diskd_state_pool); diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index c2af806cdd..df7d21de89 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.27 2001/01/12 00:37:34 wessels Exp $ + * $Id: store_dir_ufs.cc,v 1.28 2001/02/07 18:56:55 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -116,6 +116,8 @@ static void storeUfsDirStats(SwapDir *, StoreEntry *); static void storeUfsDirInitBitmap(SwapDir *); static int storeUfsDirValidFileno(SwapDir *, sfileno, int); +STSETUP storeFsSetup_ufs; + /* * These functions were ripped straight out of the heart of store_dir.c. * They assume that the given filenum is on a ufs partiton, which may or @@ -123,7 +125,7 @@ static int storeUfsDirValidFileno(SwapDir *, sfileno, int); * XXX this evilness should be tidied up at a later date! */ -int +static int storeUfsDirMapBitTest(SwapDir * SD, int fn) { sfileno filn = fn; @@ -132,7 +134,7 @@ storeUfsDirMapBitTest(SwapDir * SD, int fn) return file_map_bit_test(ufsinfo->map, filn); } -void +static void storeUfsDirMapBitSet(SwapDir * SD, int fn) { sfileno filn = fn; @@ -1486,7 +1488,7 @@ storeUfsDirStats(SwapDir * SD, StoreEntry * sentry) * * This routine is called when the given swapdir needs reconfiguring */ -void +static void storeUfsDirReconfigure(SwapDir * sd, int index, char *path) { char *token; @@ -1610,7 +1612,7 @@ storeUfsCleanupDoubleCheck(SwapDir * sd, StoreEntry * e) * * Called when a *new* fs is being setup. */ -void +static void storeUfsDirParse(SwapDir * sd, int index, char *path) { char *token; @@ -1683,7 +1685,7 @@ storeUfsDirParse(SwapDir * sd, int index, char *path) /* * Initial setup / end destruction */ -void +static void storeUfsDirDone(void) { memPoolDestroy(ufs_state_pool); diff --git a/src/peer_digest.cc b/src/peer_digest.cc index 8d44da084f..aad9bbea76 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.cc,v 1.77 2001/01/12 00:37:20 wessels Exp $ + * $Id: peer_digest.cc,v 1.78 2001/02/07 18:56:52 hno Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -115,7 +115,7 @@ peerDigestCreate(peer * p) } /* call Clean and free/unlock everything */ -void +static void peerDigestDestroy(PeerDigest * pd) { peer *p; diff --git a/src/peer_select.cc b/src/peer_select.cc index 054791fea3..91687ce6d9 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.112 2001/01/12 00:37:20 wessels Exp $ + * $Id: peer_select.cc,v 1.113 2001/02/07 18:56:52 hno Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -109,7 +109,7 @@ peerSelectStateFree(ps_state * psstate) cbdataFree(psstate); } -int +static int peerSelectIcpPing(request_t * request, int direct, StoreEntry * entry) { int n; diff --git a/src/protos.h b/src/protos.h index 828b9dfa2e..ccc28a8d24 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.396 2001/01/12 00:37:20 wessels Exp $ + * $Id: protos.h,v 1.397 2001/02/07 18:56:52 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -178,7 +178,7 @@ extern int comm_select(int); #endif extern void commUpdateReadBits(int, PF *); extern void commUpdateWriteBits(int, PF *); -extern void comm_quick_poll_required(); +extern void comm_quick_poll_required(void); extern void packerToStoreInit(Packer * p, StoreEntry * e); extern void packerToMemInit(Packer * p, MemBuf * mb); @@ -743,13 +743,13 @@ extern int authenticateDirection(auth_user_request_t *); extern FREE authenticateFreeProxyAuthUser; extern void authenticateFreeProxyAuthUserACLResults(void *data); extern void authenticateProxyUserCacheCleanup(void *); -extern void authenticateInitUserCache(); -extern int authenticateActiveSchemeCount(); -extern int authenticateSchemeCount(); +extern void authenticateInitUserCache(void); +extern int authenticateActiveSchemeCount(void); +extern int authenticateSchemeCount(void); extern void authenticateUserNameCacheAdd(auth_user_t * auth_user); extern int authenticateCheckAuthUserIP(struct in_addr request_src_addr, auth_user_request_t * auth_user); extern int authenticateUserAuthenticated(auth_user_request_t *); -extern void authenticateUserCacheRestart(); +extern void authenticateUserCacheRestart(void); extern char *authenticateUserUsername(auth_user_t *); extern char *authenticateUserRequestUsername(auth_user_request_t *); extern int authenticateValidateUser(auth_user_request_t *); @@ -1094,7 +1094,7 @@ extern int urlCheckRequest(const request_t *); extern int urlDefaultPort(protocol_t p); extern char *urlCanonicalClean(const request_t *); extern char *urlHostname(const char *url); -extern void urlExtMethodConfigure(); +extern void urlExtMethodConfigure(void); extern void useragentOpenLog(void); extern void useragentRotateLog(void); @@ -1126,7 +1126,7 @@ extern void dlinkAdd(void *data, dlink_node *, dlink_list *); extern void dlinkAddTail(void *data, dlink_node *, dlink_list *); extern void dlinkDelete(dlink_node * m, dlink_list * list); extern void dlinkNodeDelete(dlink_node * m); -extern dlink_node *dlinkNodeNew(); +extern dlink_node *dlinkNodeNew(void); extern void kb_incr(kb_t *, size_t); extern double gb_to_double(const gb_t *); @@ -1286,3 +1286,8 @@ extern int gethostname(char *, int); #if URL_CHECKSUM_DEBUG extern unsigned int url_checksum(const char *url); #endif + +/* + * hack to allow snmp access to the statistics counters + */ +extern StatCounters *snmpStatGet(int); diff --git a/src/repl/heap/store_heap_replacement.cc b/src/repl/heap/store_heap_replacement.cc index 8710dbb0fe..7f5aa7494f 100644 --- a/src/repl/heap/store_heap_replacement.cc +++ b/src/repl/heap/store_heap_replacement.cc @@ -1,6 +1,6 @@ /* - * $Id: store_heap_replacement.cc,v 1.5 2001/01/12 00:37:35 wessels Exp $ + * $Id: store_heap_replacement.cc,v 1.6 2001/02/07 18:56:56 hno Exp $ * * DEBUG: section 20 Storage Manager Heap-based replacement * AUTHOR: John Dilley @@ -43,6 +43,7 @@ #include "squid.h" #include "heap.h" +#include "store_heap_replacement.h" /* * Key generation function to implement the LFU-DA policy (Least diff --git a/src/repl/heap/store_repl_heap.cc b/src/repl/heap/store_repl_heap.cc index f6f908a1eb..fb3413531d 100644 --- a/src/repl/heap/store_repl_heap.cc +++ b/src/repl/heap/store_repl_heap.cc @@ -1,6 +1,6 @@ /* - * $Id: store_repl_heap.cc,v 1.4 2001/01/12 00:37:35 wessels Exp $ + * $Id: store_repl_heap.cc,v 1.5 2001/02/07 18:56:56 hno Exp $ * * DEBUG: section ? HEAP based removal policies * AUTHOR: Henrik Nordstrom @@ -119,7 +119,7 @@ struct _HeapWalkData { int current; }; -const StoreEntry * +static const StoreEntry * heap_walkNext(RemovalPolicyWalker * walker) { HeapWalkData *heap_walk = walker->_data; diff --git a/src/repl/lru/store_repl_lru.cc b/src/repl/lru/store_repl_lru.cc index badf5bd1c6..9b963cb9cc 100644 --- a/src/repl/lru/store_repl_lru.cc +++ b/src/repl/lru/store_repl_lru.cc @@ -1,6 +1,6 @@ /* - * $Id: store_repl_lru.cc,v 1.6 2001/01/12 00:37:36 wessels Exp $ + * $Id: store_repl_lru.cc,v 1.7 2001/02/07 18:56:56 hno Exp $ * * DEBUG: section ? LRU Removal policy * AUTHOR: Henrik Nordstrom @@ -132,7 +132,7 @@ struct _LruWalkData { LruNode *current; }; -const StoreEntry * +static const StoreEntry * lru_walkNext(RemovalPolicyWalker * walker) { LruWalkData *lru_walk = walker->_data; diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index 1659bec596..a563f36e04 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -1,6 +1,6 @@ /* - * $Id: snmp_agent.cc,v 1.79 2001/01/24 22:38:25 wessels Exp $ + * $Id: snmp_agent.cc,v 1.80 2001/02/07 18:56:52 hno Exp $ * * DEBUG: section 49 SNMP Interface * AUTHOR: Kostas Anagnostakis @@ -37,8 +37,6 @@ #include "squid.h" #include "cache_snmp.h" -extern StatCounters *snmpStatGet(int); - /************************************************************************ SQUID MIB Implementation @@ -257,7 +255,7 @@ snmp_prfSysFn(variable_list * Var, snint * ErrP) break; case PERF_SYS_MEMUSAGE: Answer = snmp_var_new_integer(Var->name, Var->name_length, - (snint) memTotalAllocated() >> 10, + (snint) statMemoryAccounted() >> 10, ASN_INTEGER); break; case PERF_SYS_CPUTIME: diff --git a/src/stat.cc b/src/stat.cc index 4b71dc8278..ab0072a4b7 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.343 2001/01/12 00:37:21 wessels Exp $ + * $Id: stat.cc,v 1.344 2001/02/07 18:56:52 hno Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -592,7 +592,7 @@ info_get(StoreEntry * sentry) #endif /* HAVE_MALLINFO */ storeAppendPrintf(sentry, "Memory accounted for:\n"); storeAppendPrintf(sentry, "\tTotal accounted: %6d KB\n", - memTotalAllocated() >> 10); + statMemoryAccounted() >> 10); storeAppendPrintf(sentry, "\tmemPoolAlloc calls: %d\n", mem_pool_alloc_calls); storeAppendPrintf(sentry, "\tmemPoolFree calls: %d\n", @@ -1299,12 +1299,15 @@ statMedianSvc(int interval, int which) /* * SNMP wants ints, ick */ +#if UNUSED_CODE int get_median_svc(int interval, int which) { return (int) statMedianSvc(interval, which); } +#endif + StatCounters * snmpStatGet(int minutes) { @@ -1516,4 +1519,10 @@ statGraphDump(StoreEntry * e) GENGRAPH(cputime, "cputime", "CPU utilisation"); } +int +statMemoryAccounted(void) +{ + memTotalAllocated(); +} + #endif /* STAT_GRAPHS */ diff --git a/src/typedefs.h b/src/typedefs.h index ae4fca5eeb..33432bf1be 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.121 2001/01/31 22:16:39 hno Exp $ + * $Id: typedefs.h,v 1.122 2001/02/07 18:56:52 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -290,10 +290,10 @@ typedef double hbase_f(double); typedef void StatHistBinDumper(StoreEntry *, int idx, double val, double size, int count); /* authenticate.c authenticate scheme routines typedefs */ -typedef int AUTHSACTIVE(); +typedef int AUTHSACTIVE(void); typedef int AUTHSAUTHED(auth_user_request_t *); typedef void AUTHSAUTHUSER(auth_user_request_t *, request_t *, ConnStateData *, http_hdr_type); -typedef int AUTHSCONFIGURED(); +typedef int AUTHSCONFIGURED(void); typedef void AUTHSDECODE(auth_user_request_t *, const char *); typedef int AUTHSDIRECTION(auth_user_request_t *); typedef void AUTHSDUMP(StoreEntry *, const char *, authScheme *);