From: wessels <> Date: Fri, 28 Apr 2006 11:05:43 +0000 (+0000) Subject: Robert's patch to correct my LegacyParser abuse. X-Git-Tag: SQUID_3_0_PRE4~212 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a385afc3c5b932d1846afc394417c0bbc8002208;p=thirdparty%2Fsquid.git Robert's patch to correct my LegacyParser abuse. --- diff --git a/src/ICAP/ICAPConfig.cc b/src/ICAP/ICAPConfig.cc index 49381ac9d2..57b65061a1 100644 --- a/src/ICAP/ICAPConfig.cc +++ b/src/ICAP/ICAPConfig.cc @@ -1,6 +1,6 @@ /* - * $Id: ICAPConfig.cc,v 1.9 2006/04/27 19:27:37 wessels Exp $ + * $Id: ICAPConfig.cc,v 1.10 2006/04/28 05:05:47 wessels Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -45,9 +45,7 @@ #include "ACLChecklist.h" #include "wordlist.h" -extern ConfigParser LegacyParser; // from cache_cf.cc ICAPConfig TheICAPConfig; -extern ConfigParser LegacyParser; // found in cache_cf.cc ICAPServiceRep::Pointer ICAPConfig::findService(const String& key) @@ -352,7 +350,7 @@ ICAPConfig::dumpICAPClass(StoreEntry *entry, const char *name) }; void -ICAPConfig::parseICAPAccess() +ICAPConfig::parseICAPAccess(ConfigParser &parser) { String aKey; ConfigParser::ParseString(&aKey); @@ -362,7 +360,7 @@ ICAPConfig::parseICAPAccess() fatalf("Did not find ICAP class '%s' referenced on line %d\n", aKey.buf(), config_lineno); - aclParseAccessLine(LegacyParser, &theClass->accessList); + aclParseAccessLine(parser, &theClass->accessList); }; void diff --git a/src/ICAP/ICAPConfig.h b/src/ICAP/ICAPConfig.h index e7e0731802..007835c579 100644 --- a/src/ICAP/ICAPConfig.h +++ b/src/ICAP/ICAPConfig.h @@ -1,6 +1,6 @@ /* - * $Id: ICAPConfig.h,v 1.7 2005/12/22 23:52:28 wessels Exp $ + * $Id: ICAPConfig.h,v 1.8 2006/04/28 05:05:47 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -40,6 +40,8 @@ class acl_access; +class ConfigParser; + class ICAPConfig; class ICAPClass @@ -116,7 +118,7 @@ public: void freeICAPClass(void); void dumpICAPClass(StoreEntry *, const char *); - void parseICAPAccess(void); + void parseICAPAccess(ConfigParser &parser); void freeICAPAccess(void); void dumpICAPAccess(StoreEntry *, const char *); diff --git a/src/cache_cf.cc b/src/cache_cf.cc index db63ce2650..431b00eb65 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.493 2006/04/27 20:36:29 hno Exp $ + * $Id: cache_cf.cc,v 1.494 2006/04/28 05:05:43 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -145,8 +145,13 @@ static int check_null_https_port_list(const https_port_list *); #endif /* USE_SSL */ static void parse_b_size_t(size_t * var); -/* a parser for legacy code that uses the global approach */ -ConfigParser LegacyParser = ConfigParser(); +/* + * LegacyParser is a parser for legacy code that uses the global + * approach. This is static so that it is only exposed to cache_cf. + * Other modules needing access to a ConfigParser should have it + * provided to them in their parserFOO methods. + */ +static ConfigParser LegacyParser = ConfigParser(); void self_destruct(void) @@ -3260,7 +3265,7 @@ dump_icap_class_type(StoreEntry * entry, const char *name, ICAPConfig cfg) static void parse_icap_access_type(ICAPConfig * cfg) { - cfg->parseICAPAccess(); + cfg->parseICAPAccess(LegacyParser); } static void