]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Polish: drop a bunch of dead code
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Mar 2013 06:24:15 +0000 (00:24 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Mar 2013 06:24:15 +0000 (00:24 -0600)
14 files changed:
src/HttpReply.cc
src/HttpReply.h
src/acl/SourceAsn.h
src/anyp/PortCfg.cc
src/client_side_reply.cc
src/comm.cc
src/forward.cc
src/fqdncache.cc
src/fs/ufs/StoreFSufs.cc
src/ftp.cc
src/icmp/IcmpSquid.cc
src/icmp/net_db.cc
src/ip/Address.cc
src/stat.cc

index 1a646a8e6544a392d1879cb623298520ecf00b55..fffa869c60bd8d5fae8069f36f9dea00f0256fe7 100644 (file)
@@ -159,18 +159,6 @@ HttpReply::pack()
     return mb;
 }
 
-#if DEAD_CODE
-MemBuf *
-httpPackedReply(Http::StatusCode status, const char *ctype, int64_t clen, time_t lmt, time_t expires)
-{
-    HttpReply *rep = new HttpReply;
-    rep->setHeaders(status, ctype, NULL, clen, lmt, expires);
-    MemBuf *mb = rep->pack();
-    delete rep;
-    return mb;
-}
-#endif
-
 HttpReply *
 HttpReply::make304() const
 {
index 04e95d70ed7c7aeeaeb5c8240638e15d5dbbf569..c7f3f3e3641039855929a6008c4a0a3f3ffea64b 100644 (file)
 
 void httpReplyInitModule(void);
 
-#if DEAD_CODE
-/** do everything in one call: init, set, pack, clean, return MemBuf */
-MemBuf *httpPackedReply(Http::ProtocolVersion ver, Http::StatusCode status, const char *ctype, int64_t clen, time_t lmt, time_t expires);
-#endif
-
 /* Sync changes here with HttpReply.cc */
 
 class HttpHdrContRange;
index 448709b2633ebfb9f2ccd75f158c09888c4ae724..ed2cc2023d4fd69412c98e48ec30ed9fcbd4e7cf 100644 (file)
  *
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
-#ifndef SQUID_ACLSOURCEASN_H
-#define SQUID_ACLSOURCEASN_H
-
-#if 0
-#include "acl/Asn.h"
-#endif
-
-class ACLChecklist;
+#ifndef SQUID_ACL_SOURCEASN_H
+#define SQUID_ACL_SOURCEASN_H
 
 #include "acl/Strategy.h"
 #include "ip/Address.h"
 
+class ACLChecklist;
+
 class ACLSourceASNStrategy : public ACLStrategy<Ip::Address>
 {
 
@@ -58,4 +54,4 @@ private:
     ACLSourceASNStrategy&operator=(ACLSourceASNStrategy const &);
 };
 
-#endif /* SQUID_ACLSOURCEASN_H */
+#endif /* SQUID_ACL_SOURCEASN_H */
index b645879699b6508e2deac4b524ac37102e99302a..9bc183c38dd60135a4226a694e4f90e193ec3200 100644 (file)
@@ -67,7 +67,7 @@ AnyP::PortCfg::clone() const
     b->tcp_keepalive = tcp_keepalive;
 
 #if 0
-    // AYJ: 2009-07-18: for now SSL does not clone. Configure separate ports with IPs and SSL settings
+    // TODO: AYJ: 2009-07-18: for now SSL does not clone. Configure separate ports with IPs and SSL settings
 
 #if USE_SSL
     char *cert;
index f5b16aefa5725f30dfeb1dc339c6638c8ce617d0..d299a5afe030d8af2d275724f3447f7fe21c45a7 100644 (file)
@@ -1305,15 +1305,6 @@ clientReplyContext::buildReplyHeader()
          * age calculation is performed by adjusting the timestamp in
          * StoreEntry::timestampsSet(), not here.
          */
-#if DEAD_CODE
-        // XXX: realy useless? or is there a bug now that this is detatched from the below if-sequence ?
-        // looks like this pre-if was supposed to be the browser workaround...
-        if (NULL == http->storeEntry())
-            (void) 0;
-        else if (http->storeEntry()->timestamp < 0)
-            (void) 0;
-#endif
-
         if (EBIT_TEST(http->storeEntry()->flags, ENTRY_SPECIAL)) {
             hdr->delById(HDR_DATE);
             hdr->insertTime(HDR_DATE, squid_curtime);
index 0110ba31455bdfdc6b3d8a5242f6e7649045fc61..05eaadac5c9261b4cb9d494469b0350c16921580 100644 (file)
@@ -890,23 +890,6 @@ comm_connect_addr(int sock, const Ip::Address &address)
 
     }
 
-    /* Squid seems to be working fine without this code. With this code,
-     * we leak memory on many connect requests because of EINPROGRESS.
-     * If you find that this code is needed, please file a bug report. */
-#if 0
-#if _SQUID_LINUX_
-    /* 2007-11-27:
-     * Linux Debian replaces our allocated AI pointer with garbage when
-     * connect() fails. This leads to segmentation faults deallocating
-     * the system-allocated memory when we go to clean up our pointer.
-     * HACK: is to leak the memory returned since we can't deallocate.
-     */
-    if (errno != 0) {
-        AI = NULL;
-    }
-#endif
-#endif
-
     address.FreeAddrInfo(AI);
 
     PROF_stop(comm_connect_addr);
index 5d594e0197a91a0a3ecd2362d31f745d81b3ed35..d872d347c413aaefc6ea78c4b14936d3c19fe251 100644 (file)
@@ -1123,10 +1123,6 @@ FwdState::connectStart()
             serverConn = NULL;
         if (Comm::IsConnOpen(serverConn)) {
             flags.connected_okay = true;
-#if 0
-            if (!serverConn->getPeer())
-                serverConn->peerType = HIER_DIRECT;
-#endif
             ++n_tries;
             request->flags.pinned = true;
             if (pinned_connection->pinnedAuth())
index d4c4535eb398319891bb96dbb59fa02965bde3f9..30af8d38cde7801ef1d283476bb40b72001a71f8 100644 (file)
@@ -702,25 +702,6 @@ fqdnStats(StoreEntry * sentry)
     }
 }
 
