From: Francesco Chemolli Date: Wed, 26 May 2021 13:59:53 +0000 (+0000) Subject: Remove a lot of unwanted ifdef'd out code (#826) X-Git-Tag: 4.15-20210527-snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5352173435912e825caded3d41578f953dcc9ca6;p=thirdparty%2Fsquid.git Remove a lot of unwanted ifdef'd out code (#826) We examined most `#if...` clauses and removed those we decided are clearly unwanted now. Most of the removed code snippets were unused for many years or represented stale ideas. We tried to check (at least superficially) all clauses, but most likely missed some good candidates. --- diff --git a/compat/fdsetsize.h b/compat/fdsetsize.h index a0a1848578..b7b315a4a7 100644 --- a/compat/fdsetsize.h +++ b/compat/fdsetsize.h @@ -15,17 +15,6 @@ *--------------------------------------------------------------------------* ****************************************************************************/ -/* FD_SETSIZE must be redefined before including sys/types.h */ -#if 0 -/* AYJ: would dearly like to use this to enforce include order - but at present some helpers don't follow the squid include methodology. - that will need fixing later. -*/ -#ifdef _SYS_TYPES_H -#error squid_fdsetsize.h for FDSETSIZE must be included before sys/types.h -#error Make sure that squid.h is the first file included by your .cc -#endif -#endif /* 0 */ /* * On some systems, FD_SETSIZE is set to something lower than the * actual number of files which can be opened. IRIX is one case, diff --git a/compat/getaddrinfo.h b/compat/getaddrinfo.h index 69696d0a67..9744844944 100644 --- a/compat/getaddrinfo.h +++ b/compat/getaddrinfo.h @@ -51,38 +51,6 @@ /* These functions are provided by the OS */ #if !HAVE_DECL_GETADDRINFO -/* SG 23/09/2007: -On Windows the following definitions are already available, may be that -this could be needed on some other platform */ -#if 0 -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - socklen_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for nodename */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; - -/* Supposed to be defined in */ -#define AI_PASSIVE 1 /* Socket address is intended for `bind'. */ -#define AI_CANONNAME 2 /* Request for canonical name. */ -#define AI_NUMERICHOST 4 /* Don't use name resolution. */ - -/* Supposed to be defined in */ -#define EAI_ADDRFAMILY 1 /* address family for nodename not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with nodename */ -#define EAI_NONAME 8 /* nodename nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#endif #ifndef EAI_SYSTEM /* Not defined on mingw32. */ #define EAI_SYSTEM 11 /* System error returned in `errno'. */ diff --git a/compat/getnameinfo.cc b/compat/getnameinfo.cc index b0bb7afd14..7a458de898 100644 --- a/compat/getnameinfo.cc +++ b/compat/getnameinfo.cc @@ -265,36 +265,9 @@ found: hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); #else hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af); -#if 0 // getnameinfo.c:161:9: error: variable 'h_error' set but not used -#if HAVE_H_ERRNO - h_error = h_errno; -#else - h_error = EINVAL; -#endif -#endif /* 0 */ #endif if (hp) { -#if 0 - if (flags & NI_NOFQDN) { - /* - * According to RFC3493 section 6.2, NI_NOFQDN - * means "node name portion of the FQDN shall - * be returned for local hosts." The following - * code tries to implement it by returning the - * first label (the part before the first - * period) of the FQDN. However, it is not - * clear if this always makes sense, since the - * given address may be outside of "local - * hosts." Due to the unclear description, we - * disable the code in this implementation. - */ - char *p; - p = strchr(hp->h_name, '.'); - if (p) - *p = '\0'; - } -#endif if (strlen(hp->h_name) + 1 > hostlen) { #if USE_GETIPNODEBY freehostent(hp); diff --git a/compat/inet_pton.cc b/compat/inet_pton.cc index e30462bb10..cbcd1e1174 100644 --- a/compat/inet_pton.cc +++ b/compat/inet_pton.cc @@ -63,7 +63,7 @@ static const char rcsid[] = "inet_pton.c,v 1.2.206.2 2005/07/28 07:43:18 marka E #if HAVE_NETINET_IN_H #include #endif -#if ARPA_INET_H +#if HAVE_ARPA_INET_H #include #endif #if HAVE_ARPA_NAMESER_H diff --git a/compat/os/aix.h b/compat/os/aix.h index 8d1c1df5d0..d1be71d9a6 100644 --- a/compat/os/aix.h +++ b/compat/os/aix.h @@ -25,11 +25,6 @@ #define _XOPEN_SOURCE_EXTENDED 1 #endif -/* AIX 6.1 does not define recvmsg() flag MSG_DONTWAIT */ -#if !defined(MSG_DONTWAIT) -#define MSG_DONTWAIT 0 -#endif - #endif /* _SQUID_AIX_ */ #endif /* SQUID_OS_AIX_H */ diff --git a/compat/strtoll.c b/compat/strtoll.c index e817d0473d..fe3467adb0 100644 --- a/compat/strtoll.c +++ b/compat/strtoll.c @@ -51,26 +51,6 @@ #include #endif -#ifndef INT64_MIN -/* Native 64 bit system without strtoll() */ -#if defined(LONG_MIN) && (SIZEOF_LONG == 8) -#define INT64_MIN LONG_MIN -#else -/* 32 bit system */ -#define INT64_MIN (-9223372036854775807LL-1LL) -#endif -#endif - -#ifndef INT64_MAX -/* Native 64 bit system without strtoll() */ -#if defined(LONG_MAX) && (SIZEOF_LONG == 8) -#define INT64_MAX LONG_MAX -#else -/* 32 bit system */ -#define INT64_MAX 9223372036854775807LL -#endif -#endif - /* * Convert a string to a int64 integer. * diff --git a/compat/tempnam.c b/compat/tempnam.c index 12622b773d..38d3443581 100644 --- a/compat/tempnam.c +++ b/compat/tempnam.c @@ -121,18 +121,3 @@ tempnam(const char *dir, const char *pfx) return _tmpnam(); } -#ifdef TEST -int -main() -{ - char *t; - int n = 0; - while ((t = tempnam(NULL, NULL))) { - printf("%s\n", t); - if (++n == 1000) - break; - } - return 1; -} -#endif - diff --git a/include/asn1.h b/include/asn1.h index 3e99cf1a44..8d32dd1454 100644 --- a/include/asn1.h +++ b/include/asn1.h @@ -93,11 +93,6 @@ u_char *asn_build_objid(u_char *, int *, u_char, oid *, int); u_char *asn_parse_null(u_char *, int *, u_char *); u_char *asn_build_null(u_char *, int *, u_char); -#if 0 -u_char *asn_parse_bitstring(u_char *, int *, u_char *, u_char *, int *); -u_char *asn_build_bitstring(u_char *, int *, u_char, u_char *, int); - -#endif u_char *asn_build_exception(u_char *, int *, u_char); #ifdef __cplusplus diff --git a/include/radix.h b/include/radix.h index 1e00dd4b70..fc1a7ef530 100644 --- a/include/radix.h +++ b/include/radix.h @@ -44,7 +44,6 @@ * @(#)radix.h 8.2 (Berkeley) 10/31/94 */ -#undef RN_DEBUG /* * Radix search tree node layout. */ @@ -78,14 +77,6 @@ struct squid_radix_node { struct squid_radix_node *rn_R; /* progeny */ } rn_node; } rn_u; -#ifdef RN_DEBUG - - int rn_info; - - struct squid_radix_node *rn_twin; - - struct squid_radix_node *rn_ybro; -#endif }; #define rn_key rn_u.rn_leaf.rn_Key diff --git a/include/snmp-mib.h b/include/snmp-mib.h index 33a3720ee6..ea3bb232ed 100644 --- a/include/snmp-mib.h +++ b/include/snmp-mib.h @@ -37,9 +37,6 @@ #include /* Need OID Definition */ #include /* Need variable_list */ -#if 0 -#include /* Then the function definitions */ -#endif #endif /* SQUID_SNMP_MIB_H */ diff --git a/include/snmp_api.h b/include/snmp_api.h index 11a467f074..7ab0a2fb45 100644 --- a/include/snmp_api.h +++ b/include/snmp_api.h @@ -63,114 +63,6 @@ u_char *snmp_parse(struct snmp_session *, struct snmp_pdu *, u_char *, int); */ int snmp_build(struct snmp_session *, struct snmp_pdu *, u_char *, int *); -/* - * struct snmp_session *snmp_open(session) - * struct snmp_session *session; - * - * Sets up the session with the snmp_session information provided - * by the user. Then opens and binds the necessary UDP port. - * A handle to the created session is returned (this is different than - * the pointer passed to snmp_open()). On any error, NULL is returned - * and snmp_errno is set to the appropriate error code. - */ -#if 0 -struct snmp_session *snmp_open(struct snmp_session *); - -/* - * int snmp_close(session) - * struct snmp_session *session; - * - * Close the input session. Frees all data allocated for the session, - * dequeues any pending requests, and closes any sockets allocated for - * the session. Returns 0 on error, 1 otherwise. - */ -int snmp_close(struct snmp_session *); - -/* - * int snmp_send(session, pdu) - * struct snmp_session *session; - * struct snmp_pdu *pdu; - * - * Sends the input pdu on the session after calling snmp_build to create - * a serialized packet. If necessary, set some of the pdu data from the - * session defaults. Add a request corresponding to this pdu to the list - * of outstanding requests on this session, then send the pdu. - * Returns the request id of the generated packet if applicable, otherwise 1. - * On any error, 0 is returned. - * The pdu is freed by snmp_send() unless a failure occurred. - */ -int snmp_send(struct snmp_session *, struct snmp_pdu *); - -/* - * void snmp_read(fdset) - * fd_set *fdset; - * - * Checks to see if any of the fd's set in the fdset belong to - * snmp. Each socket with it's fd set has a packet read from it - * and snmp_parse is called on the packet received. The resulting pdu - * is passed to the callback routine for that session. If the callback - * routine returns successfully, the pdu and it's request are deleted. - */ -void snmp_read(fd_set *); - -/* - * int snmp_select_info(numfds, fdset, timeout, block) - * int *numfds; - * fd_set *fdset; - * struct timeval *timeout; - * int *block; - * - * Returns info about what snmp requires from a select statement. - * numfds is the number of fds in the list that are significant. - * All file descriptors opened for SNMP are OR'd into the fdset. - * If activity occurs on any of these file descriptors, snmp_read - * should be called with that file descriptor set. - * - * The timeout is the latest time that SNMP can wait for a timeout. The - * select should be done with the minimum time between timeout and any other - * timeouts necessary. This should be checked upon each invocation of select. - * If a timeout is received, snmp_timeout should be called to check if the - * timeout was for SNMP. (snmp_timeout is idempotent) - * - * Block is 1 if the select is requested to block indefinitely, rather than time out. - * If block is input as 1, the timeout value will be treated as undefined, but it must - * be available for setting in snmp_select_info. On return, if block is true, the value - * of timeout will be undefined. - * - * snmp_select_info returns the number of open sockets. (i.e. The number of sessions open) - */ -int snmp_select_info(int *, fd_set *, struct timeval *, int *); - -/* - * void snmp_timeout(); - * - * snmp_timeout should be called whenever the timeout from snmp_select_info expires, - * but it is idempotent, so snmp_timeout can be polled (probably a cpu expensive - * proposition). snmp_timeout checks to see if any of the sessions have an - * outstanding request that has timed out. If it finds one (or more), and that - * pdu has more retries available, a new packet is formed from the pdu and is - * resent. If there are no more retries available, the callback for the session - * is used to alert the user of the timeout. - */ -void snmp_timeout(void); - -/* - * This routine must be supplied by the application: - * - * int callback(operation, session, reqid, pdu, magic) - * int operation; - * struct snmp_session *session; The session authenticated under. - * int reqid; The request id of this pdu (0 for TRAP) - * struct snmp_pdu *pdu; The pdu information. - * void *magic A link to the data for this routine. - * - * Returns 1 if request was successful, 0 if it should be kept pending. - * Any data in the pdu must be copied because it will be freed elsewhere. - * Operations are defined below: - */ - -void snmp_api_stats(void *); -#endif #ifdef __cplusplus } diff --git a/include/snmp_impl.h b/include/snmp_impl.h index 9a382124f8..705b85455c 100644 --- a/include/snmp_impl.h +++ b/include/snmp_impl.h @@ -38,18 +38,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -#if 0 -#if (defined vax) || (defined (mips)) -/* - * This is a fairly bogus thing to do, but there seems to be no better way for - * compilers that don't understand void pointers. - */ -#ifndef void -#define void char -#endif -#endif -#endif - #define SID_MAX_LEN 64 #define READ 1 diff --git a/include/snmp_pdu.h b/include/snmp_pdu.h index 133eca193d..4bb7f55f2d 100644 --- a/include/snmp_pdu.h +++ b/include/snmp_pdu.h @@ -92,38 +92,13 @@ void snmp_add_null_var(struct snmp_pdu *, oid *, int); #define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) #define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) #define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) -#ifdef UNUSED_CODE -#define SNMP_PDU_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) -#define TRP_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /*Obsolete */ -#endif #define SNMP_PDU_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) -#ifdef UNUSED_CODE -#define SNMP_PDU_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) -#define SNMP_PDU_V2TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) -#define SNMP_PDU_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) -#endif #define MAX_BINDINGS 2147483647 /* PDU Defaults */ #define SNMP_DEFAULT_ERRSTAT -1 #define SNMP_DEFAULT_ERRINDEX -1 #define SNMP_DEFAULT_ADDRESS 0 #define SNMP_DEFAULT_REQID 0 -/* RFC 1907: Management Information Base for SNMPv2 - * - * RFC 1157: A Simple Network Management Protocol (SNMP) - * - * Trap Types - */ -#if UNUSED_CODE -#define SNMP_TRAP_COLDSTART (0x0) -#define SNMP_TRAP_WARMSTART (0x1) -#define SNMP_TRAP_LINKDOWN (0x2) -#define SNMP_TRAP_LINKUP (0x3) -#define SNMP_TRAP_AUTHENTICATIONFAILURE (0x4) -#define SNMP_TRAP_EGPNEIGHBORLOSS (0x5) -#define SNMP_TRAP_ENTERPRISESPECIFIC (0x6) -#endif - #ifdef __cplusplus } #endif diff --git a/lib/heap.c b/lib/heap.c index a99cddccb3..d349d2fc5f 100644 --- a/lib/heap.c +++ b/lib/heap.c @@ -374,19 +374,6 @@ _heap_swap_element(heap * hp, heap_node * elm1, heap_node * elm2) hp->nodes[elm2->id] = elm2; } -#ifdef NOTDEF -/* - * Copy KEY and DATA fields of SRC to DEST. ID field is NOT copied. - */ -static void -_heap_copy_element(heap_node * src, heap_node * dest) -{ - dest->key = src->key; - dest->data = src->data; -} - -#endif /* NOTDEF */ - /* * True if HP needs to be grown in size. */ @@ -412,12 +399,6 @@ _heap_grow(heap * hp) newSize = hp->size * NormalRate; hp->nodes = xrealloc(hp->nodes, newSize * sizeof(heap_node *)); -#if COMMENTED_OUT - for (i = 0; i < hp->size; i++) - newNodes[i] = hp->nodes[i]; - xfree(hp->nodes); - hp->nodes = newNodes; -#endif hp->size = newSize; } diff --git a/lib/radix.c b/lib/radix.c index c0208a022d..817b2b7792 100644 --- a/lib/radix.c +++ b/lib/radix.c @@ -340,13 +340,6 @@ on1: return 0; } -#ifdef RN_DEBUG -int rn_nodenum; -struct squid_radix_node *rn_clist; -int rn_saveinfo; -int rn_debug = 1; -#endif - struct squid_radix_node * squid_rn_newpair(void *v, int b, struct squid_radix_node nodes[2]) { register struct squid_radix_node *tt = nodes, *t = tt + 1; @@ -358,13 +351,6 @@ squid_rn_newpair(void *v, int b, struct squid_radix_node nodes[2]) { tt->rn_key = (caddr_t) v; tt->rn_p = t; tt->rn_flags = t->rn_flags = RNF_ACTIVE; -#ifdef RN_DEBUG - tt->rn_info = rn_nodenum++; - t->rn_info = rn_nodenum++; - tt->rn_twin = t; - tt->rn_ybro = rn_clist; - rn_clist = tt; -#endif return t; } @@ -406,11 +392,6 @@ on1: else x = x->rn_l; } while (b > (unsigned) x->rn_b); /* x->rn_b < b && x->rn_b >= 0 */ -#ifdef RN_DEBUG - if (rn_debug) - fprintf(stderr, "squid_rn_insert: Going In:\n"); - traverse(p); -#endif t = squid_rn_newpair(v_arg, b, nodes); tt = t->rn_l; if ((cp[p->rn_off] & p->rn_bmask) == 0) @@ -425,10 +406,6 @@ on1: t->rn_r = tt; t->rn_l = x; } -#ifdef RN_DEBUG - if (rn_debug) - log(LOG_DEBUG, "squid_rn_insert: Coming Out:\n"), traverse(p); -#endif } return (tt); } @@ -606,14 +583,6 @@ squid_rn_addroute(void *v_arg, void *n_arg, struct squid_radix_node_head *head, tt->rn_dupedkey = t->rn_dupedkey; t->rn_dupedkey = tt; } -#ifdef RN_DEBUG - t = tt + 1; - tt->rn_info = rn_nodenum++; - t->rn_info = rn_nodenum++; - tt->rn_twin = t; - tt->rn_ybro = rn_clist; - rn_clist = tt; -#endif tt->rn_key = (caddr_t) v; tt->rn_b = -1; tt->rn_flags = RNF_ACTIVE; @@ -762,13 +731,6 @@ on1: */ if (tt->rn_flags & RNF_ROOT) return (0); -#ifdef RN_DEBUG - /* Get us out of the creation list */ - for (t = rn_clist; t && t->rn_ybro != tt; t = t->rn_ybro) { - } - if (t) - t->rn_ybro = tt->rn_ybro; -#endif t = tt->rn_p; if ((dupedkey = saved_tt->rn_dupedkey)) { if (tt == saved_tt) { @@ -788,15 +750,8 @@ on1: } t = tt + 1; if (t->rn_flags & RNF_ACTIVE) { -#ifndef RN_DEBUG - *++x = *t; - p = t->rn_p; -#else - b = t->rn_info; *++x = *t; - t->rn_info = b; p = t->rn_p; -#endif if (p->rn_l == t) p->rn_l = x; else @@ -836,13 +791,7 @@ on1: squid_MKFree(m); m = mm; } -#if RN_DEBUG - if (m) - fprintf(stderr, "%s %x at %x\n", - "squid_rn_delete: Orphaned Mask", (int) m, (int) x); -#else assert(m == NULL); -#endif } } /* @@ -850,13 +799,7 @@ on1: */ x = tt + 1; if (t != x) { -#ifndef RN_DEBUG - *t = *x; -#else - b = t->rn_info; *t = *x; - t->rn_info = b; -#endif t->rn_l->rn_p = t; t->rn_r->rn_p = t; p = x->rn_p; diff --git a/lib/rfc1123.c b/lib/rfc1123.c index 2d889cca49..175b6a1e9d 100644 --- a/lib/rfc1123.c +++ b/lib/rfc1123.c @@ -210,20 +210,3 @@ mkrfc1123(time_t t) return buf; } -#if 0 -int -main() -{ - char *x; - time_t t, pt; - - t = time(NULL); - x = mkrfc1123(t); - printf("HTTP Time: %s\n", x); - - pt = parse_rfc1123(x); - printf("Parsed: %d vs. %d\n", pt, t); -} - -#endif - diff --git a/lib/rfcnb/rfcnb-io.c b/lib/rfcnb/rfcnb-io.c index 60bf9451e9..326809f890 100644 --- a/lib/rfcnb/rfcnb-io.c +++ b/lib/rfcnb/rfcnb-io.c @@ -46,98 +46,10 @@ int RFCNB_Timeout = 0; /* Timeout in seconds ... */ -static int RFCNB_Discard_Rest(struct RFCNB_Con *con, int len); - -#ifdef NOT_USED -void -rfcnb_alarm(int sig) -{ - - fprintf(stderr, "IO Timed out ...\n"); - -} - -#endif /* NOT_USED */ - -#ifdef NOT_USED -/* Set timeout value and setup signal handling */ -int -RFCNB_Set_Timeout(int seconds) -{ - /* If we are on a Bezerkeley system, use sigvec, else sigaction */ - -#if ORIGINAL_SAMBA_CODE -#ifndef SA_RESTART - struct sigvec invec, outvec; -#else - struct sigaction inact, outact; -#endif - - RFCNB_Timeout = seconds; - - if (RFCNB_Timeout > 0) { /* Set up handler to ignore but not restart */ - -#ifndef SA_RESTART - invec.sv_handler = (void (*)()) rfcnb_alarm; - invec.sv_mask = 0; - invec.sv_flags = SV_INTERRUPT; - - if (sigvec(SIGALRM, &invec, &outvec) < 0) - return (-1); -#else /* !SA_RESTART */ - inact.sa_handler = (void (*)()) rfcnb_alarm; -#ifdef Solaris - /* Solaris seems to have an array of vectors ... */ - inact.sa_mask.__sigbits[0] = 0; - inact.sa_mask.__sigbits[1] = 0; - inact.sa_mask.__sigbits[2] = 0; - inact.sa_mask.__sigbits[3] = 0; -#else /* !Solaris */ - inact.sa_mask = (sigset_t) 0; -#endif /* Solaris */ - inact.sa_flags = 0; /* Don't restart */ - - if (sigaction(SIGALRM, &inact, &outact) < 0) - return (-1); - -#endif /* !SA_RESTART */ - - } -#else /* !ORIGINAL_SAMBA_CODE ADAPTED SQUID CODE */ -#if HAVE_SIGACTION - struct sigaction inact, outact; -#else - struct sigvec invec, outvec; -#endif - - RFCNB_Timeout = seconds; - - if (RFCNB_Timeout > 0) { /* Set up handler to ignore but not restart */ - -#if HAVE_SIGACTION - inact.sa_handler = (void (*)()) rfcnb_alarm; - sigemptyset(&inact.sa_mask); - inact.sa_flags = 0; /* Don't restart */ - - if (sigaction(SIGALRM, &inact, &outact) < 0) - return (-1); -#else /* !HAVE_SIGACTION */ - invec.sv_handler = (void (*)()) rfcnb_alarm; - invec.sv_mask = 0; - invec.sv_flags = SV_INTERRUPT; - - if (sigvec(SIGALRM, &invec, &outvec) < 0) - return (-1); -#endif /* !HAVE_SIGACTION */ - } -#endif /* !ORIGINAL_SAMBA_CODE ADAPTED SQUID CODE */ - return (0); -} -#endif /* NOT_USED */ - /* Discard the rest of an incoming packet as we do not have space for it * in the buffer we allocated or were passed ... */ +static int RFCNB_Discard_Rest(struct RFCNB_Con *con, int len) { diff --git a/lib/rfcnb/rfcnb-priv.h b/lib/rfcnb/rfcnb-priv.h index 92bba71d1b..4f40e74a46 100644 --- a/lib/rfcnb/rfcnb-priv.h +++ b/lib/rfcnb/rfcnb-priv.h @@ -121,35 +121,6 @@ typedef char RFCNB_Hdr[4]; /* The header is 4 bytes long with */ #define RFCNB_Pkt_Type(p) (CVAL((p), RFCNB_Pkt_Type_Offset)) -#if UNUSED_CODE -typedef struct RFCNB_Hdr { - unsigned char type; - unsigned char flags; - int16 len; -} RFCNB_Hdr; - -typedef struct RFCNB_Sess_Pkt { - unsigned char type; - unsigned char flags; - int16 length; - unsigned char n1_len; - char called_name[33]; - unsigned char n2_len; - char calling_name[33]; -} RFCNB_Sess_Pkt; - -typedef struct RFCNB_Nack_Pkt { - struct RFCNB_Hdr hdr; - unsigned char error; -} RFCNB_Nack_Pkt; - -typedef struct RFCNB_Retarget_Pkt { - struct RFCNB_Hdr hdr; - int dest_ip; - unsigned char port; -} RFCNB_Redir_Pkt; -#endif /* UNUSED_CODE */ - /* Static variables */ /* Only declare this if not defined */ diff --git a/lib/smblib/smbencrypt.c b/lib/smblib/smbencrypt.c index 8b1f643cf0..2aca26a070 100644 --- a/lib/smblib/smbencrypt.c +++ b/lib/smblib/smbencrypt.c @@ -194,29 +194,9 @@ void strupper(char *s) { while (*s) { -#if UNUSED_CODE -#if !defined(KANJI_WIN95_COMPATIBILITY) - if (lp_client_code_page() == KANJI_CODEPAGE) { - - if (is_shift_jis(*s)) { - if (is_sj_lower(s[0], s[1])) - s[1] = sj_toupper2(s[1]); - s += 2; - } else if (is_kana(*s)) { - s++; - } else { - if (islower((int)(unsigned char)*s)) - *s = toupper((int)(unsigned char)*s); - s++; - } - } else -#endif /* KANJI_WIN95_COMPATIBILITY */ -#endif /* UNUSED_CODE */ - { - if (islower((int)(unsigned char)*s)) - *s = toupper((int)(unsigned char)*s); - s++; - } + if (islower((int)(unsigned char)*s)) + *s = toupper((int)(unsigned char)*s); + s++; } } diff --git a/lib/snmplib/asn1.c b/lib/snmplib/asn1.c index 155b05be2e..708d626237 100644 --- a/lib/snmplib/asn1.c +++ b/lib/snmplib/asn1.c @@ -527,42 +527,6 @@ asn_build_header_with_truth(u_char * data, int *datalength, return (asn_build_length(data, datalength, length, truth)); } -#if 0 -/* - * asn_build_sequence - builds an ASN header for a sequence with the ID and - * length specified. - * On entry, datalength is input as the number of valid bytes following - * "data". On exit, it is returned as the number of valid bytes - * in this object following the id and length. - * - * This only works on data types < 30, i.e. no extension octets. - * The maximum length is 0xFFFF; - * - * Returns a pointer to the first byte of the contents of this object. - * Returns NULL on any error. - */ -u_char * -asn_build_sequence(u_char * data, int *datalength, - u_char type, int length) -/* u_char *data; IN - pointer to start of object */ -/* int *datalength; IN/OUT - # of valid bytes left in buffer */ -/* u_char type; IN - ASN type of object */ -/* int length; IN - length of object */ -{ - *datalength -= 4; - if (*datalength < 0) { - *datalength += 4; /* fix up before punting */ - snmp_set_api_error(SNMPERR_ASN_ENCODE); - return (NULL); - } - *data++ = type; - *data++ = (u_char) (0x02 | ASN_LONG_LEN); - *data++ = (u_char) ((length >> 8) & 0xFF); - *data++ = (u_char) (length & 0xFF); - return (data); -} -#endif - /* * asn_parse_length - interprets the length of the current object. * On exit, length contains the value of this length field. @@ -825,43 +789,6 @@ asn_build_objid(u_char * data, int *datalength, return (data + asnlength); } -#if 0 -/* - * asn_parse_null - Interprets an ASN null type. - * On entry, datalength is input as the number of valid bytes following - * "data". On exit, it is returned as the number of valid bytes - * following the beginning of the next object. - * - * Returns a pointer to the first byte past the end - * of this object (i.e. the start of the next object). - * Returns NULL on any error. - */ -u_char * -asn_parse_null(u_char * data, int *datalength, u_char * type) -/* u_char *data; IN - pointer to start of object */ -/* int *datalength; IN/OUT - # of valid bytes left in buf */ -/* u_char *type; OUT - ASN type of object */ -{ - /* - * ASN.1 null ::= 0x05 0x00 - */ - u_char *bufp = data; - u_int asn_length; - - *type = *bufp++; - bufp = asn_parse_length(bufp, &asn_length); - if (bufp == NULL) - return (NULL); - - if (asn_length != 0) { - snmp_set_api_error(SNMPERR_ASN_DECODE); - return (NULL); - } - *datalength -= (bufp - data); - return (bufp + asn_length); -} -#endif - /* * asn_build_null - Builds an ASN null object. * On entry, datalength is input as the number of valid bytes following @@ -884,104 +811,6 @@ asn_build_null(u_char * data, int *datalength, u_char type) return (asn_build_header_with_truth(data, datalength, type, 0, 1)); } -#if 0 - -/* - * asn_parse_bitstring - pulls a bitstring out of an ASN bitstring type. - * On entry, datalength is input as the number of valid bytes following - * "data". On exit, it is returned as the number of valid bytes - * following the beginning of the next object. - * - * "string" is filled with the bit string. - * - * Returns a pointer to the first byte past the end - * of this object (i.e. the start of the next object). - * Returns NULL on any error. - */ -u_char * -asn_parse_bitstring(u_char * data, int *datalength, - u_char * type, u_char * string, int *strlength) -/* u_char *data; IN - pointer to start of object */ -/* int *datalength; IN/OUT - # of valid bytes left in buf */ -/* u_char *type; OUT - asn type of object */ -/* u_char *string; IN/OUT - pointer to start of output buf */ -/* int *strlength; IN/OUT - size of output buffer */ -{ - /* - * bitstring ::= 0x03 asnlength unused {byte}* - */ - u_char *bufp = data; - u_int asn_length; - - *type = *bufp++; - bufp = asn_parse_length(bufp, &asn_length); - if (bufp == NULL) - return (NULL); - - if (asn_length + (bufp - data) > *datalength) { - snmp_set_api_error(SNMPERR_ASN_DECODE); - return (NULL); - } - if (asn_length > *strlength) { - snmp_set_api_error(SNMPERR_ASN_DECODE); - return (NULL); - } - if (asn_length < 1) { - snmp_set_api_error(SNMPERR_ASN_DECODE); - return (NULL); - } - if ((int) (*(char *) bufp) < 0 || (int) (*bufp) > 7) { - snmp_set_api_error(SNMPERR_ASN_DECODE); - return (NULL); - } - memcpy((char *) string, (char *) bufp, (int) asn_length); - *strlength = (int) asn_length; - *datalength -= (int) asn_length + (bufp - data); - return (bufp + asn_length); -} - -/* - * asn_build_bitstring - Builds an ASN bit string object containing the - * input string. - * On entry, datalength is input as the number of valid bytes following - * "data". On exit, it is returned as the number of valid bytes - * following the beginning of the next object. - * - * Returns a pointer to the first byte past the end - * of this object (i.e. the start of the next object). - * Returns NULL on any error. - */ -u_char * -asn_build_bitstring(u_char * data, int *datalength, - u_char type, u_char * string, int strlength) -/* u_char *data; IN - pointer to start of object */ -/* int *datalength; IN/OUT - # of valid bytes left in buf */ -/* u_char type; IN - ASN type of string */ -/* u_char *string; IN - pointer to start of input buffer */ -/* int strlength; IN - size of input buffer */ -{ - /* - * ASN.1 bit string ::= 0x03 asnlength unused {byte}* - */ - if ((strlength < 1) || ((*(char *) string) < 0) || ((*string) > 7)) { - snmp_set_api_error(SNMPERR_ASN_ENCODE); - return (NULL); - } - data = asn_build_header_with_truth(data, datalength, type, strlength, 1); - if (data == NULL) - return (NULL); - - if (*datalength < strlength) { - snmp_set_api_error(SNMPERR_ASN_ENCODE); - return (NULL); - } - memcpy((char *) data, (char *) string, strlength); - *datalength -= strlength; - return (data + strlength); -} - -#endif - /* * To do: Write an asn_parse_exception function to go with the new * asn_build_exception function below so that the exceptional values can diff --git a/lib/snmplib/parse.c b/lib/snmplib/parse.c index e07897b86a..ee320a2047 100644 --- a/lib/snmplib/parse.c +++ b/lib/snmplib/parse.c @@ -273,29 +273,6 @@ print_error(const char *string, const char *token, int type) snmplib_debug(0, "%s: On or around line %d\n", string, Line); } -#if TEST -print_subtree(tree, count) -struct snmp_mib_tree *tree; -int count; -{ - struct snmp_mib_tree *tp; - int i; - - for (i = 0; i < count; i++) - printf(" "); - printf("Children of %s:\n", tree->label); - count++; - for (tp = tree->child_list; tp; tp = tp->next_peer) { - for (i = 0; i < count; i++) - printf(" "); - printf("%s\n", tp->label); - } - for (tp = tree->child_list; tp; tp = tp->next_peer) { - print_subtree(tp, count); - } -} -#endif /* TEST */ - int translation_table[40]; static void @@ -426,9 +403,7 @@ do_subtree(struct snmp_mib_tree *root, struct node **nodes) xfree(oldnp); } -#if !TEST static -#endif struct snmp_mib_tree * build_tree(struct node *nodes) { struct node *np; @@ -449,9 +424,6 @@ build_tree(struct node *nodes) { init_node_hash(nodes); /* XXX nodes isn't needed in do_subtree() ??? */ do_subtree(tp, &nodes); -#if TEST - print_subtree(tp, 0); -#endif /* TEST */ /* If any nodes are left, the tree is probably inconsistent */ for (bucket = 0; bucket < NHASHSIZE; bucket++) { if (nbuckets[bucket]) { @@ -988,9 +960,7 @@ parse_objecttype(register FILE *fp, char *name) { * Parses a mib file and returns a linked list of nodes found in the file. * Returns NULL on error. */ -#if !TEST static -#endif struct node * parse(FILE *fp) { char token[64]; @@ -1061,22 +1031,6 @@ parse(FILE *fp) { return NULL; } } -#if TEST - { - struct enum_list *ep; - - for (np = root; np; np = np->next) { - printf("%s ::= { %s %d } (%d)\n", np->label, np->parent, np->subid, - np->type); - if (np->enums) { - printf("Enums: \n"); - for (ep = np->enums; ep; ep = ep->next) { - printf("%s(%d)\n", ep->label, ep->value); - } - } - } - } -#endif /* TEST */ return root; } diff --git a/lib/snmplib/snmp_pdu.c b/lib/snmplib/snmp_pdu.c index b82c621418..9bc1b68f9a 100644 --- a/lib/snmplib/snmp_pdu.c +++ b/lib/snmplib/snmp_pdu.c @@ -490,10 +490,6 @@ snmp_pdu_decode(u_char * Packet, /* data */ u_char *bufp; u_char PDUType; u_char ASNType; -#if UNUSED_CODE - int four; - oid objid[MAX_NAME_LEN]; -#endif bufp = asn_parse_header(Packet, Length, &PDUType); if (bufp == NULL) diff --git a/lib/snmplib/snmp_vars.c b/lib/snmplib/snmp_vars.c index 76c8de80e2..351245e69d 100644 --- a/lib/snmplib/snmp_vars.c +++ b/lib/snmplib/snmp_vars.c @@ -88,13 +88,10 @@ #include "asn1.h" #include "snmp.h" -#include "snmp_vars.h" -#if 0 -#include "mibii.h" -#endif #include "snmp_api_error.h" #include "snmp_msg.h" #include "snmp_pdu.h" +#include "snmp_vars.h" #include "util.h" diff --git a/src/CacheDigest.cc b/src/CacheDigest.cc index ce4af263d5..609fcd0048 100644 --- a/src/CacheDigest.cc +++ b/src/CacheDigest.cc @@ -110,40 +110,29 @@ CacheDigest::add(const cache_key * key) /* hash */ cacheDigestHashKey(this, key); /* turn on corresponding bits */ -#if CD_FAST_ADD + int on_xition_cnt = 0; - CBIT_SET(mask, hashed_keys[0]); - CBIT_SET(mask, hashed_keys[1]); - CBIT_SET(mask, hashed_keys[2]); - CBIT_SET(mask, hashed_keys[3]); -#else - - { - int on_xition_cnt = 0; - - if (!CBIT_TEST(mask, hashed_keys[0])) { - CBIT_SET(mask, hashed_keys[0]); - ++on_xition_cnt; - } - - if (!CBIT_TEST(mask, hashed_keys[1])) { - CBIT_SET(mask, hashed_keys[1]); - ++on_xition_cnt; - } + if (!CBIT_TEST(mask, hashed_keys[0])) { + CBIT_SET(mask, hashed_keys[0]); + ++on_xition_cnt; + } - if (!CBIT_TEST(mask, hashed_keys[2])) { - CBIT_SET(mask, hashed_keys[2]); - ++on_xition_cnt; - } + if (!CBIT_TEST(mask, hashed_keys[1])) { + CBIT_SET(mask, hashed_keys[1]); + ++on_xition_cnt; + } - if (!CBIT_TEST(mask, hashed_keys[3])) { - CBIT_SET(mask, hashed_keys[3]); - ++on_xition_cnt; - } + if (!CBIT_TEST(mask, hashed_keys[2])) { + CBIT_SET(mask, hashed_keys[2]); + ++on_xition_cnt; + } - statCounter.cd.on_xition_count.count(on_xition_cnt); + if (!CBIT_TEST(mask, hashed_keys[3])) { + CBIT_SET(mask, hashed_keys[3]); + ++on_xition_cnt; } -#endif + + statCounter.cd.on_xition_count.count(on_xition_cnt); ++count; } diff --git a/src/ConfigParser.cc b/src/ConfigParser.cc index 2e07193579..55b3b42130 100644 --- a/src/ConfigParser.cc +++ b/src/ConfigParser.cc @@ -190,16 +190,6 @@ ConfigParser::UnQuote(const char *token, const char **next) *d = *s; break; } -#if 0 - } else if (*s == '$' && quoteChar == '"') { - errorStr = "Unsupported cfg macro"; - errorPos = s; -#endif -#if 0 - } else if (*s == '%' && quoteChar == '"' && (!AllowMacros_ )) { - errorStr = "Macros are not supported here"; - errorPos = s; -#endif } else *d = *s; ++s; diff --git a/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc b/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc index dda229da0e..53693396b2 100644 --- a/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc +++ b/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc @@ -35,15 +35,7 @@ DiskDaemonDiskIOModule::init() */ assert(!initialised); memset(&diskd_stats, '\0', sizeof(diskd_stats)); -#if 0 - /* - * DPW 2007-04-12 - * No debugging here please because this method is called before - * the debug log is configured and we'll get the message on - * stderr when doing things like 'squid -k reconfigure' - */ - debugs(47, DBG_IMPORTANT, "diskd started"); -#endif + initialised = true; registerWithCacheManager(); diff --git a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc index 2e501385db..3a9ce33041 100644 --- a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc +++ b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc @@ -544,10 +544,6 @@ DiskdIOStrategy::callback() } while (1) { -#ifdef ALWAYS_ZERO_BUFFERS - memset(&M, '\0', sizeof(M)); -#endif - x = msgrcv(rmsgid, &M, diomsg::msg_snd_rcv_sz, 0, IPC_NOWAIT); if (x < 0) diff --git a/src/MemObject.cc b/src/MemObject.cc index d214124910..5186934ac8 100644 --- a/src/MemObject.cc +++ b/src/MemObject.cc @@ -120,15 +120,6 @@ MemObject::~MemObject() data_hdr.freeContent(); -#if 0 - /* - * There is no way to abort FD-less clients, so they might - * still have mem->clients set. - */ - assert(clients.head == NULL); - -#endif - ctx_exit(ctx); /* must exit before we free mem->url */ } @@ -166,10 +157,6 @@ void MemObject::dump() const { data_hdr.dump(); -#if 0 - /* do we want this one? */ - debugs(20, DBG_IMPORTANT, "MemObject->data.origin_offset: " << (data_hdr.head ? data_hdr.head->nodeBuffer.offset : 0)); -#endif debugs(20, DBG_IMPORTANT, "MemObject->start_ping: " << start_ping); debugs(20, DBG_IMPORTANT, "MemObject->inmem_hi: " << data_hdr.endOffset()); @@ -483,19 +470,6 @@ MemObject::mostBytesAllowed() const for (dlink_node *node = clients.head; node; node = node->next) { store_client *sc = (store_client *) node->data; -#if 0 - /* This test is invalid because the client may be writing data - * and thus will want data immediately. - * If we include the test, there is a race condition when too much - * data is read - if all sc's are writing when a read is scheduled. - * XXX: fixme. - */ - - if (!sc->callbackPending()) - /* not waiting for more data */ - continue; - -#endif j = sc->delayId.bytesWanted(0, sc->copyInto.length); diff --git a/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc b/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc index af20125439..c9eacb81fc 100644 --- a/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc +++ b/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc @@ -407,63 +407,6 @@ InitConf() edui_conf.persist_timeout = -1; edui_conf.mode = 0; edui_conf.mode |= EDUI_MODE_INIT; - - /* Set defaults from compile-time-options, if provided, but depriciated. */ -#ifdef EDUI_BASE_DN - xstrncpy(edui_conf.basedn, EDUI_BASE_DN, sizeof(edui_conf.basedn)); -#endif -#ifdef EDUI_DEFAULT_HOST - xstrncpy(edui_conf.host, EDUI_DEFAULT_HOST, sizeof(edui_conf.host)); -#endif -#ifdef EDUI_BIND_DN - xstrncpy(edui_conf.dn, EDUI_BIND_DN, sizeof(edui_conf.dn)); -#endif -#ifdef EDUI_BIND_PASS - xstrncpy(edui_conf.passwd, EDUI_BIND_PASS, sizeof(edui_conf.passwd)); -#endif -#ifdef EDUI_USER_ATTRIB - xstrncpy(edui_conf.attrib, EDUI_USER_ATTRIB, sizeof(edui_conf.attrib)); -#endif -#ifdef EDUI_SEARCH_FILTER - xstrncpy(edui_conf.search_filter, EDUI_SEARCH_FILTER, sizeof(edui_conf.search_filter)); -#endif -#ifdef EDUI_SEARCH_SCOPE - if (!strcmp(EDUI_SEARCH_SCOPE, "base")) - edui_conf.scope = 0; - else if (!strcmp(EDUI_SEARCH_SCOPE, "one")) - edui_conf.scope = 1; - else if (!strcmp(EDUI_SEARCH_SCOPE, "sub")) - edui_conf.scope = 2; - else - edui_conf.scope = 1; -#endif -#ifdef EDUI_LDAP_VERSION - edui_conf.ver = EDUI_LDAP_VERSION; -#endif -#ifdef EDUI_DEFAULT_PORT - edui_conf.port = EDUI_DEFAULT_PORT; -#endif -#ifdef EDUI_FORCE_IPV4 - edui_conf.mode |= EDUI_MODE_IPV4; -#endif -#ifdef EDUI_FORCE_IPV6 - edui_conf.mode |= EDUI_MODE_IPV6; -#endif -#ifdef EDUI_USE_TLS - edui_conf.mode |= EDUI_MODE_TLS; -#endif -#ifdef EDUI_USE_PERSIST - edui_conf.mode |= EDUI_MODE_PERSIST; -#endif -#ifdef EDUI_PERSIST_TIMEOUT - edui_conf.persist_timeout = EDUI_PERSIST_TIMEOUT; -#endif -#ifdef EDUI_GROUP_REQUIRED - edui_conf.mode |= EDUI_MODE_GROUP; -#endif -#ifdef EDUI_DEBUG - edui_conf.mode |= EDUI_MODE_DEBUG; -#endif } /* Displays running configuration */ diff --git a/src/adaptation/icap/ServiceRep.cc b/src/adaptation/icap/ServiceRep.cc index beba3887cb..98dd0f21d1 100644 --- a/src/adaptation/icap/ServiceRep.cc +++ b/src/adaptation/icap/ServiceRep.cc @@ -379,16 +379,6 @@ void Adaptation::Icap::ServiceRep::noteTimeToUpdate() startGettingOptions(); } -#if 0 -static -void Adaptation::Icap::ServiceRep_noteTimeToNotify(void *data) -{ - Adaptation::Icap::ServiceRep *service = static_cast(data); - Must(service); - service->noteTimeToNotify(); -} -#endif - void Adaptation::Icap::ServiceRep::noteTimeToNotify() { Must(!notifying); diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index de561d975d..e4e539ee46 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -236,20 +236,6 @@ Adaptation::Icap::Xaction::dnsLookupDone(const ipcache_addrs *ia) AsyncJob::Start(cs.get()); } -/* - * This event handler is necessary to work around the no-rentry policy - * of Adaptation::Icap::Xaction::callStart() - */ -#if 0 -void -Adaptation::Icap::Xaction::reusedConnection(void *data) -{ - debugs(93, 5, HERE << "reused connection"); - Adaptation::Icap::Xaction *x = (Adaptation::Icap::Xaction*)data; - x->noteCommConnected(Comm::OK); -} -#endif - void Adaptation::Icap::Xaction::closeConnection() { if (haveConnection()) { diff --git a/src/anyp/Uri.cc b/src/anyp/Uri.cc index 22e8d374a6..a9c5b5970b 100644 --- a/src/anyp/Uri.cc +++ b/src/anyp/Uri.cc @@ -464,15 +464,6 @@ AnyP::Uri::parse(const HttpRequestMethod& method, const SBuf &rawUrl) return false; } -#if HARDCODE_DENY_PORTS - /* These ports are filtered in the default squid.conf, but - * maybe someone wants them hardcoded... */ - if (foundPort == 7 || foundPort == 9 || foundPort == 19) { - debugs(23, DBG_CRITICAL, MYNAME << "Deny access to port " << foundPort); - return false; - } -#endif - if (stringHasWhitespace(urlpath)) { debugs(23, 2, "URI has whitespace: {" << rawUrl << "}"); diff --git a/src/auth/digest/Config.cc b/src/auth/digest/Config.cc index bc881ef5dd..968e242c85 100644 --- a/src/auth/digest/Config.cc +++ b/src/auth/digest/Config.cc @@ -192,13 +192,6 @@ authenticateDigestNonceDelete(digest_nonce_h * nonce) { if (nonce) { assert(nonce->references == 0); -#if UNREACHABLECODE - - if (nonce->flags.incache) - hash_remove_link(digest_nonce_cache, nonce); - -#endif - assert(!nonce->flags.incache); safe_free(nonce->key); @@ -238,13 +231,6 @@ authenticateDigestNonceShutdown(void) } } -#if DEBUGSHUTDOWN - if (digest_nonce_pool) { - delete digest_nonce_pool; - digest_nonce_pool = NULL; - } - -#endif debugs(29, 2, "Nonce cache shutdown"); } diff --git a/src/auth/digest/eDirectory/edir_ldapext.cc b/src/auth/digest/eDirectory/edir_ldapext.cc index ad1976b869..fff0115cb1 100644 --- a/src/auth/digest/eDirectory/edir_ldapext.cc +++ b/src/auth/digest/eDirectory/edir_ldapext.cc @@ -504,9 +504,6 @@ int nds_get_password( rc = nmasldap_get_password(ld, object_dn, pwd_len, (unsigned char *)pwd); if (rc == LDAP_SUCCESS) { -#ifdef DEBUG_PASSWORD - DEBUG(100,("nmasldap_get_password returned %s for %s\n", pwd, object_dn)); -#endif DEBUG(5, ("NDS Universal Password retrieved for %s\n", object_dn)); } else { DEBUG(3, ("NDS Universal Password NOT retrieved for %s\n", object_dn)); @@ -515,9 +512,6 @@ int nds_get_password( if (rc != LDAP_SUCCESS) { rc = nmasldap_get_simple_pwd(ld, object_dn, *pwd_len, pwd); if (rc == LDAP_SUCCESS) { -#ifdef DEBUG_PASSWORD - DEBUG(100,("nmasldap_get_simple_pwd returned %s for %s\n", pwd, object_dn)); -#endif DEBUG(5, ("NDS Simple Password retrieved for %s\n", object_dn)); } else { /* We couldn't get the password */ diff --git a/src/cache_cf.cc b/src/cache_cf.cc index ef4dec77f6..46ea3facf3 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -3068,14 +3068,6 @@ free_time_nanoseconds(std::chrono::nanoseconds *var) *var = std::chrono::nanoseconds::zero(); } -#if UNUSED_CODE -static void -dump_size_t(StoreEntry * entry, const char *name, size_t var) -{ - storeAppendPrintf(entry, "%s %d\n", name, (int) var); -} -#endif - static void dump_b_size_t(StoreEntry * entry, const char *name, size_t var) { @@ -3088,14 +3080,6 @@ dump_b_ssize_t(StoreEntry * entry, const char *name, ssize_t var) storeAppendPrintf(entry, "%s %d %s\n", name, (int) var, B_BYTES_STR); } -#if UNUSED_CODE -static void -dump_kb_size_t(StoreEntry * entry, const char *name, size_t var) -{ - storeAppendPrintf(entry, "%s %d %s\n", name, (int) var, B_KBYTES_STR); -} -#endif - static void dump_b_int64_t(StoreEntry * entry, const char *name, int64_t var) { @@ -3108,16 +3092,6 @@ dump_kb_int64_t(StoreEntry * entry, const char *name, int64_t var) storeAppendPrintf(entry, "%s %" PRId64 " %s\n", name, var, B_KBYTES_STR); } -#if UNUSED_CODE -static void -parse_size_t(size_t * var) -{ - int i; - i = GetInteger(); - *var = (size_t) i; -} -#endif - static void parse_b_size_t(size_t * var) { @@ -3130,14 +3104,6 @@ parse_b_ssize_t(ssize_t * var) parseBytesLineSigned(var, B_BYTES_STR); } -#if UNUSED_CODE -static void -parse_kb_size_t(size_t * var) -{ - parseBytesLine(var, B_KBYTES_STR); -} -#endif - static void parse_b_int64_t(int64_t * var) { @@ -3235,14 +3201,6 @@ parse_wordlist(wordlist ** list) wordlistAdd(list, token); } -#if 0 /* now unused */ -static int -check_null_wordlist(wordlist * w) -{ - return w == NULL; -} -#endif - static int check_null_acl_access(acl_access * a) { diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 56400a6cc0..edbf86e338 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -14,8 +14,8 @@ #include "CacheManager.h" #include "comm/Connection.h" #include "Debug.h" -#include "errorpage.h" #include "error/ExceptionErrorDetail.h" +#include "errorpage.h" #include "fde.h" #include "HttpReply.h" #include "HttpRequest.h" @@ -487,3 +487,4 @@ CacheManager::GetInstance() } return instance; } + diff --git a/src/cf_gen.cc b/src/cf_gen.cc index 9e1cab3f93..a59ec05fa8 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -383,11 +383,9 @@ main(int argc, char *argv[]) entries.back().cfgLines.push_back(buff); } break; -#if 0 case sEXIT: assert(0); /* should never get here */ break; -#endif } } diff --git a/src/client_side.cc b/src/client_side.cc index 586d6ba954..69175d4dc6 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -148,10 +148,6 @@ #include #endif -#if LINGERING_CLOSE -#define comm_close comm_lingering_close -#endif - /// dials clientListenerConnectionOpened call class ListeningStartedDialer: public CallDialer, public Ipc::StartListeningCb { diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 1512772704..5b962e0821 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1129,38 +1129,6 @@ clientReplyContext::storeNotOKTransferDone() const } } -/* A write has completed, what is the next status based on the - * canonical request data? - * 1 something is wrong - * 0 nothing is wrong. - * - */ -int -clientHttpRequestStatus(int fd, ClientHttpRequest const *http) -{ -#if SIZEOF_INT64_T == 4 - if (http->out.size > 0x7FFF0000) { - debugs(88, DBG_IMPORTANT, "WARNING: closing FD " << fd << " to prevent out.size counter overflow"); - if (http->getConn()) - debugs(88, DBG_IMPORTANT, "\tclient " << http->getConn()->peer); - debugs(88, DBG_IMPORTANT, "\treceived " << http->out.size << " bytes"); - debugs(88, DBG_IMPORTANT, "\tURI " << http->log_uri); - return 1; - } - - if (http->out.offset > 0x7FFF0000) { - debugs(88, DBG_IMPORTANT, "WARNING: closing FD " << fd < " to prevent out.offset counter overflow"); - if (http->getConn()) - debugs(88, DBG_IMPORTANT, "\tclient " << http->getConn()->peer); - debugs(88, DBG_IMPORTANT, "\treceived " << http->out.size << " bytes, offset " << http->out.offset); - debugs(88, DBG_IMPORTANT, "\tURI " << http->log_uri); - return 1; - } - -#endif - return 0; -} - /* Preconditions: * *http is a valid structure. * fd is either -1, or an open fd. @@ -1284,11 +1252,6 @@ clientReplyContext::buildReplyHeader() HttpHeader *hdr = &reply->header; const bool is_hit = http->logType.isTcpHit(); HttpRequest *request = http->request; -#if DONT_FILTER_THESE - /* but you might want to if you run Squid as an HTTP accelerator */ - /* hdr->delById(HDR_ACCEPT_RANGES); */ - hdr->delById(HDR_ETAG); -#endif if (is_hit || collapsedRevalidation == crSlave) hdr->delById(Http::HdrType::SET_COOKIE); diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 108ea935b2..bd1c3e4170 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -74,10 +74,6 @@ #include "ssl/support.h" #endif -#if LINGERING_CLOSE -#define comm_close comm_lingering_close -#endif - static const char *const crlf = "\r\n"; #if FOLLOW_X_FORWARDED_FOR diff --git a/src/client_side_request.h b/src/client_side_request.h index 8eab98419d..55a2c63b5a 100644 --- a/src/client_side_request.h +++ b/src/client_side_request.h @@ -248,7 +248,6 @@ char *clientConstructTraceEcho(ClientHttpRequest *); ACLFilledChecklist *clientAclChecklistCreate(const acl_access * acl,ClientHttpRequest * http); void clientAclChecklistFill(ACLFilledChecklist &, ClientHttpRequest *); -int clientHttpRequestStatus(int fd, ClientHttpRequest const *http); void clientAccessCheck(ClientHttpRequest *); /* ones that should be elsewhere */ diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc index c21b48b692..33d6dbfdd1 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -208,9 +208,6 @@ static FTPSM ftpSendMdtm; static FTPSM ftpReadMdtm; static FTPSM ftpSendSize; static FTPSM ftpReadSize; -#if 0 -static FTPSM ftpSendEPRT; -#endif static FTPSM ftpReadEPRT; static FTPSM ftpSendPORT; static FTPSM ftpReadPORT; @@ -1849,51 +1846,6 @@ ftpReadPORT(Ftp::Gateway * ftpState) ftpRestOrList(ftpState); } -#if 0 -static void -ftpSendEPRT(Ftp::Gateway * ftpState) -{ - /* check the server control channel is still available */ - if (!ftpState || !ftpState->haveControlChannel("ftpSendEPRT")) - return; - - if (Config.Ftp.epsv_all && ftpState->flags.epsv_all_sent) { - debugs(9, DBG_IMPORTANT, "FTP does not allow EPRT method after 'EPSV ALL' has been sent."); - return; - } - - if (!Config.Ftp.eprt) { - /* Disabled. Switch immediately to attempting old PORT command. */ - debugs(9, 3, "EPRT disabled by local administrator"); - ftpSendPORT(ftpState); - return; - } - - debugs(9, 3, HERE); - ftpState->flags.pasv_supported = 0; - - ftpOpenListenSocket(ftpState, 0); - debugs(9, 3, "Listening for FTP data connection with FD " << ftpState->data.conn); - if (!Comm::IsConnOpen(ftpState->data.conn)) { - /* XXX Need to set error message */ - ftpFail(ftpState); - return; - } - - char buf[MAX_IPSTRLEN]; - - /* RFC 2428 defines EPRT as IPv6 equivalent to IPv4 PORT command. */ - /* Which can be used by EITHER protocol. */ - snprintf(cbuf, CTRL_BUFLEN, "EPRT |%d|%s|%d|\r\n", - ( ftpState->data.listenConn->local.isIPv6() ? 2 : 1 ), - ftpState->data.listenConn->local.toStr(buf,MAX_IPSTRLEN), - ftpState->data.listenConn->local.port() ); - - ftpState->writeCommand(cbuf); - ftpState->state = Ftp::Client::SENT_EPRT; -} -#endif - static void ftpReadEPRT(Ftp::Gateway * ftpState) { diff --git a/src/comm.cc b/src/comm.cc index 5bfb3f2e25..5c049a91d2 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -748,58 +748,6 @@ commCallCloseHandlers(int fd) } } -// XXX: This code has been broken, unused, and untested since 933dd09. Remove. -#if LINGERING_CLOSE -static void -commLingerClose(int fd, void *unused) -{ - LOCAL_ARRAY(char, buf, 1024); - int n = FD_READ_METHOD(fd, buf, 1024); - if (n < 0) { - int xerrno = errno; - debugs(5, 3, "FD " << fd << " read: " << xstrerr(xerrno)); - } - comm_close(fd); -} - -static void -commLingerTimeout(const FdeCbParams ¶ms) -{ - debugs(5, 3, "commLingerTimeout: FD " << params.fd); - comm_close(params.fd); -} - -/* - * Inspired by apache - */ -void -comm_lingering_close(int fd) -{ - Security::SessionSendGoodbye(fd_table[fd].ssl); - - if (shutdown(fd, 1) < 0) { - comm_close(fd); - return; - } - - fd_note(fd, "lingering close"); - AsyncCall::Pointer call = commCbCall(5,4, "commLingerTimeout", FdeCbPtrFun(commLingerTimeout, NULL)); - - debugs(5, 3, HERE << "FD " << fd << " timeout " << timeout); - assert(fd_table[fd].flags.open); - if (callback != NULL) { - typedef FdeCbParams Params; - Params ¶ms = GetCommParams(callback); - params.fd = fd; - fd_table[fd].timeoutHandler = callback; - fd_table[fd].timeout = squid_curtime + static_cast(10); - } - - Comm::SetSelect(fd, COMM_SELECT_READ, commLingerClose, NULL, 0); -} - -#endif - /** * enable linger with time of 0 so that when the socket is * closed, TCP generates a RESET diff --git a/src/comm.h b/src/comm.h index c963e1ca39..2e9dea96fa 100644 --- a/src/comm.h +++ b/src/comm.h @@ -28,9 +28,6 @@ void _comm_close(int fd, char const *file, int line); #define comm_close(x) (_comm_close((x), __FILE__, __LINE__)) void old_comm_reset_close(int fd); void comm_reset_close(const Comm::ConnectionPointer &conn); -#if LINGERING_CLOSE -void comm_lingering_close(int fd); -#endif int comm_connect_addr(int sock, const Ip::Address &addr); void comm_init(void); diff --git a/src/comm/ModSelect.cc b/src/comm/ModSelect.cc index e5d6c4fe97..5fb821816d 100644 --- a/src/comm/ModSelect.cc +++ b/src/comm/ModSelect.cc @@ -317,7 +317,6 @@ comm_select_tcp_incoming(void) statCounter.comm_tcp_incoming.count(nevents); } -#define DEBUG_FDBITS 0 /* Select on all sockets; call handlers for those that are ready. */ Comm::Flag Comm::DoSelect(int msec) @@ -335,11 +334,6 @@ Comm::DoSelect(int msec) int maxindex; unsigned int k; int j; -#if DEBUG_FDBITS - - int i; -#endif - fd_mask *fdsp; fd_mask *pfdsp; fd_mask tmask; @@ -399,20 +393,6 @@ Comm::DoSelect(int msec) } } -#if DEBUG_FDBITS - for (i = 0; i < maxfd; ++i) { - /* Check each open socket for a handler. */ - - if (fd_table[i].read_handler) { - assert(FD_ISSET(i, &readfds)); - } - - if (fd_table[i].write_handler) { - assert(FD_ISSET(i, &writefds)); - } - } - -#endif if (nreadfds + nwritefds == 0) { assert(shutting_down); return Comm::SHUTDOWN; @@ -482,14 +462,6 @@ Comm::DoSelect(int msec) EBIT_CLR(tmask, k); /* this will be done */ -#if DEBUG_FDBITS - - debugs(5, 9, "FD " << fd << " bit set for reading"); - - assert(FD_ISSET(fd, &readfds)); - -#endif - if (fdIsUdpListener(fd)) { calludp = 1; continue; @@ -546,14 +518,6 @@ Comm::DoSelect(int msec) EBIT_CLR(tmask, k); /* this will be done */ -#if DEBUG_FDBITS - - debugs(5, 9, "FD " << fd << " bit set for writing"); - - assert(FD_ISSET(fd, &writefds)); - -#endif - if (fdIsUdpListener(fd)) { calludp = 1; continue; diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index 0432b7948a..92c42d06ab 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -311,7 +311,6 @@ comm_select_tcp_incoming(void) statCounter.comm_tcp_incoming.count(nevents); } -#define DEBUG_FDBITS 0 /* Select on all sockets; call handlers for those that are ready. */ Comm::Flag Comm::DoSelect(int msec) @@ -327,10 +326,6 @@ Comm::DoSelect(int msec) int pending; int calldns = 0, calludp = 0, calltcp = 0; int j; -#if DEBUG_FDBITS - - int i; -#endif struct timeval poll_time; double timeout = current_dtime + (msec / 1000.0); fde *F; @@ -390,20 +385,6 @@ Comm::DoSelect(int msec) } } -#if DEBUG_FDBITS - for (i = 0; i < maxfd; ++i) { - /* Check each open socket for a handler. */ - - if (fd_table[i].read_handler) { - assert(FD_ISSET(i, readfds)); - } - - if (fd_table[i].write_handler) { - assert(FD_ISSET(i, writefds)); - } - } - -#endif if (nreadfds + nwritefds == 0) { assert(shutting_down); return Comm::SHUTDOWN; @@ -475,14 +456,6 @@ Comm::DoSelect(int msec) if (no_bits) continue; -#if DEBUG_FDBITS - - debugs(5, 9, "FD " << fd << " bit set for reading"); - - assert(FD_ISSET(fd, readfds)); - -#endif - if (fdIsUdpListener(fd)) { calludp = 1; continue; @@ -558,14 +531,6 @@ Comm::DoSelect(int msec) if (no_bits) continue; -#if DEBUG_FDBITS - - debugs(5, 9, "FD " << fd << " bit set for writing"); - - assert(FD_ISSET(fd, writefds)); - -#endif - if (fdIsUdpListener(fd)) { calludp = 1; continue; diff --git a/src/comm/TcpAcceptor.cc b/src/comm/TcpAcceptor.cc index a7ccc3a2e9..af877a2919 100644 --- a/src/comm/TcpAcceptor.cc +++ b/src/comm/TcpAcceptor.cc @@ -182,19 +182,6 @@ Comm::TcpAcceptor::setListen() #endif } -#if 0 - // Untested code. - // Set TOS if needed. - // To correctly implement TOS values on listening sockets, probably requires - // more work to inherit TOS values to created connection objects. - if (conn->tos) - Ip::Qos::setSockTos(conn, conn->tos) -#if SO_MARK - if (conn->nfmark) - Ip::Qos::setSockNfmark(conn, conn->nfmark); -#endif -#endif - typedef CommCbMemFunT Dialer; closer_ = JobCallback(5, 4, Dialer, this, Comm::TcpAcceptor::handleClosure); comm_add_close_handler(conn->fd, closer_); diff --git a/src/dns/rfc1035.cc b/src/dns/rfc1035.cc index 6b96975b17..aaf2df9b49 100644 --- a/src/dns/rfc1035.cc +++ b/src/dns/rfc1035.cc @@ -413,9 +413,6 @@ rfc1035RRUnpack(const char *buf, size_t sz, unsigned int *off, rfc1035_rr * RR) } RR->rdlength = rdlength; switch (RR->type) { -#if DNS_CNAME - case RFC1035_TYPE_CNAME: -#endif case RFC1035_TYPE_PTR: RR->rdata = (char*)xmalloc(RFC1035_MAXHOSTNAMESZ); rdata_off = *off; @@ -749,94 +746,3 @@ rfc1035SetQueryID(char *buf, unsigned short qid) memcpy(buf, &s, sizeof(s)); } -#if DRIVER -#include -int -main(int argc, char *argv[]) -{ - char input[SQUID_DNS_BUFSZ]; - char buf[SQUID_DNS_BUFSZ]; - char rbuf[SQUID_DNS_BUFSZ]; - size_t sz = SQUID_DNS_BUFSZ; - unsigned short sid; - int s; - int rl; - struct sockaddr_in S; - if (3 != argc) { - fprintf(stderr, "usage: %s ip port\n", argv[0]); - exit(EXIT_FAILURE); - } - setbuf(stdout, NULL); - setbuf(stderr, NULL); - s = socket(PF_INET, SOCK_DGRAM, 0); - if (s < 0) { - perror("socket"); - exit(EXIT_FAILURE); - } - memset(&S, '\0', sizeof(S)); - S.sin_family = AF_INET; - S.sin_port = htons(atoi(argv[2])); - S.sin_addr.s_addr = inet_addr(argv[1]); - while (fgets(input, RFC1035_DEFAULT_PACKET_SZ, stdin)) { - struct in_addr junk; - strtok(input, "\r\n"); - memset(buf, '\0', RFC1035_DEFAULT_PACKET_SZ); - sz = RFC1035_DEFAULT_PACKET_SZ; - if (inet_pton(AF_INET, input, &junk)) { - sid = rfc1035BuildPTRQuery(junk, buf, &sz); - } else { - sid = rfc1035BuildAQuery(input, buf, &sz); - } - sendto(s, buf, sz, 0, (struct sockaddr *) &S, sizeof(S)); - do { - fd_set R; - struct timeval to; - FD_ZERO(&R); - FD_SET(s, &R); - to.tv_sec = 10; - to.tv_usec = 0; - rl = select(s + 1, &R, NULL, NULL, &to); - } while (0); - if (rl < 1) { - printf("TIMEOUT\n"); - continue; - } - memset(rbuf, '\0', RFC1035_DEFAULT_PACKET_SZ); - rl = recv(s, rbuf, RFC1035_DEFAULT_PACKET_SZ, 0); - { - unsigned short rid = 0; - int i; - int n; - rfc1035_rr *answers = NULL; - n = rfc1035AnswersUnpack(rbuf, - rl, - &answers, - &rid); - if (n < 0) { - printf("ERROR %d\n", -n); - } else if (rid != sid) { - printf("ERROR, ID mismatch (%#hx, %#hx)\n", sid, rid); - } else { - printf("%d answers\n", n); - for (i = 0; i < n; i++) { - if (answers[i].type == RFC1035_TYPE_A) { - struct in_addr a; - char ipa_str[sizeof(a)]; - memcpy(&a, answers[i].rdata, 4); - printf("A\t%d\t%s\n", answers[i].ttl, inet_ntop(AF_INET,&a,tmp,sizeof(a))); - } else if (answers[i].type == RFC1035_TYPE_PTR) { - char ptr[128]; - strncpy(ptr, answers[i].rdata, answers[i].rdlength); - printf("PTR\t%d\t%s\n", answers[i].ttl, ptr); - } else { - fprintf(stderr, "can't print answer type %d\n", - (int) answers[i].type); - } - } - } - } - } - return EXIT_SUCCESS; -} -#endif - diff --git a/src/dns/rfc3596.cc b/src/dns/rfc3596.cc index cba4445d17..68ef11970e 100644 --- a/src/dns/rfc3596.cc +++ b/src/dns/rfc3596.cc @@ -157,181 +157,3 @@ rfc3596BuildPTRQuery6(const struct in6_addr addr, char *buf, size_t sz, unsigned return rfc3596BuildHostQuery(rev, buf, sz, qid, query, RFC1035_TYPE_PTR, edns_sz); } -#if DRIVER - -/* driver needs the rfc1035 code _without_ the main() */ -# define main(a,b) rfc1035_main(a,b) -# include "rfc1035.c" -# undef main(a,b) - -#include - -int -main(int argc, char *argv[]) -{ -#define PACKET_BUFSZ 1024 - char input[PACKET_BUFSZ]; - char buf[PACKET_BUFSZ]; - char rbuf[PACKET_BUFSZ]; - size_t sz = PACKET_BUFSZ; - unsigned short sid, sidb; - int s; - int rl; - ssize_t edns_max = -1; - - struct sockaddr* S; - int var = 1; - - if ( argc < 3 || argc > 4) { - fprintf(stderr, "usage: %s [-6|-4] ip port\n", argv[0]); - exit(EXIT_FAILURE); - } - - setbuf(stdout, NULL); - setbuf(stderr, NULL); - - if (argv[var][0] == '-') { - if (argv[var][1] == '4') - prefer = AF_INET; - else if (argv[var][1] == '6') - prefer = AF_INET6; - else if (argv[var][1] == 'E') - edns_max = atoi(argv[var++]); - else { - fprintf(stderr, "usage: %s [-6|-4] [-E packet-size] ip port\n", argv[0]); - fprintf(stderr, " EDNS packets my be up to %d\n", PACKET_BUFSZ); - exit(EXIT_FAILURE); - } - - var++; - } - - s = socket(PF_INET, SOCK_DGRAM, 0); - - if (s < 0) { - perror("socket"); - exit(EXIT_FAILURE); - } - - memset(&S, '\0', sizeof(S)); - - if (prefer == 6) { - S = (struct sockaddr *) new sockaddr_in6; - memset(S,0,sizeof(struct sockaddr_in6)); - - ((struct sockaddr_in6 *)S)->sin6_family = AF_INET6; - ((struct sockaddr_in6 *)S)->sin6_port = htons(atoi(argv[var+1])); - - if ( ! inet_pton(AF_INET6, argv[var], &((struct sockaddr_in6 *)S)->sin6_addr.s_addr) ) { - perror("listen address"); - exit(EXIT_FAILURE); - } - - s = socket(PF_INET6, SOCK_DGRAM, 0); - } else { - S = (struct sockaddr *) new sockaddr_in; - memset(S,0,sizeof(struct sockaddr_in)); - - ((struct sockaddr_in *)S)->sin_family = AF_INET; - ((struct sockaddr_in *)S)->sin_port = htons(atoi(argv[var+1])); - - if ( ! inet_pton(AF_INET, argv[var], &((struct sockaddr_in *)S)->sin_addr.s_addr) ) { - perror("listen address"); - exit(EXIT_FAILURE); - } - } - - while (fgets(input, PACKET_BUFSZ, stdin)) - { - - struct in6_addr junk6; - - struct in_addr junk4; - strtok(input, "\r\n"); - memset(buf, '\0', PACKET_BUFSZ); - sz = PACKET_BUFSZ; - - if (inet_pton(AF_INET6, input, &junk6)) { - sid = rfc1035BuildPTRQuery6(junk6, buf, &sz, edns_max); - sidb=0; - } else if (inet_pton(AF_INET, input, &junk4)) { - sid = rfc1035BuildPTRQuery4(junk4, buf, &sz, edns_max); - sidb=0; - } else { - sid = rfc1035BuildAAAAQuery(input, buf, &sz, edns_max); - sidb = rfc1035BuildAQuery(input, buf, &sz, edns_max); - } - - sendto(s, buf, sz, 0, S, sizeof(*S)); - - do { - fd_set R; - - struct timeval to; - FD_ZERO(&R); - FD_SET(s, &R); - to.tv_sec = 10; - to.tv_usec = 0; - rl = select(s + 1, &R, NULL, NULL, &to); - } while (0); - - if (rl < 1) { - printf("TIMEOUT\n"); - continue; - } - - memset(rbuf, '\0', PACKET_BUFSZ); - rl = recv(s, rbuf, PACKET_BUFSZ, 0); - { - unsigned short rid = 0; - int i; - int n; - rfc1035_rr *answers = NULL; - n = rfc1035AnswersUnpack(rbuf, - rl, - &answers, - &rid); - - if (n < 0) { - printf("ERROR %d\n", -n); - } else if (rid != sid && rid != sidb) { - printf("ERROR, ID mismatch (%#hx, %#hx)\n", sid, rid); - printf("ERROR, ID mismatch (%#hx, %#hx)\n", sidb, rid); - } else { - printf("%d answers\n", n); - - for (i = 0; i < n; i++) { - if (answers[i].type == RFC1035_TYPE_A) { - - struct in_addr a; - char tmp[16]; - memcpy(&a, answers[i].rdata, 4); - printf("A\t%d\t%s\n", answers[i].ttl, inet_ntop(AF_INET,&a,tmp,16)); - } else if (answers[i].type == RFC1035_TYPE_AAAA) { - - struct in6_addr a; - char tmp[INET6_ADDRSTRLEN]; - memcpy(&a, answers[i].rdata, 16); - printf("AAAA\t%d\t%s\n", answers[i].ttl, inet_ntop(AF_INET6,&a,tmp,sizeof(tmp))); - } else if (answers[i].type == RFC1035_TYPE_PTR) { - char ptr[RFC1035_MAXHOSTNAMESZ]; - strncpy(ptr, answers[i].rdata, answers[i].rdlength); - printf("PTR\t%d\t%s\n", answers[i].ttl, ptr); - } else if (answers[i].type == RFC1035_TYPE_CNAME) { - char ptr[RFC1035_MAXHOSTNAMESZ]; - strncpy(ptr, answers[i].rdata, answers[i].rdlength); - printf("CNAME\t%d\t%s\n", answers[i].ttl, ptr); - } else { - fprintf(stderr, "can't print answer type %d\n", - (int) answers[i].type); - } - } - } - } - } - - return EXIT_SUCCESS; -} - -#endif - diff --git a/src/esi/Esi.cc b/src/esi/Esi.cc index ecb70b9f33..3aa2ef94cc 100644 --- a/src/esi/Esi.cc +++ b/src/esi/Esi.cc @@ -551,16 +551,6 @@ ESIContext::send () } else flags.oktosend = 1; -#if 0 - - if (!flags.oktosend) { - - fatal("ESIContext::send: Not OK to send.\n"); - return 0; - } - -#endif - if (!(rep || (outbound.getRaw() && outbound->len && (outbound_offset <= outbound->len)))) { debugs(86, 5, "ESIContext::send: Nothing to send."); diff --git a/src/esi/Include.cc b/src/esi/Include.cc index 2c6fc11d44..ce9b380d3e 100644 --- a/src/esi/Include.cc +++ b/src/esi/Include.cc @@ -135,17 +135,6 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply * return; } - /* after the write to the user occurs, (ie here, or in a callback) - * we call */ - if (clientHttpRequestStatus(-1, http)) { - /* TODO: Does thisNode if block leak htto ? */ - /* XXX when reviewing ESI this is the first place to look */ - node->data = NULL; - esiStream->finished = 1; - esiStream->include->includeFail (esiStream); - return; - }; - switch (clientStreamStatus (node, http)) { case STREAM_UNPLANNED_COMPLETE: /* fallthru ok */ diff --git a/src/fs/ufs/UFSSwapLogParser.cc b/src/fs/ufs/UFSSwapLogParser.cc index 5e56df1fbd..f3afd2aafe 100644 --- a/src/fs/ufs/UFSSwapLogParser.cc +++ b/src/fs/ufs/UFSSwapLogParser.cc @@ -103,47 +103,6 @@ Fs::Ufs::UFSSwapLogParser::GetUFSSwapLogParser(FILE *fp) "index corruption. Forcing a full cache index rebuild. " << "See Squid bug #3441."); return NULL; - -#if UNUSED_CODE - // baseline - // 32-bit sfileno - // native time_t (hopefully 64-bit) - // 64-bit file size - if (header.record_size == sizeof(StoreSwapLogData)) { - debugs(47, DBG_IMPORTANT, "Version 1 of swap file with LFS support detected... "); - return new UFSSwapLogParser_v1(fp); - } - - // which means we have a 3-way grid of permutations to import (yuck!) - // 1) sfileno 32-bit / 64-bit (64-bit was broken) - // 2) time_t 32-bit / 64-bit - // 3) size_t 32-bit / 64-bit (32-bit was pre-LFS) - - // 32-bit systems... - // only LFS (size_t) differs from baseline - if (header.record_size == sizeof(struct UFSSwapLogParser_v1_32bs::StoreSwapLogDataOld)) { - debugs(47, DBG_IMPORTANT, "Version 1 (32-bit) swap file without LFS support detected... "); - return new UFSSwapLogParser_v1_32bs(fp); - } - // LFS (size_t) and timestamps (time_t) differs from baseline - if (header.record_size == sizeof(struct UFSSwapLogParser_v1_32bst::StoreSwapLogDataOld)) { - debugs(47, DBG_IMPORTANT, "Version 1 (32-bit) swap file with short timestamps and without LFS support detected... "); - return new UFSSwapLogParser_v1_32bst(fp); - } - // No downgrade for 64-bit timestamps to 32-bit. - - // 64-bit systems - // sfileno was 64-bit for a some builds - if (header.record_size == sizeof(struct UFSSwapLogParser_v1_64bfn::StoreSwapLogDataOld)) { - debugs(47, DBG_IMPORTANT, "Version 1 (64-bit) swap file with broken sfileno detected... "); - return new UFSSwapLogParser_v1_64bfn(fp); - } - // NP: 64-bit system with 32-bit size_t/time_t are not handled. - - debugs(47, DBG_IMPORTANT, "WARNING: The swap file has wrong format!... "); - debugs(47, DBG_IMPORTANT, "NOTE: Cannot safely downgrade caches to short (32-bit) timestamps."); - return NULL; -#endif } if (header.version >= 2) { diff --git a/src/fs_io.cc b/src/fs_io.cc index fd9aa8d843..fdd6f358a9 100644 --- a/src/fs_io.cc +++ b/src/fs_io.cc @@ -109,12 +109,6 @@ file_close(int fd) */ assert(F->write_handler == NULL); -#if CALL_FSYNC_BEFORE_CLOSE - - fsync(fd); - -#endif - close(fd); debugs(6, F->flags.close_request ? 2 : 5, "file_close: FD " << fd << " really closing"); diff --git a/src/http.cc b/src/http.cc index 20e111ba2f..6c0f19005f 100644 --- a/src/http.cc +++ b/src/http.cc @@ -226,16 +226,6 @@ httpMaybeRemovePublic(StoreEntry * e, Http::StatusCode status) #endif default: -#if QUESTIONABLE - /* - * Any 2xx response should eject previously cached entities... - */ - - if (status >= 200 && status < 300) - remove = 1; - -#endif - break; } @@ -1985,12 +1975,6 @@ HttpStateData::httpBuildRequestHeader(HttpRequest * request, if (!cc) cc = new HttpHdrCc(); -#if 0 /* see bug 2330 */ - /* Set no-cache if determined needed but not found */ - if (request->flags.nocache) - EBIT_SET(cc->mask, HttpHdrCcType::CC_NO_CACHE); -#endif - /* Add max-age only without no-cache */ if (!cc->hasMaxAge() && !cc->hasNoCache()) { // XXX: performance regression. c_str() reallocates diff --git a/src/http/RegisteredHeadersHash.cci b/src/http/RegisteredHeadersHash.cci index 5cf04d3cdf..edd9b8efad 100644 --- a/src/http/RegisteredHeadersHash.cci +++ b/src/http/RegisteredHeadersHash.cci @@ -364,7 +364,7 @@ static const class HeaderTableRecord HttpHeaderDefinitionsTable[] = }; const class HeaderTableRecord * -HttpHeaderHashTable::lookup (const char *str, size_t len) + HttpHeaderHashTable::lookup (const char *str, size_t len) { if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { diff --git a/src/http/Stream.cc b/src/http/Stream.cc index 25b8a9befb..5f50e8bc94 100644 --- a/src/http/Stream.cc +++ b/src/http/Stream.cc @@ -73,12 +73,6 @@ Http::Stream::writeComplete(size_t size) http->out.size += size; - if (clientHttpRequestStatus(clientConnection->fd, http)) { - initiateClose("failure or true request status"); - /* Do we leak here ? */ - return; - } - switch (socketState()) { case STREAM_NONE: diff --git a/src/log/ModUdp.cc b/src/log/ModUdp.cc index 446de388d1..5a0cc446a7 100644 --- a/src/log/ModUdp.cc +++ b/src/log/ModUdp.cc @@ -44,6 +44,7 @@ logfile_mod_udp_write(Logfile * lf, const char *buf, size_t len) s = write(ll->fd, (char const *) buf, len); fd_bytes(ll->fd, s, FD_WRITE); #if 0 + // TODO: Enable after polishing to properly log these errors. if (s < 0) { int xerrno = errno; debugs(1, DBG_IMPORTANT, "logfile (udp): got errno (" << errno << "):" << xstrerr(xerrno)); diff --git a/src/mem/old_api.cc b/src/mem/old_api.cc index 86060746f1..0155e558b6 100644 --- a/src/mem/old_api.cc +++ b/src/mem/old_api.cc @@ -419,17 +419,6 @@ memConfigure(void) new_pool_limit = -1; } -#if 0 - /** \par - * DPW 2007-04-12 - * No debugging here please because this method is called before - * the debug log is configured and we'll get the message on - * stderr when doing things like 'squid -k reconfigure' - */ - if (MemPools::GetInstance().idleLimit() > new_pool_limit) - debugs(13, DBG_IMPORTANT, "Shrinking idle mem pools to "<< std::setprecision(3) << toMB(new_pool_limit) << " MB"); -#endif - MemPools::GetInstance().setIdleLimit(new_pool_limit); } @@ -692,17 +681,6 @@ MemPoolReportSorter(const void *a, const void *b) if (pb > pa) return 1; -#if 0 - // use this to sort on In Use high(hrs) - // - if (A->meter->inuse.peakTime() > B->meter->inuse.peakTime()) - return -1; - - if (B->meter->inuse.peakTime() > A->meter->inuse.peakTime()) - return 1; - -#endif - return 0; } diff --git a/src/mgr/QueryParams.cc b/src/mgr/QueryParams.cc index a53dee1c72..7e79943876 100644 --- a/src/mgr/QueryParams.cc +++ b/src/mgr/QueryParams.cc @@ -157,3 +157,4 @@ Mgr::QueryParams::CreateParam(QueryParam::Type aType) } return NULL; } + diff --git a/src/peer_digest.cc b/src/peer_digest.cc index dfa2d8cfad..4ad35f09f1 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -185,25 +185,6 @@ peerDigestNeeded(PeerDigest * pd) peerDigestSetCheck(pd, 0); /* check asap */ } -/* currently we do not have a reason to disable without destroying */ -#if FUTURE_CODE -/* disables peer for good */ -static void -peerDigestDisable(PeerDigest * pd) -{ - debugs(72, 2, "peerDigestDisable: peer " << pd->host.buf() << " disabled for good"); - pd->times.disabled = squid_curtime; - pd->times.next_check = -1; /* never */ - pd->flags.usable = 0; - - delete pd->cd - pd->cd = nullptr; - - /* we do not destroy the pd itself to preserve its "history" and stats */ -} - -#endif - /* increment retry delay [after an unsuccessful attempt] */ static time_t peerDigestIncDelay(const PeerDigest * pd) @@ -727,14 +708,6 @@ peerDigestFetchedEnough(DigestFetchState * fetch, char *buf, ssize_t size, const if (!reason) { if (!(pd = fetch->pd)) reason = "peer digest disappeared?!"; - -#if DONT /* WHY NOT? /HNO */ - - else if (!cbdataReferenceValid(pd)) - reason = "invalidated peer digest?!"; - -#endif - else host = pd->host; } diff --git a/src/sbuf/SBuf.cc b/src/sbuf/SBuf.cc index 2b5d5a92e4..f35971d83d 100644 --- a/src/sbuf/SBuf.cc +++ b/src/sbuf/SBuf.cc @@ -174,15 +174,8 @@ SBuf::rawSpace(size_type minSpace) void SBuf::clear() { -#if 0 - //enabling this code path, the store will be freed and reinitialized - store_ = GetStorePrototype(); //uncomment to actually free storage upon clear() -#else - //enabling this code path, we try to release the store without deallocating it. - // will be lazily reallocated if needed. if (store_->LockCount() == 1) store_->clear(); -#endif len_ = 0; off_ = 0; ++stats.clear; diff --git a/src/security/Session.cc b/src/security/Session.cc index ebb1ebb457..052d6cb148 100644 --- a/src/security/Session.cc +++ b/src/security/Session.cc @@ -35,13 +35,6 @@ tls_read_method(int fd, char *buf, int len) auto session = fd_table[fd].ssl.get(); debugs(83, 3, "started for session=" << (void*)session); -#if DONT_DO_THIS && USE_OPENSSL - if (!SSL_is_init_finished(session)) { - errno = ENOTCONN; - return -1; - } -#endif - #if USE_OPENSSL int i = SSL_read(session, buf, len); #elif USE_GNUTLS diff --git a/src/stat.cc b/src/stat.cc index e010656e9f..26633b1a12 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -63,8 +63,6 @@ #include "comm.h" #include "StoreSearch.h" -#define DEBUG_OPENFD 1 - typedef int STOBJFLT(const StoreEntry *); class StatObjectsState @@ -89,9 +87,7 @@ static void statStoreEntry(MemBuf * mb, StoreEntry * e); static double statCPUUsage(int minutes); static OBJH stat_objects_get; static OBJH stat_vmobjects_get; -#if DEBUG_OPENFD static OBJH statOpenfdObj; -#endif static EVH statObjects; static OBJH statCountersDump; static OBJH statPeerSelect; @@ -419,7 +415,6 @@ stat_vmobjects_get(StoreEntry * sentry) statObjectsStart(sentry, statObjectsVmFilter); } -#if DEBUG_OPENFD static int statObjectsOpenfdFilter(const StoreEntry * e) { @@ -438,8 +433,6 @@ statOpenfdObj(StoreEntry * sentry) statObjectsStart(sentry, statObjectsOpenfdFilter); } -#endif - #if XMALLOC_STATISTICS static void info_get_mallstat(int size, int number, int oldnum, void *data) @@ -1222,10 +1215,8 @@ statRegisterWithCacheManager(void) "Active Cached Usernames", Auth::User::CredentialsCacheStats, 0, 1); #endif -#if DEBUG_OPENFD Mgr::RegisterAction("openfd_objects", "Objects with Swapout files open", statOpenfdObj, 0, 0); -#endif #if STAT_GRAPHS Mgr::RegisterAction("graph_variables", "Display cache metrics graphically", statGraphDump, 0, 1); diff --git a/src/store.cc b/src/store.cc index f8e9ba0d1b..aefc66c46a 100644 --- a/src/store.cc +++ b/src/store.cc @@ -606,12 +606,6 @@ StoreEntry::setPublicKey(const KeyScope scope) * * If RELEASE_REQUEST is set, setPublicKey() should not be called. */ -#if MORE_DEBUG_OUTPUT - - if (EBIT_TEST(flags, RELEASE_REQUEST)) - debugs(20, DBG_IMPORTANT, "assertion failed: RELEASE key " << key << ", url " << mem_obj->url); - -#endif assert(!EBIT_TEST(flags, RELEASE_REQUEST)); @@ -895,7 +889,6 @@ storeAppendVPrintf(StoreEntry * e, const char *fmt, va_list vargs) struct _store_check_cachable_hist { struct { - int non_get; int not_entry_cachable; int wrong_content_length; int too_big; @@ -967,46 +960,39 @@ StoreEntry::checkCachable() return 0; // avoid rerequesting release below } -#if CACHE_ALL_METHODS - - if (mem_obj->method != Http::METHOD_GET) { - debugs(20, 2, "StoreEntry::checkCachable: NO: non-GET method"); - ++store_check_cachable_hist.no.non_get; - } else -#endif - if (store_status == STORE_OK && EBIT_TEST(flags, ENTRY_BAD_LENGTH)) { - debugs(20, 2, "StoreEntry::checkCachable: NO: wrong content-length"); - ++store_check_cachable_hist.no.wrong_content_length; - } else if (!mem_obj) { - // XXX: In bug 4131, we forgetHit() without mem_obj, so we need - // this segfault protection, but how can we get such a HIT? - debugs(20, 2, "StoreEntry::checkCachable: NO: missing parts: " << *this); - ++store_check_cachable_hist.no.missing_parts; - } else if (checkTooBig()) { - debugs(20, 2, "StoreEntry::checkCachable: NO: too big"); - ++store_check_cachable_hist.no.too_big; - } else if (checkTooSmall()) { - debugs(20, 2, "StoreEntry::checkCachable: NO: too small"); - ++store_check_cachable_hist.no.too_small; - } else if (EBIT_TEST(flags, KEY_PRIVATE)) { - debugs(20, 3, "StoreEntry::checkCachable: NO: private key"); - ++store_check_cachable_hist.no.private_key; - } else if (hasDisk()) { - /* - * the remaining cases are only relevant if we haven't - * started swapping out the object yet. - */ - return 1; - } else if (storeTooManyDiskFilesOpen()) { - debugs(20, 2, "StoreEntry::checkCachable: NO: too many disk files open"); - ++store_check_cachable_hist.no.too_many_open_files; - } else if (fdNFree() < RESERVED_FD) { - debugs(20, 2, "StoreEntry::checkCachable: NO: too many FD's open"); - ++store_check_cachable_hist.no.too_many_open_fds; - } else { - ++store_check_cachable_hist.yes.Default; - return 1; - } + if (store_status == STORE_OK && EBIT_TEST(flags, ENTRY_BAD_LENGTH)) { + debugs(20, 2, "StoreEntry::checkCachable: NO: wrong content-length"); + ++store_check_cachable_hist.no.wrong_content_length; + } else if (!mem_obj) { + // XXX: In bug 4131, we forgetHit() without mem_obj, so we need + // this segfault protection, but how can we get such a HIT? + debugs(20, 2, "StoreEntry::checkCachable: NO: missing parts: " << *this); + ++store_check_cachable_hist.no.missing_parts; + } else if (checkTooBig()) { + debugs(20, 2, "StoreEntry::checkCachable: NO: too big"); + ++store_check_cachable_hist.no.too_big; + } else if (checkTooSmall()) { + debugs(20, 2, "StoreEntry::checkCachable: NO: too small"); + ++store_check_cachable_hist.no.too_small; + } else if (EBIT_TEST(flags, KEY_PRIVATE)) { + debugs(20, 3, "StoreEntry::checkCachable: NO: private key"); + ++store_check_cachable_hist.no.private_key; + } else if (hasDisk()) { + /* + * the remaining cases are only relevant if we haven't + * started swapping out the object yet. + */ + return 1; + } else if (storeTooManyDiskFilesOpen()) { + debugs(20, 2, "StoreEntry::checkCachable: NO: too many disk files open"); + ++store_check_cachable_hist.no.too_many_open_files; + } else if (fdNFree() < RESERVED_FD) { + debugs(20, 2, "StoreEntry::checkCachable: NO: too many FD's open"); + ++store_check_cachable_hist.no.too_many_open_fds; + } else { + ++store_check_cachable_hist.yes.Default; + return 1; + } releaseRequest(); return 0; @@ -1016,13 +1002,6 @@ void storeCheckCachableStats(StoreEntry *sentry) { storeAppendPrintf(sentry, "Category\t Count\n"); - -#if CACHE_ALL_METHODS - - storeAppendPrintf(sentry, "no.non_get\t%d\n", - store_check_cachable_hist.no.non_get); -#endif - storeAppendPrintf(sentry, "no.not_entry_cachable\t%d\n", store_check_cachable_hist.no.not_entry_cachable); storeAppendPrintf(sentry, "no.wrong_content_length\t%d\n", @@ -1719,27 +1698,6 @@ createRemovalPolicy(RemovalPolicySettings * settings) return NULL; /* NOTREACHED */ } -#if 0 -void -storeSwapFileNumberSet(StoreEntry * e, sfileno filn) -{ - if (e->swap_file_number == filn) - return; - - if (filn < 0) { - assert(-1 == filn); - storeDirMapBitReset(e->swap_file_number); - storeDirLRUDelete(e); - e->swap_file_number = -1; - } else { - assert(-1 == e->swap_file_number); - storeDirMapBitSet(e->swap_file_number = filn); - storeDirLRUAdd(e); - } -} - -#endif - void StoreEntry::storeErrorResponse(HttpReply *reply) { diff --git a/src/store_client.cc b/src/store_client.cc index e6bcbee7b9..1579e80e28 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -653,18 +653,9 @@ storeClientCopyPending(store_client * sc, StoreEntry * e, void *data) #if STORE_CLIENT_LIST_DEBUG assert(sc == storeClientListSearch(e->mem_obj, data)); #endif -#ifndef SILLY_CODE assert(sc); -#endif - assert(sc->entry == e); -#if SILLY_CODE - - if (sc == NULL) - return 0; - -#endif if (!sc->_callback.pending()) return 0; diff --git a/src/tests/SBufFindTest.cc b/src/tests/SBufFindTest.cc index 1153d66168..01d9aee59f 100644 --- a/src/tests/SBufFindTest.cc +++ b/src/tests/SBufFindTest.cc @@ -203,15 +203,6 @@ AnyToString(const Type &value) return sbuf.str(); } -#if 0 -/// helper function to convert SBuf position to a human-friendly string -inline std::string -PosToString(const SBuf::size_type pos) -{ - return pos == SBuf::npos ? std::string("npos") : AnyToString(pos); -} -#endif - /// helper function to convert std::string position to a human-friendly string inline std::string PosToString(const std::string::size_type pos) diff --git a/src/tests/stub_comm.cc b/src/tests/stub_comm.cc index b3352799d6..9c99de7b73 100644 --- a/src/tests/stub_comm.cc +++ b/src/tests/stub_comm.cc @@ -37,9 +37,6 @@ void commSetTcpKeepalive(int fd, int idle, int interval, int timeout) STUB void _comm_close(int fd, char const *file, int line) STUB void old_comm_reset_close(int fd) STUB void comm_reset_close(const Comm::ConnectionPointer &conn) STUB -#if LINGERING_CLOSE -void comm_lingering_close(int fd) STUB -#endif int comm_connect_addr(int sock, const Ip::Address &addr) STUB_RETVAL(-1) void comm_init(void) STUB void comm_exit(void) STUB diff --git a/src/tests/testCacheManager.cc b/src/tests/testCacheManager.cc index 7d6631aaee..2378278eb8 100644 --- a/src/tests/testCacheManager.cc +++ b/src/tests/testCacheManager.cc @@ -218,3 +218,4 @@ testCacheManager::testParseUrl() } } } + diff --git a/src/tests/testHttp1Parser.cc b/src/tests/testHttp1Parser.cc index 0019ecad77..362133a273 100644 --- a/src/tests/testHttp1Parser.cc +++ b/src/tests/testHttp1Parser.cc @@ -704,26 +704,6 @@ testHttp1Parser::testParseRequestLineMethods() input.clear(); } -#if 0 - // too-long method (over 16 bytes) - { - input.append("HELLOSTRANGEWORLD / HTTP/1.1\r\n", 31); - struct resultSet expect = { - .parsed = false, - .needsMore = false, - .parserState = Http1::HTTP_PARSE_DONE, - .status = Http::scNotImplemented, - .suffixSz = input.length(), - .method = HttpRequestMethod(), - .uri = NULL, - .version = AnyP::ProtocolVersion() - }; - output.clear(); - testResults(__LINE__, input, output, expect); - input.clear(); - } -#endif - // method-only { input.append("A\n", 2); diff --git a/src/tests/testIpAddress.cc b/src/tests/testIpAddress.cc index 71af138801..edcd9fd27f 100644 --- a/src/tests/testIpAddress.cc +++ b/src/tests/testIpAddress.cc @@ -636,19 +636,6 @@ testIpAddress::testAddrInfo() anIP.getAddrInfo(ipval); -#if 0 - /* display a byte-by-byte hex comparison of the addr cores */ - unsigned int *p; - p = (unsigned int*)expect; - printf("\nSYS-ADDRINFO: %2x %2x %2x %2x %2x %2x", - p[0],p[1],p[2],p[3],p[4],p[5]); - - p = (unsigned int*)ipval; - printf("\nSQD-ADDRINFO: %2x %2x %2x %2x %2x %2x", - p[0],p[1],p[2],p[3],p[4],p[5] ); - printf("\n"); -#endif /*0*/ - // check the addrinfo object core. (BUT not the two ptrs at the tail) // details CPPUNIT_ASSERT_EQUAL( expect->ai_flags, ipval->ai_flags ); @@ -656,26 +643,6 @@ testIpAddress::testAddrInfo() // check the sockaddr it points to. CPPUNIT_ASSERT_EQUAL( expect->ai_addrlen, ipval->ai_addrlen ); -#if 0 - printf("sizeof IN(%d), IN6(%d), STORAGE(%d), \n", - sizeof(struct sockaddr_in), sizeof(struct sockaddr_in6), sizeof(struct sockaddr_storage)); - - p = (unsigned int*)(expect->ai_addr); - printf("\nSYS-ADDR: (%d) {%d} %x %x %x %x %x %x %x %x ...", - expect->ai_addrlen, sizeof(*p), - p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7] ); - - p = (unsigned int*)(ipval->ai_addr); - printf("\nSQD-ADDR: (%d) {%d} %x %x %x %x %x %x %x %x ...", - ipval->ai_addrlen, sizeof(*p), - p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7] ); - printf("\n"); -#if HAVE_SS_LEN_IN_SS - printf("\nSYS SS_LEN=%d\nSQD SS_LEN=%d\n",((struct sockaddr_storage*)expect->ai_addr)->ss_len, - ((struct sockaddr_storage*)ipval->ai_addr)->ss_len ); -#endif -#endif /*0*/ - #if HAVE_SS_LEN_IN_SS CPPUNIT_ASSERT_EQUAL( ((struct sockaddr_storage*)expect->ai_addr)->ss_len, ((struct sockaddr_storage*)ipval->ai_addr)->ss_len ); diff --git a/src/tests/testStoreController.cc b/src/tests/testStoreController.cc index 87794edd57..b301417c54 100644 --- a/src/tests/testStoreController.cc +++ b/src/tests/testStoreController.cc @@ -145,10 +145,6 @@ testStoreController::testSearch() CPPUNIT_ASSERT_EQUAL(false, search->error()); CPPUNIT_ASSERT_EQUAL(false, search->isDone()); CPPUNIT_ASSERT_EQUAL(static_cast(NULL), search->currentItem()); -#if 0 - - CPPUNIT_ASSERT_EQUAL(false, search->next()); -#endif /* trigger a callback */ cbcalled = false; diff --git a/src/tests/testStoreHashIndex.cc b/src/tests/testStoreHashIndex.cc index 0b3fa0b7d6..a676caa3d4 100644 --- a/src/tests/testStoreHashIndex.cc +++ b/src/tests/testStoreHashIndex.cc @@ -139,10 +139,6 @@ testStoreHashIndex::testSearch() CPPUNIT_ASSERT_EQUAL(false, search->error()); CPPUNIT_ASSERT_EQUAL(false, search->isDone()); CPPUNIT_ASSERT_EQUAL(static_cast(NULL), search->currentItem()); -#if 0 - - CPPUNIT_ASSERT_EQUAL(false, search->next()); -#endif /* trigger a callback */ cbcalled = false; diff --git a/src/tests/testUfs.cc b/src/tests/testUfs.cc index 905396dc67..e88966ad7b 100644 --- a/src/tests/testUfs.cc +++ b/src/tests/testUfs.cc @@ -170,12 +170,6 @@ testUfs::testUfsSearch() */ StoreSearchPointer search = Store::Root().search(); /* search for everything in the store */ - /* nothing should be immediately available */ -#if 0 - - CPPUNIT_ASSERT_EQUAL(false, search->next()); -#endif - CPPUNIT_ASSERT_EQUAL(false, search->error()); CPPUNIT_ASSERT_EQUAL(false, search->isDone()); CPPUNIT_ASSERT_EQUAL(static_cast(NULL), search->currentItem()); diff --git a/src/tests/testUriScheme.cc b/src/tests/testUriScheme.cc index fae663da33..fe66329f9c 100644 --- a/src/tests/testUriScheme.cc +++ b/src/tests/testUriScheme.cc @@ -17,37 +17,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION( testUriScheme ); -#if 0 -/* - * We should be able to make an HttpRequestMethod straight from a string. - */ -void -testHttpRequestMethod::testConstructCharStart() -{ - /* parse an empty string -> METHOD_NONE */ - CPPUNIT_ASSERT(METHOD_NONE == HttpRequestMethod(NULL)); - /* parsing a literal should work */ - CPPUNIT_ASSERT(METHOD_GET == HttpRequestMethod("GET", NULL)); -} - -/* - * We can also parse precise ranges of characters - */ -void -testHttpRequestMethod::testConstructCharStartEnd() -{ - char const * buffer; - /* parse an empty string -> METHOD_NONE */ - CPPUNIT_ASSERT(METHOD_NONE == HttpRequestMethod(NULL, NULL)); - /* parsing a literal should work */ - CPPUNIT_ASSERT(METHOD_GET == HttpRequestMethod("GET", NULL)); - /* parsing with an explicit end should work */ - buffer = "POSTPLUS"; - CPPUNIT_ASSERT(METHOD_POST == HttpRequestMethod(buffer, buffer + 4)); -} - -#endif - /* * we should be able to assign a protocol_t to a AnyP::UriScheme for ease * of code conversion diff --git a/src/tests/testUriScheme.h b/src/tests/testUriScheme.h index 5a84fec061..35e124100b 100644 --- a/src/tests/testUriScheme.h +++ b/src/tests/testUriScheme.h @@ -21,12 +21,6 @@ class testUriScheme : public CPPUNIT_NS::TestFixture CPPUNIT_TEST( testAssignFromprotocol_t ); CPPUNIT_TEST( testCastToprotocol_t ); CPPUNIT_TEST( testConstructprotocol_t ); -#if 0 - - CPPUNIT_TEST( testConstructCharStart ); - CPPUNIT_TEST( testConstructCharStartEnd ); -#endif - CPPUNIT_TEST( testDefaultConstructor ); CPPUNIT_TEST( testEqualprotocol_t ); CPPUNIT_TEST( testNotEqualprotocol_t ); @@ -41,12 +35,6 @@ protected: void testAssignFromprotocol_t(); void testCastToprotocol_t(); void testConstructprotocol_t(); -#if 0 - - void testConstructCharStart(); - void testConstructCharStartEnd(); -#endif - void testC_str(); void testDefaultConstructor(); void testEqualprotocol_t(); diff --git a/test-suite/ESIExpressions.cc b/test-suite/ESIExpressions.cc index e37d3fcebd..8c9edd86d2 100644 --- a/test-suite/ESIExpressions.cc +++ b/test-suite/ESIExpressions.cc @@ -40,12 +40,6 @@ main () while (strlen (expressions[i])) { int result = ESIExpression::Evaluate (expressions[i]); -#if VERBOSEDEBUG - - printf("Expr '%s' = '%s' (expected %s)\n", expressions[i], - result ? "true" : "false", - results[i] ? "true" : "false"); -#endif if (result != results[i]) return 1; diff --git a/test-suite/pconn-banger.c b/test-suite/pconn-banger.c index 6256948e24..2f2b735939 100644 --- a/test-suite/pconn-banger.c +++ b/test-suite/pconn-banger.c @@ -278,12 +278,6 @@ get_header_string_value(const char *hdr, const char *buf, const char *end) void request_done(struct _r *r) { -#if 0 - fprintf(stderr, "DONE: %s, (%d+%d)\n", - r->url, - r->hdr_length, - r->content_length); -#endif if (r->content_length != r->bytes_read) fprintf(stderr, "ERROR! Short reply, expected %d bytes got %d\n", r->content_length, r->bytes_read); @@ -343,14 +337,7 @@ handle_read(char *inbuf, int len) } /* Process headers */ if (r->hdr_length == 0 && (end = mime_headers_end(r->reply_hdrs)) != NULL) { -#if 0 - fprintf(stderr, "FOUND EOH FOR %s\n", r->url); - */ -#endif r->hdr_length = end - r->reply_hdrs; -#if 0 - fprintf(stderr, "HDR_LENGTH = %d\n", r->hdr_length); -#endif /* "unread" any body contents received */ blen = r->hdr_offset - r->hdr_length; assert(blen >= 0); diff --git a/test-suite/tcp-banger3.c b/test-suite/tcp-banger3.c index e531b69db2..43bf3b5a17 100644 --- a/test-suite/tcp-banger3.c +++ b/test-suite/tcp-banger3.c @@ -133,10 +133,6 @@ get_url(const char *url) *t = '\0'; port = (unsigned short) atoi(t + 1); } -#if 0 - if ((int) port != 80) - return 0; -#endif t = strchr(url + 7, '/'); strncpy(path, (t ? t : "/"), URL_BUF_SZ); memset(&S, '\0', sizeof(S)); diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index 2420545fd8..1d02fa34bb 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -911,23 +911,12 @@ main(int argc, char *argv[]) char **args = argv; while (argc > 1 && args[1][0] == '-') { -// const char *value = ""; char option = args[1][1]; switch (option) { case 'd': debug_enabled = 1; break; default: -#if 0 // unused for now. - if (strlen(args[1]) > 2) { - value = args[1] + 2; - } else if (argc > 2) { - value = args[2]; - ++args; - --argc; - } else - value = ""; -#endif break; } ++args; @@ -1252,7 +1241,7 @@ check_target_acl(const char *hostname, int port) if (fp == NULL) { #ifdef CACHEMGR_HOSTNAME_DEFINED - + // TODO: simplify and maybe get rid of CACHEMGR_HOSTNAME altogether if (strcmp(hostname, CACHEMGR_HOSTNAME) == 0 && port == CACHE_HTTP_PORT) return 1; diff --git a/tools/purge/purge.cc b/tools/purge/purge.cc index 7d9d369291..cae672525b 100644 --- a/tools/purge/purge.cc +++ b/tools/purge/purge.cc @@ -580,13 +580,7 @@ checkForPortOnly( const char* arg ) unsigned long result = strtoul( arg, &errstr, 0 ); if ( result < 65536 && errstr != arg ) return htons(result); -#if 0 - // one last try, test for a symbolical service name - struct servent* service = getservbyname( arg, "tcp" ); - return service ? service->s_port : -1; -#else return -1; -#endif } void diff --git a/tools/purge/signal.cc b/tools/purge/signal.cc index c3ba05bd9a..657efd15c1 100644 --- a/tools/purge/signal.cc +++ b/tools/purge/signal.cc @@ -98,7 +98,7 @@ Signal( int signo, SigFunc* newhandler, bool doInterrupt ) (SigFunc*) old.sa_handler; } -SIGRETTYPE +void sigChild( int signo ) // purpose: supply ad hoc child handler with output on stderr // paramtr: signo (IN): == SIGCHLD @@ -128,9 +128,5 @@ sigChild( int signo ) } } errno = saveerr; - -#if SIGRETTYPE != void - return 0; -#endif } diff --git a/tools/purge/signal.hh b/tools/purge/signal.hh index 4609829ce2..051f8c9c57 100644 --- a/tools/purge/signal.hh +++ b/tools/purge/signal.hh @@ -10,10 +10,10 @@ // File: signal.hh // Date: Sat Feb 28 1998 // Compiler: gcc 2.7.2.x series -// +// // Books: W. Richard Steven, "Advanced Programming in the UNIX Environment", // Addison-Wesley, 1992. -// +// // (c) 1998 Lehrgebiet Rechnernetze und Verteilte Systeme // Universit?t Hannover, Germany // @@ -69,12 +69,6 @@ typedef int bool; #endif #endif /* __cplusplus */ -#if 1 // so far, all systems I know use void -# define SIGRETTYPE void -#else -# define SIGRETTYPE int -#endif - #if defined(SUNOS) && defined(SUN) # define SIGPARAM void #else // SOLARIS, LINUX, IRIX, AIX, SINIXY @@ -82,7 +76,7 @@ typedef int bool; #endif extern "C" { - typedef SIGRETTYPE SigFunc( SIGPARAM ); + typedef void SigFunc( SIGPARAM ); } SigFunc* @@ -93,7 +87,7 @@ Signal( int signo, SigFunc* newhandler, bool doInterrupt ); // doInterrupt (IN): interrupted system calls wanted! // returns: the old signal handler, or SIG_ERR in case of error. -SIGRETTYPE +void sigChild( int signo ); // purpose: supply ad hoc child handler with output on stderr // paramtr: signo (IN): == SIGCHLD