]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: remove strtokFile() wrapper function
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 29 Jan 2015 19:05:24 +0000 (11:05 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 29 Jan 2015 19:05:24 +0000 (11:05 -0800)
This global function was a wrapper around ConfigParser::strtokFile()
which did nothing but cause additional dependency on cache_cf.h and
cache_cf.cc.

23 files changed:
src/acl/Arp.cc
src/acl/Asn.cc
src/acl/AtStepData.cc
src/acl/CertificateData.cc
src/acl/DomainData.cc
src/acl/Eui64.cc
src/acl/HierCodeData.cc
src/acl/HttpHeaderData.cc
src/acl/HttpStatus.cc
src/acl/IntRange.cc
src/acl/Ip.cc
src/acl/MaxConnection.cc
src/acl/MethodData.cc
src/acl/NoteData.cc
src/acl/ProtocolData.cc
src/acl/Random.cc
src/acl/SslErrorData.cc
src/acl/StringData.cc
src/acl/TimeData.cc
src/cache_cf.cc
src/cache_cf.h
src/external_acl.cc
src/tests/stub_cache_cf.cc

index d8e327e967b142418cd6daafba1c76d70bd161c2..11fb0b6457525b8388fd67edf4342865a90f2c41 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "acl/Arp.h"
 #include "acl/FilledChecklist.h"
-#include "cache_cf.h"
 #include "Debug.h"
 #include "eui/Eui48.h"
 #include "globals.h"
@@ -102,7 +101,7 @@ aclParseArpData(const char *t)
 void
 ACLARP::parse()
 {
-    while (const char *t = strtokFile()) {
+    while (const char *t = ConfigParser::strtokFile()) {
         if (Eui::Eui48 *q = aclParseArpData(t)) {
             aclArpData.insert(*q);
             delete q;
index 1adb07f360fadc6c9b2a6a672696391df1f69cd6..418bc98758ac6133ac815724f278e79fd99fe17e 100644 (file)
@@ -15,7 +15,6 @@
 #include "acl/DestinationAsn.h"
 #include "acl/DestinationIp.h"
 #include "acl/SourceAsn.h"
-#include "cache_cf.h"
 #include "FwdState.h"
 #include "HttpReply.h"
 #include "HttpRequest.h"
@@ -26,7 +25,6 @@
 #include "SquidConfig.h"
 #include "Store.h"
 #include "StoreClient.h"
-#include "StoreClient.h"
 
 #define WHOIS_PORT 43
 #define AS_REQBUF_SZ    4096
@@ -559,7 +557,7 @@ ACLASN::parse()
     char *t = NULL;
 
     for (Tail = curlist; *Tail; Tail = &((*Tail)->next));
-    while ((t = strtokFile())) {
+    while ((t = ConfigParser::strtokFile())) {
         q = new CbDataList<int> (atoi(t));
         *(Tail) = q;
         Tail = &q->next;
index dc5a69a639613a5dcd23eb89673ed4609b934416..bc238be0a1a6518aa588f10adee531766011ba72 100644 (file)
@@ -13,6 +13,7 @@
 #include "acl/AtStepData.h"
 #include "acl/Checklist.h"
 #include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 #include "wordlist.h"
 
@@ -53,7 +54,7 @@ ACLAtStepData::dump() const
 void
 ACLAtStepData::parse()
 {
-    while (const char *t = strtokFile()) {
+    while (const char *t = ConfigParser::strtokFile()) {
         if (strcasecmp(t, "SslBump1") == 0) {
             values.push_back(Ssl::bumpStep1);
         } else if (strcasecmp(t, "SslBump2") == 0) {
index f85fe64c97494e93eb3f7cd63fd0e3ddef3cc5f1..8afa1668067d9810bfcef06defa3fbbe00f15593 100644 (file)
@@ -12,6 +12,7 @@
 #include "acl/CertificateData.h"
 #include "acl/Checklist.h"
 #include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 #include "wordlist.h"
 
@@ -92,7 +93,7 @@ void
 ACLCertificateData::parse()
 {
     if (validAttributesStr) {
-        char *newAttribute = strtokFile();
+        char *newAttribute = ConfigParser::strtokFile();
 
         if (!newAttribute) {
             if (attributeIsOptional)
index 4857323a0980f6646b61b2153a752e68040634fb..cbefc12e6ef2def2da8eb3c5403b8d5cab5e7649 100644 (file)
@@ -12,6 +12,7 @@
 #include "acl/Checklist.h"
 #include "acl/DomainData.h"
 #include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 #include "src/URL.h"
 #include "util.h"
@@ -134,12 +135,10 @@ ACLDomainData::dump() const
 void
 ACLDomainData::parse()
 {
-    char *t = NULL;
-
     if (!domains)
         domains = new Splay<char *>();
 
-    while ((t = strtokFile())) {
+    while (char *t = ConfigParser::strtokFile()) {
         Tolower(t);
         domains->insert(xstrdup(t), aclDomainCompare);
     }
index dc1731925b94846069d620f75afee81e5bff0c85..d8b93d6b1f16fdb3d79edcb7de6270fabd26a607 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "acl/Eui64.h"
 #include "acl/FilledChecklist.h"
-#include "cache_cf.h"
 #include "Debug.h"
 #include "eui/Eui64.h"
 #include "globals.h"
@@ -74,7 +73,7 @@ aclParseEuiData(const char *t)
 void
 ACLEui64::parse()
 {
-    while (const char * t = strtokFile()) {
+    while (const char * t = ConfigParser::strtokFile()) {
         if (Eui::Eui64 * q = aclParseEuiData(t)) {
             eui64Data.insert(*q);
             delete q;
index 626c04d9b39d5dab943ca3c95eab525b22399e5d..59d356192541b116da39f2d6b8623d83d6438417 100644 (file)
@@ -9,7 +9,7 @@
 #include "squid.h"
 #include "acl/Checklist.h"
 #include "acl/HierCodeData.h"
-#include "cache_cf.h"
+#include "ConfigParser.h"
 #include "fatal.h"
 #include "hier_code.h"
 
@@ -51,7 +51,7 @@ ACLHierCodeData::parse()
 {
     char *t = NULL;
 
-    while ((t = strtokFile())) {
+    while ((t = ConfigParser::strtokFile())) {
         for (hier_code iter = HIER_NONE; iter <= HIER_MAX; ++iter) {
             if (iter == HIER_MAX) {
                 fatalf("ERROR: No such hier_code '%s'",t);
index 9617078b844f300bda36a181ff92e2b07df92126..68cae3ec94d08202a915e89f91d17902905f640a 100644 (file)
@@ -13,7 +13,6 @@
 #include "acl/Checklist.h"
 #include "acl/HttpHeaderData.h"
 #include "acl/RegexData.h"
-#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "Debug.h"
 #include "HttpHeaderTools.h"
@@ -73,7 +72,7 @@ ACLHTTPHeaderData::dump() const
 void
 ACLHTTPHeaderData::parse()
 {
-    char* t = strtokFile();
+    char* t = ConfigParser::strtokFile();
     assert (t != NULL);
     hdrName = t;
     hdrId = httpHeaderIdByNameDef(hdrName.rawBuf(), hdrName.size());
index 715b84750968ec144ea0f4739d3849efb71a401f..5dac3c90046af665a597e90122ce88e0a4a8b1fc 100644 (file)
@@ -11,7 +11,6 @@
 #include "squid.h"
 #include "acl/FilledChecklist.h"
 #include "acl/HttpStatus.h"
-#include "cache_cf.h"
 #include "Debug.h"
 #include "HttpReply.h"
 
@@ -120,14 +119,9 @@ ACLHTTPStatus::parse()
 void
 aclParseHTTPStatusList(Splay<acl_httpstatus_data *> **curlist)
 {
-    char *t = NULL;
-    acl_httpstatus_data *q = NULL;
-
-    while ((t = strtokFile())) {
-        if ((q = aclParseHTTPStatusData(t)) == NULL)
-            continue;
-
-        (*curlist)->insert(q, acl_httpstatus_data::compare);
+    while (char *t = ConfigParser::strtokFile()) {
+        if (acl_httpstatus_data *q = aclParseHTTPStatusData(t))
+            (*curlist)->insert(q, acl_httpstatus_data::compare);
     }
 }
 
index 3bd8b11c3aa2899be8b7ddf8b0e10b582111509b..8d471b7002a4625c9b75e417d89132618cf10b91 100644 (file)
@@ -11,6 +11,7 @@
 #include "squid.h"
 #include "acl/IntRange.h"
 #include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 #include "fatal.h"
 #include "Parsing.h"
@@ -18,9 +19,7 @@
 void
 ACLIntRange::parse()
 {
-    char *a;
-
-    while ((a = strtokFile())) {
+    while (char *a = ConfigParser::strtokFile()) {
         char *b = strchr(a, '-');
         unsigned short port1, port2;
 
index adcfb48269aaacfe6adb05839c864651be49ca9d..d0108af0bd143f46af3d3d5ddcafe79e40409761 100644 (file)
@@ -12,6 +12,7 @@
 #include "acl/Checklist.h"
 #include "acl/Ip.h"
 #include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 #include "ip/tools.h"
 #include "MemBuf.h"
@@ -478,7 +479,7 @@ ACLIP::parse()
 
     flags.parseFlags();
 
-    while (char *t = strtokFile()) {
+    while (char *t = ConfigParser::strtokFile()) {
         acl_ip_data *q = acl_ip_data::FactoryParse(t);
 
         while (q != NULL) {
index 15bc46dcb2e324c40d674e7a6c247f937a18d1aa..ca2d0b7d3f7d65e4c2fc70e55bfd7a0614ed8c49 100644 (file)
@@ -11,7 +11,6 @@
 #include "squid.h"
 #include "acl/FilledChecklist.h"
 #include "acl/MaxConnection.h"
-#include "cache_cf.h"
 #include "client_db.h"
 #include "Debug.h"
 #include "SquidConfig.h"
@@ -52,7 +51,7 @@ ACLMaxConnection::valid () const
 void
 ACLMaxConnection::parse()
 {
-    char *t = strtokFile();
+    char *t = ConfigParser::strtokFile();
 
     if (!t)
         return;
@@ -62,7 +61,7 @@ ACLMaxConnection::parse()
     /* suck out file contents */
     // ignore comments
     bool ignore = false;
-    while ((t = strtokFile())) {
+    while ((t = ConfigParser::strtokFile())) {
         ignore |= (*t != '#');
 
         if (ignore)
index 0d3fcdd800cbca7a3c6e0eaa80ad3d63e30fb266..857bbba329bd2a6e1dca8521413f86f59ebe9d6c 100644 (file)
@@ -11,7 +11,7 @@
 #include "squid.h"
 #include "acl/Checklist.h"
 #include "acl/MethodData.h"
-#include "cache_cf.h"
+#include "ConfigParser.h"
 #include "http/RequestMethod.h"
 
 int ACLMethodData::ThePurgeCount = 0;
@@ -54,7 +54,7 @@ ACLMethodData::dump() const
 void
 ACLMethodData::parse()
 {
-    while (char *t = strtokFile()) {
+    while (char *t = ConfigParser::strtokFile()) {
         HttpRequestMethod m;
         m.HttpRequestMethodXXX(t);
         values.push_back(m);
index c54e6e0440c326e33e3332fbd4eb6400edb58635..f81de96b8070d04e79afe671fa0a0aaf48c63c0d 100644 (file)
@@ -11,7 +11,6 @@
 #include "acl/Checklist.h"
 #include "acl/NoteData.h"
 #include "acl/StringData.h"
-#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "Debug.h"
 #include "HttpRequest.h"
@@ -77,7 +76,7 @@ ACLNoteData::dump() const
 void
 ACLNoteData::parse()
 {
-    char* t = strtokFile();
+    char* t = ConfigParser::strtokFile();
     assert (t != NULL);
     name = t;
     values->parse();
index 7f632ff161e2541854ed6c230ae7c7de13b5c7b0..245c23366a4025762dd867b87b0b4ab957168fdf 100644 (file)
@@ -11,7 +11,7 @@
 #include "squid.h"
 #include "acl/Checklist.h"
 #include "acl/ProtocolData.h"
-#include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 #include "wordlist.h"
 
@@ -53,7 +53,7 @@ ACLProtocolData::dump() const
 void
 ACLProtocolData::parse()
 {
-    while (char *t = strtokFile()) {
+    while (char *t = ConfigParser::strtokFile()) {
         int p = AnyP::PROTO_NONE;
         for (; p < AnyP::PROTO_UNKNOWN; ++p) {
             if (strcasecmp(t, AnyP::ProtocolType_str[p]) == 0) {
index 9773e9b1490f15ef32e94be05fe0dee2bb5c657f..45fd0b2b4daeb48216487db9d06d7128de1899c3 100644 (file)
@@ -9,10 +9,8 @@
 /* DEBUG: section 28    Access Control */
 
 #include "squid.h"
-
 #include "acl/FilledChecklist.h"
 #include "acl/Random.h"
-#include "cache_cf.h"
 #include "Debug.h"
 #include "Parsing.h"
 #include "wordlist.h"
@@ -60,10 +58,9 @@ ACLRandom::valid() const
 void
 ACLRandom::parse()
 {
-    char *t;
     char bufa[256], bufb[256];
 
-    t = strtokFile();
+    char *t = ConfigParser::strtokFile();
     if (!t) {
         debugs(28, DBG_PARSE_NOTE(DBG_IMPORTANT), "ACL random missing pattern");
         return;
index 5c0ebc679f445ba4235d8c9ebb858bd1204b8abe..b42bd6ce274644e443b907338126bb0a1bcd4de5 100644 (file)
@@ -9,7 +9,6 @@
 #include "squid.h"
 #include "acl/Checklist.h"
 #include "acl/SslErrorData.h"
-#include "cache_cf.h"
 #include "wordlist.h"
 
 ACLSslErrorData::ACLSslErrorData() : values (NULL)
@@ -58,10 +57,9 @@ void
 ACLSslErrorData::parse()
 {
     Ssl::Errors **Tail;
-    char *t = NULL;
 
     for (Tail = &values; *Tail; Tail = &((*Tail)->next));
-    while ((t = strtokFile())) {
+    while (char *t = ConfigParser::strtokFile()) {
         Ssl::Errors *q = Ssl::ParseErrorString(t);
         *(Tail) = q;
         Tail = &q->tail()->next;
index 59a03f233b35c1f377b383146f91008069df1b4c..9432f54202ab4c67e6dee34727cf34596ee381df 100644 (file)
@@ -11,7 +11,7 @@
 #include "squid.h"
 #include "acl/Checklist.h"
 #include "acl/StringData.h"
-#include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 
 ACLStringData::ACLStringData(ACLStringData const &old) : stringValues(old.stringValues)
@@ -50,8 +50,7 @@ ACLStringData::dump() const
 void
 ACLStringData::parse()
 {
-    char *t;
-    while ((t = strtokFile()))
+    while (const char *t = ConfigParser::strtokFile())
         stringValues.insert(SBuf(t));
 }
 
index 3a9cabb0df109ef96e9a54dcb6dad358ef623689..484b61aee16c63a0b52f04f4103e071f2ec5ab71 100644 (file)
@@ -12,6 +12,7 @@
 #include "acl/Checklist.h"
 #include "acl/TimeData.h"
 #include "cache_cf.h"
+#include "ConfigParser.h"
 #include "Debug.h"
 #include "wordlist.h"
 
@@ -108,9 +109,7 @@ ACLTimeData::parse()
 
     int h1, m1, h2, m2;
 
-    char *t = NULL;
-
-    while ((t = strtokFile())) {
+    while (char *t = ConfigParser::strtokFile()) {
         if (*t < '0' || *t > '9') {
             /* assume its day-of-week spec */
 
index 9fda772104d9edc388a062edee2a91064ac48b6f..b09fc7783e745a5457596da77a9a7ceb7cf0a42e 100644 (file)
@@ -4040,12 +4040,6 @@ requirePathnameExists(const char *name, const char *path)
     }
 }
 
-char *
-strtokFile(void)
-{
-    return ConfigParser::strtokFile();
-}
-
 #include "AccessLogEntry.h"
 
 /**
index 4a17e8fa20e3cd7bcbd7f671fbb29774555a8aa8..32de019fc03360a7d73014c8b2135bd00cd821ab 100644 (file)
@@ -24,7 +24,6 @@ void parse_eol(char *volatile *var);
 void parse_wordlist(wordlist ** list);
 void requirePathnameExists(const char *name, const char *path);
 void parse_time_t(time_t * var);
-char *strtokFile(void);
 
 #endif /* SQUID_CACHE_CF_H_ */
 
index 178bbc0117e6db128c260398686c1151e2fcafa0..6c51582b310bcf6e1789eeb827e831ad16f1f755 100644 (file)
@@ -632,8 +632,6 @@ free_external_acl_data(void *data)
 void
 ACLExternal::parse()
 {
-    char *token;
-
     if (data)
         self_destruct();
 
@@ -641,7 +639,7 @@ ACLExternal::parse()
 
     data = cbdataAlloc(external_acl_data);
 
-    token = strtokFile();
+    char *token = ConfigParser::strtokFile();
 
     if (!token)
         self_destruct();
@@ -655,7 +653,7 @@ ACLExternal::parse()
     // this is the name of the 'acl' directive being tested
     data->name = xstrdup(AclMatchedName);
 
-    while ((token = strtokFile())) {
+    while ((token = ConfigParser::strtokFile())) {
         wordlistAdd(&data->arguments, token);
     }
 }
index 415f8be820a7db87a65fe123b3034ea5390283ba..128c221d77e936dc3eb18b3029cdf0c33ee25ce2 100644 (file)
@@ -17,6 +17,7 @@
 #define STUB_API "cache_cf.cc"
 #include "tests/STUB.h"
 
+#include "cache_cf.h"
 void self_destruct(void) STUB
 void parse_int(int *var) STUB
 void parse_onoff(int *var) STUB
@@ -24,7 +25,6 @@ void parse_eol(char *volatile *var) STUB
 void parse_wordlist(wordlist ** list) STUB
 void requirePathnameExists(const char *name, const char *path) STUB_NOP
 void parse_time_t(time_t * var) STUB
-char * strtokFile(void) STUB_RETVAL(NULL)
 void ConfigParser::ParseUShort(unsigned short *var) STUB
 void dump_acl_access(StoreEntry * entry, const char *name, acl_access * head) STUB
 void dump_acl_list(StoreEntry*, ACLList*) STUB