-/// \ingroup FQDNCacheAPI
-#if 0
-const char *
-fqdnFromAddr(const Ip::Address &addr)
-{
-    const char *n;
-    static char buf[MAX_IPSTRLEN];
-
-    if (Config.onoff.log_fqdn && (n = fqdncache_gethostbyaddr(addr, 0)))
-        return n;
-
-/// \todo Perhapse this should use toHostname() instead of straight NtoA.
-///       that would wrap the IPv6 properly when raw.
-    addr.NtoA(buf, MAX_IPSTRLEN);
-
-    return buf;
-}
-#endif
-
 /// \ingroup FQDNCacheInternal
 static void
 fqdncacheLockEntry(fqdncache_entry * f)
index c1162d13b8f48d1d368507139cbecae56c631c85..2eaee557fdc8128e7dce74a86f1934850d95cc23 100644 (file)
 /*TODO: remove this file as unused*/
 
 #include "squid.h"
-#if 0
-#include "StoreFileSystem.h"
-#endif
-
 #include "fs/ufs/StoreFSufs.h"
 #include "fs/ufs/UFSSwapDir.h"
 
-#if 0
-#include "DiskIO/DiskIOModule.h"
-#endif
-
 /* Unused variable: */
 Fs::Ufs::StoreFSufs<Fs::Ufs::UFSSwapDir> *UfsInstance_foo = NULL;
