On Fri, 2006-04-28 at 08:34 +1000, Robert Collins wrote:
> On Thu, 2006-04-27 at 19:07 +0000, [EMAIL PROTECTED] wrote:
> > wessels     2006/04/27 13:07:16 MDT
> > 
> >   Modified files:
> >     src                  cache_cf.cc 
> >   Log:
> >   bugfix: ICAPConfig calls aclParseAccessLine(), which now takes a
> >   ConfigParser argument.  Use the LegacyParser from cache_cf.cc, but
> >   we need to make it global instead of static.
> >   
> >   Revision  Changes    Path
> >   1.492     +2 -2      squid3/src/cache_cf.cc
> 
> I'm trying to decouple the parser from the config with the LegacyParser:
> adding the parser as a common parameter to the modular parser like:
> 
> aclParseAccessLine(LegacyParser, head);
> 
> For example in cache_cf.cc:
> 
> static void
> parse_icap_service_type(ICAPConfig * cfg)
> {   
>     cfg->parseICAPService(LegacyParser);
> }
> 
> 
> Is that OK?

Attached a patch to make it so.

The point of this is to allow testing of configuration using modules
without linking cache_cf.o in - because that drags in all of squid by
reference. Instead the tokeniser only is brought in.

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
=== modified file 'a/src/ICAP/ICAPConfig.cc'
--- a/src/ICAP/ICAPConfig.cc	
+++ b/src/ICAP/ICAPConfig.cc	
@@ -34,8 +34,8 @@
 
 #include "squid.h"
 
+#include "ACL.h"
 #include "ConfigParser.h"
-#include "ACL.h"
 #include "Store.h"
 #include "Array.h"	// really Vector
 #include "ICAPConfig.h"
@@ -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 @@
 };
 
 void
-ICAPConfig::parseICAPAccess()
+ICAPConfig::parseICAPAccess(ConfigParser &parser)
 {
     String aKey;
     ConfigParser::ParseString(&aKey);
@@ -362,7 +360,7 @@
         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

=== modified file 'a/src/ICAP/ICAPConfig.h'
--- a/src/ICAP/ICAPConfig.h	
+++ b/src/ICAP/ICAPConfig.h	
@@ -39,6 +39,8 @@
 #include "ICAPServiceRep.h"
 
 class acl_access;
+
+class ConfigParser;
 
 class ICAPConfig;
 
@@ -116,7 +118,7 @@
     void freeICAPClass(void);
     void dumpICAPClass(StoreEntry *, const char *);
 
-    void parseICAPAccess(void);
+    void parseICAPAccess(ConfigParser &parser);
     void freeICAPAccess(void);
     void dumpICAPAccess(StoreEntry *, const char *);
 

=== modified file 'a/src/cache_cf.cc'
--- a/src/cache_cf.cc	
+++ b/src/cache_cf.cc	
@@ -145,8 +145,12 @@
 #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();
+/* 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 +3264,7 @@
 static void
 parse_icap_access_type(ICAPConfig * cfg)
 {
-    cfg->parseICAPAccess();
+    cfg->parseICAPAccess(LegacyParser);
 }
 
 static void

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to