From: robertc <> Date: Thu, 19 Jun 2003 19:11:59 +0000 (+0000) Subject: Summary: Gcc-3.3 tidyups. X-Git-Tag: SQUID_3_0_PRE1~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b6012c1a778704fd220c5cc06542d774d3586ae2;p=thirdparty%2Fsquid.git Summary: Gcc-3.3 tidyups. Keywords: * Gave lib/ the same AM CXX and CFLAGS as src/ * In mempool, extract method on the free cache cleanup, and use a more correct type for Free, to avoid a warning on our use of 'type punned' pointers. * Make squid_rn_inithead typesafe, and adjust usage throughout. * rfc1738_do_escape needed adjustment for the use of char comparison with 0xFF. * Make ACL Request/Reply HeaderStrategy singleton instance variable a pointer rather than instance to allow for stricter scoping rules. * VectorMap::indexUsed (unsigned char const index) had a tautology assert. --- diff --git a/doc/release-notes/release-3.0.sgml b/doc/release-notes/release-3.0.sgml index bbbfa132c2..a7f645f93b 100644 --- a/doc/release-notes/release-3.0.sgml +++ b/doc/release-notes/release-3.0.sgml @@ -2,7 +2,7 @@
Squid 3.0 release notes Squid Developers -$Id: release-3.0.sgml,v 1.7 2003/06/12 23:56:38 wessels Exp $ +$Id: release-3.0.sgml,v 1.8 2003/06/19 13:11:59 robertc Exp $ This document contains the release notes for version 3.0 of Squid. @@ -116,6 +116,7 @@ This fixes two issues:Transparently intercepted requests is no lo Complain if open of /dev/null fails; avoids infinite loop in ipcCreate(). Properly quote the quoting character '%' in log_quote() and username_quote(). in icmpRecv(), Handle the case when recv() returns EAGAIN and do not treat it like an error. + Update squid to build with gcc/g++ 3.3 with no warnings. Changes to squid.conf diff --git a/include/radix.h b/include/radix.h index 76bee3668e..ac6a6eb57c 100644 --- a/include/radix.h +++ b/include/radix.h @@ -1,5 +1,5 @@ /* - * $Id: radix.h,v 1.16 2003/01/23 00:36:47 robertc Exp $ + * $Id: radix.h,v 1.17 2003/06/19 13:12:00 robertc Exp $ */ #ifndef SQUID_RADIX_H @@ -119,7 +119,7 @@ struct squid_radix_node_head { SQUIDCEXTERN void squid_rn_init (void); -SQUIDCEXTERN int squid_rn_inithead(void **, int); +SQUIDCEXTERN int squid_rn_inithead(struct squid_radix_node_head **, int); SQUIDCEXTERN int squid_rn_refines(void *, void *); SQUIDCEXTERN int squid_rn_walktree(struct squid_radix_node_head *, int (*)(struct squid_radix_node *, void *), void *); SQUIDCEXTERN struct squid_radix_node *squid_rn_addmask(void *, int, int); diff --git a/lib/Makefile.am b/lib/Makefile.am index d3558d6958..47288effda 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,10 +1,13 @@ ## Process this file with automake to produce Makefile.in # -# $Id: Makefile.am,v 1.10 2003/03/10 04:56:21 robertc Exp $ +# $Id: Makefile.am,v 1.11 2003/06/19 13:12:00 robertc Exp $ # SUBDIRS = libTrie +AM_CFLAGS = @SQUID_CFLAGS@ +AM_CXXFLAGS = @SQUID_CXXFLAGS@ + if ENABLE_XPROF_STATS XPROF_STATS_SOURCE = Profiler.c else diff --git a/lib/MemPool.c b/lib/MemPool.c index 628cce286f..92a908419a 100644 --- a/lib/MemPool.c +++ b/lib/MemPool.c @@ -1,6 +1,6 @@ /* - * $Id: MemPool.c,v 1.16 2003/02/08 01:45:47 robertc Exp $ + * $Id: MemPool.c,v 1.17 2003/06/19 13:12:00 robertc Exp $ * * DEBUG: section 63 Low Level Memory Pool Management * AUTHOR: Alex Rousskov, Andres Kroonmaa @@ -567,20 +567,10 @@ memPoolFree(MemPool * pool, void *obj) } -/* removes empty Chunks from pool */ static void -memPoolCleanOne(MemPool * pool, time_t maxage) +memPoolConvertFreeCacheToChunkSpecific(MemPool * const pool) { - MemChunk *chunk, *freechunk, *listTail; - void **Free; - time_t age; - - if (!pool) - return; - if (!pool->Chunks) - return; - - memPoolFlushMetersFull(pool); + void *Free; /* * OK, so we have to go through all the global freeCache and find the Chunk * any given Free belongs to, and stuff it into that Chunk's freelist @@ -590,15 +580,31 @@ memPoolCleanOne(MemPool * pool, time_t maxage) lastPool = pool; pool->allChunks = splay_splay((const void **)&Free, pool->allChunks, memCompObjChunks); assert(splayLastResult == 0); - chunk = pool->allChunks->data; + MemChunk *chunk = pool->allChunks->data; assert(chunk->inuse_count > 0); chunk->inuse_count--; - pool->freeCache = *Free; /* remove from global cache */ - *Free = chunk->freeList; /* stuff into chunks freelist */ + pool->freeCache = *(void **)Free; /* remove from global cache */ + *(void **)Free = chunk->freeList; /* stuff into chunks freelist */ chunk->freeList = Free; chunk->lastref = squid_curtime; } +} + +/* removes empty Chunks from pool */ +static void +memPoolCleanOne(MemPool * pool, time_t maxage) +{ + MemChunk *chunk, *freechunk, *listTail; + time_t age; + + if (!pool) + return; + if (!pool->Chunks) + return; + + memPoolFlushMetersFull(pool); + memPoolConvertFreeCacheToChunkSpecific(pool); /* Now we have all chunks in this pool cleared up, all free items returned to their home */ /* We start now checking all chunks to see if we can release any */ /* We start from pool->Chunks->next, so first chunk is not released */ diff --git a/lib/radix.c b/lib/radix.c index 1e5ebfe25e..1f2c181b02 100644 --- a/lib/radix.c +++ b/lib/radix.c @@ -1,5 +1,5 @@ /* - * $Id: radix.c,v 1.19 2003/01/23 00:37:01 robertc Exp $ + * $Id: radix.c,v 1.20 2003/06/19 13:12:00 robertc Exp $ * * DEBUG: section 53 Radix tree data structure implementation * AUTHOR: NetBSD Derived @@ -950,7 +950,7 @@ squid_rn_walktree(struct squid_radix_node_head *h, int (*f) (struct squid_radix_ } int -squid_rn_inithead(void **head, int off) +squid_rn_inithead(struct squid_radix_node_head **head, int off) { register struct squid_radix_node_head *rnh; register struct squid_radix_node *t, *tt, *ttt; @@ -1005,7 +1005,7 @@ squid_rn_init(void) addmask_key = cplim = rn_ones + squid_max_keylen; while (cp < cplim) *cp++ = -1; - if (squid_rn_inithead((void **) &squid_mask_rnhead, 0) == 0) { + if (squid_rn_inithead(&squid_mask_rnhead, 0) == 0) { fprintf(stderr, "rn_init2 failed.\n"); exit(-1); } diff --git a/lib/rfc1738.c b/lib/rfc1738.c index dc5fb2f7a4..bbce0d0e83 100644 --- a/lib/rfc1738.c +++ b/lib/rfc1738.c @@ -1,5 +1,5 @@ /* - * $Id: rfc1738.c,v 1.24 2003/01/23 00:37:01 robertc Exp $ + * $Id: rfc1738.c,v 1.25 2003/06/19 13:12:00 robertc Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -128,8 +128,7 @@ rfc1738_do_escape(const char *url, int encode_reserved) do_escape = 1; } /* RFC 1738 says any non-US-ASCII are encoded */ - if (((unsigned char) *p >= (unsigned char) 0x80) && - ((unsigned char) *p <= (unsigned char) 0xFF)) { + if (((unsigned char) *p >= (unsigned char) 0x80)) { do_escape = 1; } /* Do the triplet encoding, or just copy the char */ diff --git a/src/ACLReplyHeaderStrategy.h b/src/ACLReplyHeaderStrategy.h index d56436830b..f4d6bd6724 100644 --- a/src/ACLReplyHeaderStrategy.h +++ b/src/ACLReplyHeaderStrategy.h @@ -1,6 +1,6 @@ /* - * $Id: ACLReplyHeaderStrategy.h,v 1.1 2003/02/25 12:22:34 robertc Exp $ + * $Id: ACLReplyHeaderStrategy.h,v 1.2 2003/06/19 13:12:01 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -55,7 +55,7 @@ public: ACLReplyHeaderStrategy(ACLReplyHeaderStrategy const &); private: - static ACLReplyHeaderStrategy Instance_; + static ACLReplyHeaderStrategy *Instance_; ACLReplyHeaderStrategy(){} ACLReplyHeaderStrategy&operator=(ACLReplyHeaderStrategy const &); @@ -77,10 +77,13 @@ template ACLReplyHeaderStrategy
* ACLReplyHeaderStrategy
::Instance() { - return &Instance_; + if (!Instance_) + Instance_ = new ACLReplyHeaderStrategy
; + + return Instance_; } template -ACLReplyHeaderStrategy
ACLReplyHeaderStrategy
::Instance_; +ACLReplyHeaderStrategy
* ACLReplyHeaderStrategy
::Instance_(NULL); #endif /* SQUID_REPLYHEADERSTRATEGY_H */ diff --git a/src/ACLRequestHeaderStrategy.h b/src/ACLRequestHeaderStrategy.h index 7da4a39e4b..c70b88a19a 100644 --- a/src/ACLRequestHeaderStrategy.h +++ b/src/ACLRequestHeaderStrategy.h @@ -1,6 +1,6 @@ /* - * $Id: ACLRequestHeaderStrategy.h,v 1.3 2003/02/25 12:22:34 robertc Exp $ + * $Id: ACLRequestHeaderStrategy.h,v 1.4 2003/06/19 13:12:01 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -55,7 +55,7 @@ public: ACLRequestHeaderStrategy(ACLRequestHeaderStrategy const &); private: - static ACLRequestHeaderStrategy Instance_; + static ACLRequestHeaderStrategy *Instance_; ACLRequestHeaderStrategy(){} ACLRequestHeaderStrategy&operator=(ACLRequestHeaderStrategy const &); @@ -77,10 +77,13 @@ template ACLRequestHeaderStrategy
* ACLRequestHeaderStrategy
::Instance() { - return &Instance_; + if (!Instance_) + Instance_ = new ACLRequestHeaderStrategy
; + + return Instance_; } template -ACLRequestHeaderStrategy
ACLRequestHeaderStrategy
::Instance_; +ACLRequestHeaderStrategy
* ACLRequestHeaderStrategy
::Instance_ (NULL); #endif /* SQUID_REQUESTHEADERSTRATEGY_H */ diff --git a/src/HttpHdrRange.cc b/src/HttpHdrRange.cc index e510877469..3de32b2d00 100644 --- a/src/HttpHdrRange.cc +++ b/src/HttpHdrRange.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrRange.cc,v 1.34 2003/06/18 12:24:02 robertc Exp $ + * $Id: HttpHdrRange.cc,v 1.35 2003/06/19 13:12:01 robertc Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -612,6 +612,7 @@ void HttpHdrRangeIter::updateSpec() { assert (debt_size == 0); + assert (valid); if (pos.incrementable()) { debt(currentSpec()->length); diff --git a/src/asn.cc b/src/asn.cc index c46e95de64..1a787fdfc5 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.92 2003/03/06 06:21:37 robertc Exp $ + * $Id: asn.cc,v 1.93 2003/06/19 13:12:04 robertc Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -186,7 +186,7 @@ asnInit(void) if (0 == inited++) squid_rn_init(); - squid_rn_inithead((void **) &AS_tree_head, 8); + squid_rn_inithead(&AS_tree_head, 8); cachemgrRegister("asndb", "AS Number Database", asnStats, 0, 1); } diff --git a/src/delay_pools.cc b/src/delay_pools.cc index aa3e5536e6..35e884a4f4 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.cc,v 1.39 2003/05/20 12:17:39 robertc Exp $ + * $Id: delay_pools.cc,v 1.40 2003/06/19 13:12:05 robertc Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: Robert Collins @@ -803,7 +803,6 @@ template bool VectorMap::indexUsed (unsigned char const index) const { - assert (index <= IND_MAP_SZ); return index < size(); }