From: Francesco Chemolli Date: Sun, 13 Jul 2008 08:37:43 +0000 (+0200) Subject: Namespace cleanups and dead code removal X-Git-Tag: SQUID_3_1_0_1~49^2~143^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b7d87bbe5ea8867a241477ee6504c5d70dff59a;p=thirdparty%2Fsquid.git Namespace cleanups and dead code removal --- diff --git a/include/profiling.h b/include/profiling.h index 88d354a593..c6ab231361 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -213,9 +213,6 @@ SQUIDCEXTERN TimersArray *xprof_Timers; SQUIDCEXTERN void xprof_start(xprof_type type, const char *timer); SQUIDCEXTERN void xprof_stop(xprof_type type, const char *timer); SQUIDCEXTERN void xprof_event(void *data); -#if __cplusplus -extern void xprofRegisterWithCacheManager(void); -#endif #define PROF_start(type) xprof_start(XPROF_##type, #type) #define PROF_stop(type) xprof_stop(XPROF_##type, #type) diff --git a/src/ACLASN.h b/src/ACLASN.h index 63585936d5..d6223adb2e 100644 --- a/src/ACLASN.h +++ b/src/ACLASN.h @@ -41,10 +41,6 @@ #include "ACLChecklist.h" #include "IPAddress.h" -/* forward decls */ - -class CacheManager; - SQUIDCEXTERN int asnMatchIp(CbDataList *, IPAddress &); /// \ingroup ACLAPI diff --git a/src/AccessLogEntry.h b/src/AccessLogEntry.h index ef559f3df5..e26facd6e8 100644 --- a/src/AccessLogEntry.h +++ b/src/AccessLogEntry.h @@ -40,7 +40,6 @@ #include "HttpRequestMethod.h" /* forward decls */ -class CacheManager; class HttpReply; class HttpRequest; diff --git a/src/AuthConfig.h b/src/AuthConfig.h index 6f675e3b37..206a8507f1 100644 --- a/src/AuthConfig.h +++ b/src/AuthConfig.h @@ -36,7 +36,6 @@ class AuthUserRequest; class StoreEntry; class HttpReply; class HttpRequest; -class CacheManager; /* for http_hdr_type parameters-by-value */ #include "HttpHeader.h" diff --git a/src/DelayPools.h b/src/DelayPools.h index f9468fbf4b..42eb81f7c4 100644 --- a/src/DelayPools.h +++ b/src/DelayPools.h @@ -50,7 +50,6 @@ public: }; /* forward decls */ -class CacheManager; class DelayPool; class Updateable; class StoreEntry; @@ -64,7 +63,6 @@ class DelayPools public: static void Init(); - static void RegisterWithCacheManager(void); static void Update(void *); static unsigned short pools(); static void pools (u_short pools); @@ -82,6 +80,7 @@ private: static unsigned short pools_; static void FreeDelayData (); static Vector toUpdate; + static void RegisterWithCacheManager(void); }; #endif /* SQUID_DELAYPOOLS_H */ diff --git a/src/DiskIO/DiskIOModule.h b/src/DiskIO/DiskIOModule.h index a766e1c907..98c2847045 100644 --- a/src/DiskIO/DiskIOModule.h +++ b/src/DiskIO/DiskIOModule.h @@ -47,7 +47,6 @@ class DiskIOModule { public: - static void RegisterAllModulesWithCacheManager(void); static void SetupAllModules(); static void ModuleAdd(DiskIOModule &); static void FreeAllModules(); @@ -74,6 +73,7 @@ public: protected: //bool initialised; + static void RegisterAllModulesWithCacheManager(void); private: static Vector &GetModules(); diff --git a/src/ExternalACL.h b/src/ExternalACL.h index ac6998e472..8b15be8bea 100644 --- a/src/ExternalACL.h +++ b/src/ExternalACL.h @@ -92,6 +92,4 @@ protected: MEMPROXY_CLASS_INLINE(ACLExternal); -extern void externalAclRegisterWithCacheManager(void); - #endif /* SQUID_EXTERNALACL_H */ diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 062088c176..9d457c2db5 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -272,6 +272,15 @@ static void httpHeaderStatDump(const HttpHeaderStat * hs, StoreEntry * e); * Module initialization routines */ +static void +httpHeaderRegisterWithCacheManager(void) +{ + CacheManager::GetInstance()-> + registerAction("http_headers", + "HTTP Header Statistics", + httpHeaderStoreReport, 0, 1); +} + void httpHeaderInitModule(void) { @@ -330,15 +339,6 @@ httpHeaderInitModule(void) httpHeaderRegisterWithCacheManager(); } -void -httpHeaderRegisterWithCacheManager(void) -{ - CacheManager::GetInstance()-> - registerAction("http_headers", - "HTTP Header Statistics", - httpHeaderStoreReport, 0, 1); -} - void httpHeaderCleanModule(void) { diff --git a/src/HttpHeader.h b/src/HttpHeader.h index 29a84a5502..74225a9949 100644 --- a/src/HttpHeader.h +++ b/src/HttpHeader.h @@ -33,9 +33,6 @@ #ifndef SQUID_HTTPHEADER_H #define SQUID_HTTPHEADER_H -/* forward decls */ - -class CacheManager; /* because we pass a spec by value */ #include "HttpHeaderRange.h" @@ -269,7 +266,6 @@ private: }; -extern void httpHeaderRegisterWithCacheManager(void); extern int httpHeaderParseQuotedString (const char *start, String *val); SQUIDCEXTERN int httpHeaderHasByNameListMember(const HttpHeader * hdr, const char *name, const char *member, const char separator); SQUIDCEXTERN void httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, const HttpHeaderMask * denied_mask); diff --git a/src/Mem.h b/src/Mem.h index ba2d3cc7b7..f188cc5106 100644 --- a/src/Mem.h +++ b/src/Mem.h @@ -34,7 +34,6 @@ #ifndef SQUID_MEM #define SQUID_MEM -class CacheManager; class StoreEntry; class MemPoolStats; class MemPoolMeter; diff --git a/src/ProfStats.cc b/src/ProfStats.cc index 0afa1aaa99..514b93089f 100644 --- a/src/ProfStats.cc +++ b/src/ProfStats.cc @@ -265,6 +265,13 @@ xprof_chk_overhead(int samples) } } +static void +xprofRegisterWithCacheManager(void) +{ + CacheManager::GetInstance()-> + registerAction("cpu_profile", "CPU Profiling Stats", xprof_summary, 0, 1); +} + // FIXME: // this gets colled once per event. This doesn't seem to make much sense, // does it? @@ -282,13 +289,6 @@ xprof_Init(void) xprofRegisterWithCacheManager(); //moved here so it's not double-init'ed } -void -xprofRegisterWithCacheManager(void) -{ - CacheManager::GetInstance()-> - registerAction("cpu_profile", "CPU Profiling Stats", xprof_summary, 0, 1); -} - void xprof_event(void *data) { diff --git a/src/SquidString.h b/src/SquidString.h index db650e3f89..fd44707408 100644 --- a/src/SquidString.h +++ b/src/SquidString.h @@ -37,10 +37,6 @@ #include "config.h" -/* forward decls */ - -class CacheManager; - /** todo checks to wrap this include properly */ #include diff --git a/src/Store.h b/src/Store.h index 4dce408fac..da432a0dd9 100644 --- a/src/Store.h +++ b/src/Store.h @@ -338,9 +338,6 @@ SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_fl /// \ingroup StoreAPI SQUIDCEXTERN void storeInit(void); -/// \ingroup StoreAPI -extern void storeRegisterWithCacheManager(void); - /// \ingroup StoreAPI SQUIDCEXTERN void storeConfigure(void); diff --git a/src/StoreFileSystem.h b/src/StoreFileSystem.h index 453f2caf3e..b1e1d3fd1b 100644 --- a/src/StoreFileSystem.h +++ b/src/StoreFileSystem.h @@ -104,7 +104,6 @@ * given StoreEntry. A maxobjsize of -1 means 'any size'. */ -class CacheManager; class SwapDir; /** @@ -117,7 +116,6 @@ class StoreFileSystem { public: - static void RegisterAllFsWithCacheManager(void); static void SetupAllFs(); static void FsAdd(StoreFileSystem &); static void FreeAllFs(); @@ -131,7 +129,6 @@ public: virtual char const *type () const = 0; virtual SwapDir *createSwapDir() = 0; virtual void done() = 0; - virtual void registerWithCacheManager(void); virtual void setup() = 0; // Not implemented StoreFileSystem(StoreFileSystem const &); @@ -139,10 +136,12 @@ public: protected: bool initialised; + virtual void registerWithCacheManager(void); private: static Vector &GetFileSystems(); static Vector *_FileSystems; + static void RegisterAllFsWithCacheManager(void); }; // TODO: Kill this typedef! diff --git a/src/delay_pools.cc b/src/delay_pools.cc index c593fce3b4..31efc28c46 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -550,19 +550,20 @@ time_t DelayPools::LastUpdate = 0; unsigned short DelayPools::pools_ (0); void -DelayPools::Init() +DelayPools::RegisterWithCacheManager(void) { - LastUpdate = getCurrentTime(); - RegisterWithCacheManager(); + CacheManager::GetInstance()-> + registerAction("delay", "Delay Pool Levels", Stats, 0, 1); } void -DelayPools::RegisterWithCacheManager(void) +DelayPools::Init() { - CacheManager::GetInstance()-> - registerAction("delay", "Delay Pool Levels", Stats, 0, 1); + LastUpdate = getCurrentTime(); + RegisterWithCacheManager(); } + void DelayPools::InitDelayData() { diff --git a/src/dns.cc b/src/dns.cc index 8e2c0c8f93..2b0b0a7451 100644 --- a/src/dns.cc +++ b/src/dns.cc @@ -55,6 +55,13 @@ dnsStats(StoreEntry * sentry) helperStats(sentry, dnsservers); } +static void +dnsRegisterWithCacheManager(void) +{ + CacheManager::GetInstance-> + registerAction("dns", "Dnsserver Statistics", dnsStats, 0, 1); +} + void dnsInit(void) { @@ -87,13 +94,6 @@ dnsInit(void) helperOpenServers(dnsservers); } -void -dnsRegisterWithCacheManager(void) -{ - CacheManager::GetInstance-> - registerAction("dns", "Dnsserver Statistics", dnsStats, 0, 1); -} - void dnsShutdown(void) { diff --git a/src/external_acl.cc b/src/external_acl.cc index 0abe123468..513904c315 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -1293,6 +1293,15 @@ externalAclStats(StoreEntry * sentry) } } +static void +externalAclRegisterWithCacheManager(void) +{ + CacheManager::GetInstance()-> + registerAction("external_acl", + "External ACL stats", + externalAclStats, 0, 1); +} + void externalAclInit(void) { @@ -1327,15 +1336,6 @@ externalAclInit(void) externalAclRegisterWithCacheManager(); } -void -externalAclRegisterWithCacheManager(void) -{ - CacheManager::GetInstance()-> - registerAction("external_acl", - "External ACL stats", - externalAclStats, 0, 1); -} - void externalAclShutdown(void) { diff --git a/src/forward.h b/src/forward.h index 3c3b80d2bc..b9a9b90e1a 100644 --- a/src/forward.h +++ b/src/forward.h @@ -3,7 +3,6 @@ /* forward decls */ -class CacheManager; class ErrorState; #include "comm.h" diff --git a/src/main.cc b/src/main.cc index 8ff5dcc07f..17f416f212 100644 --- a/src/main.cc +++ b/src/main.cc @@ -968,52 +968,11 @@ mainInitialize(void) * coexist. */ - //clientdbRegisterWithCacheManager(); //moved to clientdbInit() -#if DELAY_POOLS - - //DelayPools::RegisterWithCacheManager(); //moved to DelayPools::Init() -#endif - - //DiskIOModule::RegisterAllModulesWithCacheManager(); - // moved to each module's init() function -#if USE_DNSSERVERS - - // dnsRegisterWithCacheManager(); //moved to dnsInit() -#endif - eventInit(); - // externalAclRegisterWithCacheManager(); //moved to externalAclInit() - // fqdncacheRegisterWithCacheManager(); //moved to fqdncache_init() - // FwdState::RegisterWithCacheManager(); //moved to FwdState::initModule - // httpHeaderRegisterWithCacheManager(); //moved to httpHeaderInitModule -#if !USE_DNSSERVERS - //TODO: remove cache manager registration functions from namespace - // (protos.h and make them static where appropriate) - // idnsRegisterWithCacheManager(); // moved to idnsInit() -#endif - - // ipcacheRegisterWithCacheManager(); //moved to ipcache_init() - // Mem::RegisterWithCacheManager(); //moved to Mem::Init() - // netdbRegisterWitHCacheManager(); //moved to netdbInit() + // TODO: pconn is a good candidate for new-style registration // PconnModule::GetInstance()->registerWithCacheManager(); // moved to PconnModule::PconnModule() - // redirectRegisterWithCacheManager(); //moved to redirectInit() - // refreshRegisterWithCacheManager(); //moved to refreshInit() - // statRegisterWithCacheManager(); //moved to statInit() - // storeDigestRegisterWithCacheManager(); //moved to storeDigestInit() - // StoreFileSystem::RegisterAllFsWithCacheManager(); - // storeRegisterWithCacheManager(); //moved to storeInit() - // storeLogRegisterWithCacheManager(); //moved to storeLogOpen() -#if DEBUGSTRINGS - // cpu_prStringRegistry::Instance().registerWithCacheManager(); - // moved to class constructor -#endif - -#if USE_XPROF_STATS - // xprofRegisterWithCacheManager(); //moved to xprof_init() -#endif - } #if USE_WCCP diff --git a/src/pconn.h b/src/pconn.h index 5e612c5502..3253d88bb1 100644 --- a/src/pconn.h +++ b/src/pconn.h @@ -11,7 +11,6 @@ \todo CLEANUP: Break multiple classes out of the generic pconn.h header */ -class CacheManager; class PconnPool; /* for CBDATA_CLASS2() macros */ @@ -90,7 +89,6 @@ private: }; -class CacheManager; class StoreEntry; class PconnPool; diff --git a/src/protos.h b/src/protos.h index 3ab251642c..96cb5856fb 100644 --- a/src/protos.h +++ b/src/protos.h @@ -43,7 +43,6 @@ /* some parameters stil need this */ #include "wordlist.h" -class CacheManager; class HttpRequestMethod; diff --git a/src/store.cc b/src/store.cc index 0463a19977..33a5aaea96 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1387,6 +1387,16 @@ StoreEntry::validLength() const return 0; } +static void +storeRegisterWithCacheManager(void) +{ + CacheManager *manager=CacheManager::GetInstance(); + manager->registerAction("storedir", "Store Directory Stats", Store::Stats, 0, 1); + manager->registerAction("store_io", "Store IO Interface Stats", storeIOStats, 0, 1); + manager->registerAction("store_check_cachable_stats", "storeCheckCachable() Stats", + storeCheckCachableStats, 0, 1); +} + void storeInit(void) { @@ -1401,16 +1411,6 @@ storeInit(void) storeRegisterWithCacheManager(); } -void -storeRegisterWithCacheManager(void) -{ - CacheManager *manager=CacheManager::GetInstance(); - manager->registerAction("storedir", "Store Directory Stats", Store::Stats, 0, 1); - manager->registerAction("store_io", "Store IO Interface Stats", storeIOStats, 0, 1); - manager->registerAction("store_check_cachable_stats", "storeCheckCachable() Stats", - storeCheckCachableStats, 0, 1); -} - void storeConfigure(void) {