]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed a bunch of code marked UNUSED_CODE, OLD, and BROKEN_CODE
authorwessels <>
Fri, 20 Apr 2007 13:29:47 +0000 (13:29 +0000)
committerwessels <>
Fri, 20 Apr 2007 13:29:47 +0000 (13:29 +0000)
These sections of code have been marked unused for at least three
years now.  They have been removed.

13 files changed:
src/HttpBody.cc
src/HttpHeaderTools.cc
src/HttpReply.cc
src/MemObject.h
src/cache_cf.cc
src/client_side.cc
src/enums.h
src/http.h
src/mem.cc
src/neighbors.cc
src/snmp_core.cc
src/store_digest.cc
src/store_log.cc

index cdba41d89f0782253b1ee207de5732a1b9823233..51a3e0b939ddf6adc024fe7589870b23b7987df0 100644 (file)
@@ -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
index cb2512e1fcff7652e3af31057de5448e1a1cdc67..46c7fd991c3cff62fa90ed6f629cce0c0fe81429 100644 (file)
@@ -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.
index e641e4c4b23507988a20fdf8320f3d1147a52885..d2d8e14c0cebfef181192e0e430d186defda28a7 100644 (file)
@@ -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
 {
index 899fe447a1f463dfa30e0c76d9a506db08b30d20..94e44f063a8d226d0b19e6e11c83dc1419758825 100644 (file)
@@ -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;
 };
index 61757c962856af28a0e984f5495c612b309aeb24..ba00d94fb634ef881d6e139d9d7c251aa157e6af 100644 (file)
@@ -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)
index d5b1708e0d62fc511ad6e68b90c9c16983f9d42f..279e0fbbe36788bc4fdeb31e8ca2a79e52d6087b 100644 (file)
@@ -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)
 {
index b4683753127471044664ce0d4d37f244b81291ce..63f231ab6a04c0c7bd97dbfa09a777c4d8a37c7c 100644 (file)
@@ -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
 };
 
 /*
index 8b7bf97b5efdfff3b2c68d7851cc227fcfb302ef..2c3bb478d76397deb61c2b55a7ffaeae4dd2022d 100644 (file)
@@ -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,
index f698caaebc4887636a6e400b17c2361ad353c744..4030cc26990e9d8ae6fbe6d9ba8c4d839009e5b8 100644 (file)
@@ -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)
 {
index 83baf7631de5c3458931f8d94de46c33c22b16be..97d7c1cb3052b5612549c8b0152de2bb18fa5931 100644 (file)
@@ -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)
 {
index dcc071ef6627db5770a8eada42405d50b336e233..1a93dceb658b83075e92fd368535f87c27630e5e 100644 (file)
@@ -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.
  */
index 7be9ce8fb92212b9d9cee002978d4379166a5ac3..80d7454c1bf0092213b29184bf1510622c08bc14 100644 (file)
@@ -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;
 }
 
index 3f372a7cb2dc1b5d2e0a7816838586e5190c2625..d6f76b8ec7a2bdc240e6f89ab2c9df1612f4a8e7 100644 (file)
@@ -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) {