From: wessels <> Date: Fri, 20 Apr 2007 13:29:47 +0000 (+0000) Subject: Removed a bunch of code marked UNUSED_CODE, OLD, and BROKEN_CODE X-Git-Tag: SQUID_3_0_PRE6~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c80b9ccc3dd02f00c20581bbe5978d450f14420;p=thirdparty%2Fsquid.git Removed a bunch of code marked UNUSED_CODE, OLD, and BROKEN_CODE These sections of code have been marked unused for at least three years now. They have been removed. --- diff --git a/src/HttpBody.cc b/src/HttpBody.cc index cdba41d89f..51a3e0b939 100644 --- a/src/HttpBody.cc +++ b/src/HttpBody.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpBody.cc,v 1.24 2005/09/17 05:50:07 wessels Exp $ + * $Id: HttpBody.cc,v 1.25 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 56 HTTP Message Body * AUTHOR: Alex Rousskov @@ -74,12 +74,3 @@ httpBodyPackInto(const HttpBody * body, Packer * p) if (body->mb->contentSize()) packerAppend(p, body->mb->content(), body->mb->contentSize()); } - -#if UNUSED_CODE -const char * -httpBodyPtr(const HttpBody * body) -{ - return body->mb->content() ? body->mb->content() : ""; -} - -#endif diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index cb2512e1fc..46c7fd991c 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.cc,v 1.56 2006/09/03 05:30:40 hno Exp $ + * $Id: HttpHeaderTools.cc,v 1.57 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -39,9 +39,6 @@ #include "ACLChecklist.h" #include "MemBuf.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); @@ -218,20 +215,6 @@ strListIsSubstr(const String * list, const char *s, char del) * implementaion is equavalent to strstr()! Thus, we replace the loop with * strstr() above until strnstr() is available. */ - -#ifdef BROKEN_CODE - - const char *pos = NULL; - const char *item; - assert(list && s); - - while (strListGetItem(list, del, &item, NULL, &pos)) { - if (strstr(item, s)) - return 1; - } - - return 0; -#endif } /* appends an item to the list */ @@ -391,116 +374,6 @@ httpHeaderParseQuotedString (const char *start, String *val) } } -/* - * 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) -{ - static int bug_count = 0; - int hstr_len; - int parse_success; - HttpHeader hdr(hoReply); - int pos; - Packer p; - MemBuf mb; - assert(hstr); - /* skip start line if any */ - - if (!strncasecmp(hstr, "HTTP/", 5)) { - const char *p = strchr(hstr, '\n'); - - if (p) - hstr = p + 1; - } - - /* skip invalid first line if any */ - if (xisspace(*hstr)) { - const char *p = strchr(hstr, '\n'); - - if (p) - hstr = p + 1; - } - - hstr_len = strlen(hstr); - /* skip terminator if any */ - - if (strstr(hstr, "\n\r\n")) - hstr_len -= 2; - else if (strstr(hstr, "\n\n")) - hstr_len -= 1; - - /* Debug::Levels[55] = 8; */ - parse_success = httpHeaderParse(&hdr, hstr, hstr + hstr_len); - - /* Debug::Levels[55] = 2; */ - if (!parse_success) { - debug(66, 2) ("TEST (%d): failed to parsed a header: {\n%s}\n", bug_count, hstr); - return; - } - - /* we think that we parsed it, veryfy */ - mb.init(); - - packerToMemInit(&p, &mb); - - httpHeaderPackInto(&hdr, &p); - - if ((pos = abs(httpHeaderStrCmp(hstr, mb.buf, hstr_len)))) { - bug_count++; - debug(66, 2) ("TEST (%d): hdr parsing bug (pos: %d near '%s'): expected: {\n%s} got: {\n%s}\n", - bug_count, pos, hstr + pos, hstr, mb.buf); - } - - hdr.clean(); - packerClean(&p); - mb.clean(); -} - -#endif - - -/* like strncasecmp but ignores ws characters */ -#if UNUSED_CODE -static int -httpHeaderStrCmp(const char *h1, const char *h2, int len) -{ - int len1 = 0; - int len2 = 0; - assert(h1 && h2); - /* fast check first */ - - if (!strncasecmp(h1, h2, len)) - return 0; - - while (1) { - const char c1 = xtoupper(h1[len1 += xcountws(h1 + len1)]); - const char c2 = xtoupper(h2[len2 += xcountws(h2 + len2)]); - - if (c1 < c2) - return -len1; - - if (c1 > c2) - return +len1; - - if (!c1 && !c2) - return 0; - - if (c1) - len1++; - - if (c2) - len2++; - } - - /* NOTREACHED */ - return 0; -} - -#endif - /* * httpHdrMangle checks the anonymizer (header_access) configuration. * Returns 1 if the header is allowed. diff --git a/src/HttpReply.cc b/src/HttpReply.cc index e641e4c4b2..d2d8e14c0c 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.cc,v 1.91 2007/04/06 04:50:04 rousskov Exp $ + * $Id: HttpReply.cc,v 1.92 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -124,23 +124,6 @@ HttpReply::clean() httpStatusLineClean(&sline); } -#if OLD -/* absorb: copy the contents of a new reply to the old one, destroy new one */ -void -HttpReply::absorb(HttpReply * new_rep) -{ - assert(new_rep); - clean(); - *this = *new_rep; - new_rep->header.entries.clean(); - /* cannot use Clean() on new reply now! */ - new_rep->do_clean = false; - new_rep->cache_control = NULL; // helps with debugging - delete new_rep; -} - -#endif - void HttpReply::packHeadersInto(Packer * p) const { diff --git a/src/MemObject.h b/src/MemObject.h index 899fe447a1..94e44f063a 100644 --- a/src/MemObject.h +++ b/src/MemObject.h @@ -1,6 +1,6 @@ /* - * $Id: MemObject.h,v 1.13 2006/08/21 00:50:41 robertc Exp $ + * $Id: MemObject.h,v 1.14 2007/04/20 07:29:47 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -143,14 +143,7 @@ public: void kickReads(); private: -#if OLD - /* Read only - this reply must be preserved by store clients */ - /* The original reply. possibly with updated metadata. */ - HttpReply const *_reply; -#else - HttpReply *_reply; -#endif DeferredReadManager deferredReads; }; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 61757c9628..ba00d94fb6 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.508 2007/04/15 14:46:12 serassio Exp $ + * $Id: cache_cf.cc,v 1.509 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -135,9 +135,6 @@ static int check_null_sockaddr_in_list(const sockaddr_in_list *); static void parse_http_port_list(http_port_list **); static void dump_http_port_list(StoreEntry *, const char *, const http_port_list *); static void free_http_port_list(http_port_list **); -#if UNUSED_CODE -static int check_null_http_port_list(const http_port_list *); -#endif #if USE_SSL static void parse_https_port_list(https_port_list **); static void dump_https_port_list(StoreEntry *, const char *, const https_port_list *); @@ -1892,55 +1889,6 @@ parse_hostdomaintype(void) } } -#if UNUSED_CODE -static void -dump_ushortlist(StoreEntry * entry, const char *name, ushortlist * u) -{ - while (u) { - storeAppendPrintf(entry, "%s %d\n", name, (int) u->i); - u = u->next; - } -} - -static int -check_null_ushortlist(ushortlist * u) -{ - return u == NULL; -} - -static void -parse_ushortlist(ushortlist ** P) -{ - char *token; - u_short i; - ushortlist *u; - ushortlist **U; - - while ((token = strtok(NULL, w_space))) { - i = GetShort(); - u = xcalloc(1, sizeof(ushortlist)); - u->i = i; - - for (U = P; *U; U = &(*U)->next) - - ; - *U = u; - } -} - -static void -free_ushortlist(ushortlist ** P) -{ - ushortlist *u; - - while ((u = *P) != NULL) { - *P = u->next; - xfree(u); - } -} - -#endif - static void dump_int(StoreEntry * entry, const char *name, int var) { @@ -2216,15 +2164,6 @@ parse_refreshpattern(refresh_t ** head) safe_free(pattern); } -#if UNUSED_CODE -static int -check_null_refreshpattern(refresh_t * data) -{ - return data == NULL; -} - -#endif - static void free_refreshpattern(refresh_t ** head) { @@ -2860,15 +2799,6 @@ free_http_port_list(http_port_list ** head) } } -#if UNUSED_CODE -static int -check_null_http_port_list(const http_port_list * s) -{ - return NULL == s; -} - -#endif - #if USE_SSL static void cbdataFree_https_port(void *data) diff --git a/src/client_side.cc b/src/client_side.cc index d5b1708e0d..279e0fbbe3 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.748 2007/04/17 06:07:50 wessels Exp $ + * $Id: client_side.cc,v 1.749 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -155,9 +155,6 @@ static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer static void clientUpdateSocketStats(log_type logType, size_t size); char *skipLeadingSpace(char *aString); -#if UNUSED_CODE -static void trimTrailingSpaces(char *aString, size_t len); -#endif static int connReadWasError(ConnStateData::Pointer& conn, comm_err_t, int size, int xerrno); static int connFinishedWithConn(ConnStateData::Pointer& conn, int size); static void connNoteUseOfBuffer(ConnStateData* conn, size_t byteCount); @@ -1692,18 +1689,6 @@ findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char *end) return NULL; } -#if UNUSED_CODE -void -trimTrailingSpaces(char *aString, size_t len) -{ - char *endPointer = aString + len; - - while (endPointer > aString && xisspace(*endPointer)) - *(endPointer--) = '\0'; -} - -#endif - void setLogUri(ClientHttpRequest * http, char const *uri) { diff --git a/src/enums.h b/src/enums.h index b468375312..63f231ab6a 100644 --- a/src/enums.h +++ b/src/enums.h @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.255 2007/04/13 22:46:03 wessels Exp $ + * $Id: enums.h,v 1.256 2007/04/20 07:29:47 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -323,9 +323,6 @@ enum { ENTRY_VALIDATED, ENTRY_BAD_LENGTH, ENTRY_ABORTED -#if UNUSED_CODE - ENTRY_DONT_LOG -#endif }; /* diff --git a/src/http.h b/src/http.h index 8b7bf97b5e..2c3bb478d7 100644 --- a/src/http.h +++ b/src/http.h @@ -1,6 +1,6 @@ /* - * $Id: http.h,v 1.27 2007/04/06 04:50:06 rousskov Exp $ + * $Id: http.h,v 1.28 2007/04/20 07:29:47 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -93,14 +93,8 @@ public: * getReply() public only because it is called from a static function * as httpState->getReply() */ -#if OLD -const HttpReply * getReply() const { return reply ? reply : entry->getReply(); } - -#else const HttpReply * getReply() const { assert(reply); return reply; } -#endif - private: enum ConnectionStatus { INCOMPLETE_MSG, diff --git a/src/mem.cc b/src/mem.cc index f698caaebc..4030cc2699 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -1,6 +1,6 @@ /* - * $Id: mem.cc,v 1.102 2007/04/12 19:37:23 wessels Exp $ + * $Id: mem.cc,v 1.103 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -465,20 +465,6 @@ memCheckInit(void) } } -#if UNUSED_CODE -/* to-do: make debug level a parameter? */ -static void memPoolDescribe(const MemAllocator * pool); -static void -memPoolDescribe(const MemAllocator * pool) -{ - assert(pool); - debug(13, 2) ("%-20s: %6d x %4d bytes = %5d KB\n", - pool->label, memPoolInUseCount(pool), pool->obj_size, - toKB(pool->obj_size * pool->meter.inuse.level)); -} - -#endif - void memClean(void) { diff --git a/src/neighbors.cc b/src/neighbors.cc index 83baf7631d..97d7c1cb30 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.344 2007/02/05 15:16:31 hno Exp $ + * $Id: neighbors.cc,v 1.345 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -278,36 +278,6 @@ neighborsCount(HttpRequest * request) return count; } -#if UNUSED_CODE -peer * -getSingleParent(HttpRequest * request) -{ - peer *p = NULL; - peer *q = NULL; - - for (q = Config.peers; q; q = q->next) { - if (!peerHTTPOkay(q, request)) - continue; - - if (neighborType(q, request) != PEER_PARENT) - return NULL; /* oops, found SIBLING */ - - if (p) - return NULL; /* oops, found second parent */ - - p = q; - } - - if (p != NULL && !p->options.no_query) - return NULL; - - debug(15, 3) ("getSingleParent: returning %s\n", p ? p->host : "NULL"); - - return p; -} - -#endif - peer * getFirstUpParent(HttpRequest * request) { diff --git a/src/snmp_core.cc b/src/snmp_core.cc index dcc071ef66..1a93dceb65 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.75 2006/09/22 02:48:51 hno Exp $ + * $Id: snmp_core.cc,v 1.76 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -1103,20 +1103,6 @@ va_dcl return (new_oid); } -#if UNUSED_CODE -/* - * Allocate space for, and copy, an OID. Returns new oid. - */ -static oid * -snmpOidDup(oid * A, snint ALen) -{ - oid *Ans = xmalloc(sizeof(oid) * ALen); - xmemcpy(Ans, A, (sizeof(oid) * ALen)); - return Ans; -} - -#endif - /* * Debug calls, prints out the OID for debugging purposes. */ diff --git a/src/store_digest.cc b/src/store_digest.cc index 7be9ce8fb9..80d7454c1b 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: store_digest.cc,v 1.70 2006/08/21 00:50:41 robertc Exp $ + * $Id: store_digest.cc,v 1.71 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 71 Store Digest Manager * AUTHOR: Alex Rousskov @@ -271,12 +271,6 @@ storeDigestAddable(const StoreEntry * e) * idea: skip objects that are going to be purged before the next * update. */ -#if OLD_UNUSED_CODE /* This code isn't applicable anymore, we can't fix it atm either :( */ - if ((squid_curtime + Config.digest.rebuild_period) - e->lastref > storeExpiredReferenceAge()) - return 0; - -#endif - return 1; } diff --git a/src/store_log.cc b/src/store_log.cc index 3f372a7cb2..d6f76b8ec7 100644 --- a/src/store_log.cc +++ b/src/store_log.cc @@ -1,6 +1,6 @@ /* - * $Id: store_log.cc,v 1.30 2007/04/17 06:07:50 wessels Exp $ + * $Id: store_log.cc,v 1.31 2007/04/20 07:29:47 wessels Exp $ * * DEBUG: section 20 Storage Manager Logging Functions * AUTHOR: Duane Wessels @@ -62,13 +62,6 @@ storeLog(int tag, const StoreEntry * e) if (NULL == storelog) return; -#if UNUSED_CODE - - if (EBIT_TEST(e->flags, ENTRY_DONT_LOG)) - return; - -#endif - storeLogTagsCounts[tag]++; if (mem != NULL) { if (mem->log_url == NULL) {