index 9c7e1c0007294c5f55995dc83aa6751187e487aa..e031886aeee170a6d757ed461688ed8e4c7f81ba 100644 (file)
@@ -698,22 +698,6 @@ FtpStateData::ftpTimeout(const CommTimeoutCbParams &io)
     /* failed() closes ctrl.conn and frees ftpState */
 }
 
-#if DEAD_CODE // obsoleted by ERR_DIR_LISTING
-void
-FtpStateData::listingFinish()
-{
-    // TODO: figure out what this means and how to show it ...
-
-    if (flags.listformat_unknown && !flags.tried_nlst) {
-        printfReplyBody("<a href=\"%s/;type=d\">[As plain directory]</a>\n",
-                        flags.dir_slash ? rfc1738_escape_part(old_filepath) : ".");
-    } else if (typecode == 'D') {
-        const char *path = flags.dir_slash ? filepath : ".";
-        printfReplyBody("<a href=\"%s/\">[As extended directory]</a>\n", rfc1738_escape_part(path));
-    }
-}
-#endif /* DEAD_CODE */
-
 /// \ingroup ServerProtocolFTPInternal
 static const char *Month[] = {
     "Jan", "Feb", "Mar", "Apr", "May", "Jun",
index d2cd6a647d9207760b462354c8b60368c061e315..16c8d2e3ff7484bb5cdfbd6fb0ab21c53a60d871 100644 (file)
@@ -51,9 +51,6 @@ IcmpSquid icmpEngine;
 #if USE_ICMP
 
 #define S_ICMP_ECHO     1
-#if DEAD_CODE
-#define S_ICMP_ICP      2
-#endif
 #define S_ICMP_DOM      3
 
 static void * hIpc;
index 504e5b023c909858d42090a3a046c791d2128841..f1996572aa47968c2470efab621dc4d1ee1dd3b7 100644 (file)
@@ -989,23 +989,6 @@ netdbFreeMemory(void)
 #endif
 }
 
-#if 0 // AYJ: Looks to be unused code.
-int
-netdbHops(Ip::Address &addr)
-{
-#if USE_ICMP
-    netdbEntry *n = netdbLookupAddr(addr);
-
-    if (n && n->pings_recv) {
-        n->last_use_time = squid_curtime;
-        return (int) (n->hops + 0.5);
-    }
-
-#endif
-    return 256;
-}
-#endif
-
 void
 netdbDump(StoreEntry * sentry)
 {
index dda6fa12c76ab2d7f8ce5c2044d58d8037fe6cdb..1bb97c578e88f2ac9c0bbf0012887e1fa4803599 100644 (file)
@@ -400,10 +400,6 @@ Ip::Address::LookupHostIP(const char *s, bool nodns)
     if (nodns) {
         want.ai_flags = AI_NUMERICHOST; // prevent actual DNS lookups!
     }
-#if 0
-    else if (!Ip::EnableIpv6)
-        want.ai_family = AF_INET;  // maybe prevent IPv6 DNS lookups.
-#endif
 
     if ( (err = getaddrinfo(s, NULL, &want, &res)) != 0) {
         debugs(14,3, HERE << "Given Non-IP '" << s << "': " << gai_strerror(err) );
index a114896e52cfb6a771e52770e0dce4f5ed40491c..db19c90ccc11b5d240c3e6fc066332273efbe28f 100644 (file)
@@ -2039,12 +2039,6 @@ statClientRequests(StoreEntry * s)
         storeAppendPrintf(s, "req_sz %ld\n", (long int) http->req_sz);
         e = http->storeEntry();
         storeAppendPrintf(s, "entry %p/%s\n", e, e ? e->getMD5Text() : "N/A");
-#if 0
-        /* Not a member anymore */
-        e = http->old_entry;
-        storeAppendPrintf(s, "old_entry %p/%s\n", e, e ? e->getMD5Text() : "N/A");
-#endif
-
         storeAppendPrintf(s, "start %ld.%06d (%f seconds ago)\n",
                           (long int) http->start_time.tv_sec,
                           (int) http->start_time.tv_usec,