From: amosjeffries <> Date: Wed, 31 Oct 2007 10:52:15 +0000 (+0000) Subject: Code cleanup. X-Git-Tag: SQUID_3_0_STABLE1~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1a8870019efe5dc2affd355f83371eea1c2646c;p=thirdparty%2Fsquid.git Code cleanup. --- diff --git a/src/ICP.h b/src/ICP.h index c21717352c..fd3f9045e9 100644 --- a/src/ICP.h +++ b/src/ICP.h @@ -1,6 +1,6 @@ /* - * $Id: ICP.h,v 1.8 2007/09/21 11:41:52 amosjeffries Exp $ + * $Id: ICP.h,v 1.9 2007/10/31 04:52:15 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -41,7 +41,6 @@ * DO NOT add more move fields on pain of breakage. * DO NOT add virtual methods. */ - struct _icp_common_t { unsigned char opcode; /* opcode */ diff --git a/src/Makefile.am b/src/Makefile.am index 9f208abf7c..d4775064a9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.192 2007/09/19 08:54:50 hno Exp $ +# $Id: Makefile.am,v 1.193 2007/10/31 04:52:15 amosjeffries Exp $ # # Uncomment and customize the following to suit your needs: # @@ -1126,6 +1126,28 @@ check_PROGRAMS+= \ tests/testURL \ @STORE_TESTS@ +### Template for new Unit Test Program +## - add tests/testX to check_PROGRAMS above. +## - copy template below and substitue X for class name +## - add other component .(h|cc) files needed to link and run tests +## +##NP: (TESTSOURCES) defines stub debugs() and new/delete for testing +## +#tests_testX_SOURCES=\ +# tests/testX.h \ +# tests/testX.cc \ +# tests/testMain.cc \ +# X.h \ +# X.cc \ +# $(TESTSOURCES) +#tests_testX_LDFLAGS = $(LIBADD_DL) +#tests_testX_LDADD=\ +# @SQUID_CPPUNIT_LIBS@ \ +# @SQUID_CPPUNIT_LA@ \ +# -L../lib -lmiscutil +#tests_testX_DEPENDENCIES= @SQUID_CPPUNIT_LA@ \ +# $(top_builddir)/lib/libmiscutil.a + tests_testAuth_SOURCES= tests/testAuth.cc tests/testMain.cc tests/testAuth.h $(TESTSOURCES) \ authenticate.cc \ ConfigParser.cc \ diff --git a/src/SquidTime.h b/src/SquidTime.h index 23cb493952..499521dcd6 100644 --- a/src/SquidTime.h +++ b/src/SquidTime.h @@ -1,6 +1,5 @@ - /* - * $Id: SquidTime.h,v 1.2 2006/08/12 01:43:11 robertc Exp $ + * $Id: SquidTime.h,v 1.3 2007/10/31 04:52:16 amosjeffries Exp $ * * DEBUG: section 21 Time Functions * AUTHOR: Harvest Derived @@ -32,7 +31,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ - #ifndef SQUID_TIME_H #define SQUID_TIME_H @@ -42,16 +40,15 @@ extern time_t squid_curtime; /* 0 */ time_t getCurrentTime(void); -/* event class for doing synthetic time etc */ - +/** event class for doing synthetic time etc */ class TimeEngine { public: virtual ~TimeEngine(); - /* tick the clock - update from the OS or other time source, */ + + /** tick the clock - update from the OS or other time source, */ virtual void tick(); }; - #endif /* SQUID_TIME_H */ diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 2c454ebd9b..f3660f27cb 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.523 2007/10/22 23:35:32 amosjeffries Exp $ + * $Id: cache_cf.cc,v 1.524 2007/10/31 04:52:16 amosjeffries Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -125,6 +125,7 @@ static void free_http_header_replace(header_mangler * header); static void parse_denyinfo(acl_deny_info_list ** var); static void dump_denyinfo(StoreEntry * entry, const char *name, acl_deny_info_list * var); static void free_denyinfo(acl_deny_info_list ** var); + #if USE_WCCPv2 static void parse_sockaddr_in_list(sockaddr_in_list **); static void dump_sockaddr_in_list(StoreEntry *, const char *, const sockaddr_in_list *); @@ -132,10 +133,12 @@ static void free_sockaddr_in_list(sockaddr_in_list **); #if CURRENTLY_UNUSED static int check_null_sockaddr_in_list(const sockaddr_in_list *); #endif /* CURRENTLY_UNUSED */ -#endif +#endif /* USE_WCCPv2 */ + static void parse_http_port_list(http_port_list **); static void dump_http_port_list(StoreEntry *, const char *, const http_port_list *); static void free_http_port_list(http_port_list **); + #if USE_SSL static void parse_https_port_list(https_port_list **); static void dump_https_port_list(StoreEntry *, const char *, const https_port_list *); @@ -144,6 +147,7 @@ static void free_https_port_list(https_port_list **); static int check_null_https_port_list(const https_port_list *); #endif #endif /* USE_SSL */ + static void parse_b_size_t(size_t * var); static void parse_b_int64_t(int64_t * var); diff --git a/src/cache_manager.cc b/src/cache_manager.cc index d50d3ebad4..f8b07f7d45 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_manager.cc,v 1.47 2007/04/28 22:26:37 hno Exp $ + * $Id: cache_manager.cc,v 1.48 2007/10/31 04:52:16 amosjeffries Exp $ * * DEBUG: section 16 Cache Manager Objects * AUTHOR: Duane Wessels @@ -383,7 +383,7 @@ cachemgrMenu(StoreEntry * sentry) CacheManagerAction *a; for (a = ActionTable; a != NULL; a = a->next) { - storeAppendPrintf(sentry, " %-22s\t%s\t%s\n", + storeAppendPrintf(sentry, " %-22s\t%-32s\t%s\n", a->action, a->desc, cachemgrActionProtection(a)); } } diff --git a/src/client_side.h b/src/client_side.h index 6497b2c248..5f40f37e1e 100644 --- a/src/client_side.h +++ b/src/client_side.h @@ -1,6 +1,5 @@ - /* - * $Id: client_side.h,v 1.25 2007/09/28 00:22:38 hno Exp $ + * $Id: client_side.h,v 1.26 2007/10/31 04:52:16 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -126,7 +125,6 @@ private: bool connRegistered_; }; - /* A connection to a socket */ class ConnStateData : public BodyProducer, public RefCountable { diff --git a/src/comm.cc b/src/comm.cc index 8730440657..02157c5389 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,5 @@ - /* - * $Id: comm.cc,v 1.437 2007/09/25 13:24:59 hno Exp $ + * $Id: comm.cc,v 1.438 2007/10/31 04:52:16 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -447,7 +446,7 @@ CommCallbackData::deRegisterSelf() dlinkDelete(&fd_node, &(fdc_table[result.fd].CommCallbackList)); } -/* +/** * add an IO callback * * IO callbacks are added when we want to notify someone that some IO @@ -476,7 +475,7 @@ CommCallbackData::callACallback() callCallback(); } -/* +/** * call the IO callbacks * * This should be called before comm_select() so code can attempt to @@ -522,7 +521,7 @@ comm_iocallbackpending(void) return (CommCallbackList.head != NULL) || (commfd_completed_events.head != NULL); } -/* +/** * Attempt a read * * If the read attempt succeeds or fails, call the callback. @@ -562,7 +561,7 @@ commHandleRead(int fd, void *data) commSetSelect(fd, COMM_SELECT_READ, commHandleRead, data, 0); } -/* +/** * Queue a read. handler/handler_data are called when the read * completes, on error, or on file descriptor close. */ @@ -581,7 +580,7 @@ comm_read(int fd, char *buf, int size, IOCB *handler, void *handler_data) commSetSelect(fd, COMM_SELECT_READ, commHandleRead, COMMIO_FD_READCB(fd), 0); } -/* +/** * Empty the read buffers * * This is a magical routine that empties the read buffers. @@ -610,7 +609,7 @@ requireOpenAndActive(int const fd) assert(fdc_table[fd].active == 1); } -/* +/** * Return whether the FD has a pending completed callback. */ int @@ -644,7 +643,7 @@ fdc_t::findCallback(P predicate) return false; } -/* +/** * return whether a file descriptor has a read handler * * Assumptions: the fd is open @@ -672,7 +671,7 @@ comm_has_pending_read(int fd) return COMMIO_FD_READCB(fd)->active && (! COMMIO_FD_READCB(fd)->completed); } -/* +/** * Cancel a pending read. Assert that we have the right parameters, * and that there are no pending read events! * @@ -695,7 +694,7 @@ comm_read_cancel(int fd, IOCB *callback, void *data) } -/* +/** * Open a filedescriptor, set some sane defaults * XXX DPW 2006-05-30 what is the point of this? */ @@ -710,13 +709,11 @@ fdc_open(int fd, unsigned int type, char const *desc) } -/* +/** * synchronous wrapper around udp socket functions */ - int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen) { statCounter.syscalls.sock.recvfroms++; @@ -743,7 +740,7 @@ comm_has_incomplete_write(int fd) return COMMIO_FD_WRITECB(fd)->active; } -/* +/** * Queue a write. handler/handler_data are called when the write fully * completes, on error, or on file descriptor close. */ @@ -780,10 +777,8 @@ comm_local_port(int fd) } static comm_err_t - commBind(int s, struct IN_ADDR in_addr, u_short port) { - struct sockaddr_in S; memset(&S, '\0', sizeof(S)); @@ -802,12 +797,13 @@ commBind(int s, struct IN_ADDR in_addr, u_short port) return COMM_ERROR; } -/* Create a socket. Default is blocking, stream (TCP) socket. IO_TYPE - * is OR of flags specified in comm.h. Defaults TOS */ +/** + * Create a socket. Default is blocking, stream (TCP) socket. IO_TYPE + * is OR of flags specified in comm.h. Defaults TOS + */ int comm_open(int sock_type, int proto, - struct IN_ADDR addr, u_short port, int flags, @@ -831,18 +827,19 @@ comm_set_tos(int fd, int tos) debugs(50, 1, "comm_set_tos: setsockopt(IP_TOS) on FD " << fd << ": " << xstrerror()); return x; #else - debugs(50, 0, "comm_set_tos: setsockopt(IP_TOS) not supported on this platform"); + debugs(50, 0, "WARNING: setsockopt(IP_TOS) not supported on this platform"); return -1; #endif } -/* Create a socket. Default is blocking, stream (TCP) socket. IO_TYPE - * is OR of flags specified in defines.h:COMM_* */ +/** + * Create a socket. Default is blocking, stream (TCP) socket. IO_TYPE + * is OR of flags specified in defines.h:COMM_* + */ int comm_openex(int sock_type, int proto, - struct IN_ADDR addr, u_short port, int flags, diff --git a/src/debug.cc b/src/debug.cc index 72178fa4c0..550797320e 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,6 +1,5 @@ - /* - * $Id: debug.cc,v 1.103 2007/08/01 23:04:23 amosjeffries Exp $ + * $Id: debug.cc,v 1.104 2007/10/31 04:52:16 amosjeffries Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived