]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Interim. Refactor ACL::dump to SBufList instead of wordlist*
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 11 Apr 2014 16:00:36 +0000 (18:00 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 11 Apr 2014 16:00:36 +0000 (18:00 +0200)
37 files changed:
src/acl/Acl.h
src/acl/AllOf.cc
src/acl/AllOf.h
src/acl/Asn.cc
src/acl/Asn.h
src/acl/BoolOps.cc
src/acl/BoolOps.h
src/acl/Data.h
src/acl/DomainData.cc
src/acl/DomainData.h
src/acl/ExtUser.cc
src/acl/ExtUser.h
src/acl/HierCodeData.cc
src/acl/HierCodeData.h
src/acl/HttpHeaderData.cc
src/acl/HttpHeaderData.h
src/acl/HttpStatus.cc
src/acl/HttpStatus.h
src/acl/InnerNode.cc
src/acl/InnerNode.h
src/acl/IntRange.cc
src/acl/IntRange.h
src/acl/Ip.cc
src/acl/Ip.h
src/acl/RegexData.cc
src/acl/RegexData.h
src/acl/Strategised.h
src/acl/StringData.cc
src/acl/StringData.h
src/acl/TimeData.cc
src/acl/TimeData.h
src/acl/Tree.cc
src/acl/Tree.h
src/acl/UserData.cc
src/acl/UserData.h
src/auth/AclProxyAuth.cc
src/auth/AclProxyAuth.h

index cbefd6423ed2e1a14243623952dc86de47b5b8bd..95f52656edc93c27b0a7a3785c61b8253c86921c 100644 (file)
@@ -38,6 +38,7 @@
 #include "defines.h"
 #include "dlink.h"
 #include "MemPool.h"
+#include "SBufList.h"
 
 #include <ostream>
 #include <string>
@@ -121,7 +122,7 @@ public:
     virtual void parse() = 0;
     virtual char const *typeString() const = 0;
     virtual bool isProxyAuth() const;
-    virtual wordlist *dump() const = 0;
+    virtual SBufList dump() const = 0;
     virtual bool empty() const = 0;
     virtual bool valid() const;
 
index 876535602de2a876bbed26f586b645ec916cf2fc..3dccf6eb7630ac0291b8f34620198dc7a1e0c5ef 100644 (file)
@@ -17,10 +17,10 @@ Acl::AllOf::clone() const
     return new AllOf;
 }
 
-wordlist*
+SBufList
 Acl::AllOf::dump() const
 {
-    return empty() ? NULL : nodes.front()->dump();
+    return empty() ? SBufList() : nodes.front()->dump();
 }
 
 int
index 1358303aa5ea6b12757082d7c8ef9c8dd45504ff..75c6c200bf0ff477239664837509995870826d32 100644 (file)
@@ -18,7 +18,7 @@ public:
     virtual char const *typeString() const;
     virtual ACL *clone() const;
     virtual void parse();
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
 
 private:
     /* Acl::InnerNode API */
index bea2a9ab8cec7bf896ceb73d520dc423466e0dfa..c4276801a2df03fa2e12ac37bc48190f4f090cd0 100644 (file)
@@ -551,20 +551,21 @@ ACLASN::match(Ip::Address toMatch)
     return asnMatchIp(data, toMatch);
 }
 
-wordlist *
+SBufList
 ACLASN::dump()
 {
-    wordlist *W = NULL;
-    char buf[32];
+    SBufList sl;
+
     CbDataList<int> *ldata = data;
 
     while (ldata != NULL) {
-        snprintf(buf, sizeof(buf), "%d", ldata->element);
-        wordlistAdd(&W, buf);
+        SBuf s;
+        s.Printf("%d", ldata->element);
+        sl.push_back(s);
         ldata = ldata->next;
     }
 
-    return W;
+    return sl;
 }
 
 bool
index d6932d78470ec5a47552591f7f7b437d9e12a609..48cf8416d408a69dc8cec9258a99fcbe61b54f68 100644 (file)
@@ -37,6 +37,7 @@
 #include "acl/Strategised.h"
 #include "CbDataList.h"
 #include "ip/Address.h"
+#include "SBufList.h"
 
 int asnMatchIp(CbDataList<int> *, Ip::Address &);
 
@@ -56,7 +57,7 @@ public:
     virtual ~ACLASN();
 
     virtual bool match(Ip::Address);
-    virtual wordlist *dump();
+    virtual SBufList dump();
     virtual void parse();
     bool empty() const;
     virtual ACLData<Ip::Address> *clone() const;
index 3b8c89f771338c948700b5594c62e641f2c173ca..5f70d98e399cf8368762b1410d5bb7be2d171755 100644 (file)
@@ -52,11 +52,11 @@ Acl::NotNode::clone() const
     return NULL;
 }
 
-wordlist*
+SBufList
 Acl::NotNode::dump() const
 {
-    wordlist *text = NULL;
-    wordlistAdd(&text, name);
+    SBufList text;
+    text.push_back(SBuf(name));
     return text;
 }
 
index d06c8a94fc1916d5165e7096709542ee527b806d..82a6b1860aa798a898626c4ec2f1aca8ca32762b 100644 (file)
@@ -23,7 +23,7 @@ private:
     virtual char const *typeString() const;
     virtual ACL *clone() const;
     virtual void parse();
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
 
     /* Acl::InnerNode API */
     virtual int doMatch(ACLChecklist *checklist, Nodes::const_iterator start) const;
index 1ea9e061e37aeefc994c01117e4e91f48ab7c43d..a099323793cbf4de09b1761b7d9f746026e3f2b6 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef SQUID_ACLDATA_H
 #define SQUID_ACLDATA_H
 
-class wordlist;
+#include "SBufList.h"
 
 /// \ingroup ACLAPI
 template <class M>
@@ -44,7 +44,7 @@ public:
     virtual ~ACLData() {}
 
     virtual bool match(M) =0;
-    virtual wordlist *dump() =0;
+    virtual SBufList dump() =0;
     virtual void parse() =0;
     virtual ACLData *clone() const =0;
     virtual void prepareForUse() {}
index b2f6e8be5a870a0dd8e117ec0174306b450f5290..213cf16a3ae64efe066a04cbea6df3a5b1c54b1e 100644 (file)
@@ -140,20 +140,20 @@ ACLDomainData::match(char const *host)
 static void
 aclDumpDomainListWalkee(char * const & node_data, void *outlist)
 {
-    /* outlist is really a wordlist ** */
-    wordlistAdd((wordlist **)outlist, (char const *)node_data);
+    /* outlist is really a SBufList ** */
+    static_cast<SBufList *>(outlist)->push_back(SBuf(node_data));
 }
 
-wordlist *
+SBufList
 ACLDomainData::dump()
 {
-    wordlist *wl = NULL;
+    SBufList sl;
     /* damn this is VERY inefficient for long ACL lists... filling
      * a wordlist this way costs Sum(1,N) iterations. For instance
      * a 1000-elements list will be filled in 499500 iterations.
      */
-    domains->walk(aclDumpDomainListWalkee, &wl);
-    return wl;
+    domains->walk(aclDumpDomainListWalkee, &sl);
+    return sl;
 }
 
 void
index 7839a8f75d9a6350685d54da8afa93bdfe896f1f..a8981e14cf30ef55b0d134a7a065b4f9a367620d 100644 (file)
@@ -46,7 +46,7 @@ public:
 
     virtual ~ACLDomainData();
     bool match(char const *);
-    wordlist *dump();
+    SBufList dump();
     void parse();
     bool empty() const;
     virtual ACLData<char const *> *clone() const;
index fb3e1578144d25c063e0cb2e3ed44a3eaa9d6f0e..073f71baf4196157af09bdc5954fcb92cc43675d 100644 (file)
@@ -85,7 +85,7 @@ ACLExtUser::match(ACLChecklist *cl)
     }
 }
 
-wordlist *
+SBufList
 ACLExtUser::dump() const
 {
     return data->dump();
index fda9d9324217f9cc77bf9d8bc8dfd48784bf3734..1d586c7ea4e501ba9bbe7fef4531e104e40fdb0d 100644 (file)
@@ -55,7 +55,7 @@ public:
     virtual void parse();
 
     virtual int match(ACLChecklist *checklist);
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
     virtual bool empty () const;
     virtual ACL *clone()const;
 
index a5c224fc6996d91c79d0bad3c8d215eda1461443..14f79579247b964e5b24cb6f6af667f24de18b07 100644 (file)
@@ -3,7 +3,6 @@
 #include "acl/HierCodeData.h"
 #include "cache_cf.h"
 #include "hier_code.h"
-#include "wordlist.h"
 
 ACLHierCodeData::ACLHierCodeData()
 {
@@ -25,17 +24,17 @@ ACLHierCodeData::match(hier_code toFind)
     return values[toFind];
 }
 
-wordlist *
+SBufList
 ACLHierCodeData::dump()
 {
-    wordlist *W = NULL;
+    SBufList sl;
 
     for (hier_code iter=HIER_NONE; iter<HIER_MAX; ++iter) {
         if (!values[iter]) continue;
-        wordlistAdd(&W, hier_code_str[iter]);
+        sl.push_back(SBuf(hier_code_str[iter]));
     }
 
-    return W;
+    return sl;
 }
 
 void
index 4331a5dabe8fe4ee8b00cd08a9089143e3d58fa3..d29ec3e84142fcc3550d28c913f4c391ac3808d1 100644 (file)
@@ -18,7 +18,7 @@ public:
     ACLHierCodeData &operator= (ACLHierCodeData const &);
     virtual ~ACLHierCodeData();
     bool match(hier_code);
-    wordlist *dump();
+    SBufList dump();
     void parse();
     bool empty() const;
     virtual ACLData<hier_code> *clone() const;
index 904c80bed7df990a5cf0d63d6804f10dcc6116ae..ecbb5fce17d15ead5b7c2d727afed019a2f12d40 100644 (file)
@@ -80,15 +80,13 @@ ACLHTTPHeaderData::match(HttpHeader* hdr)
     return regex_rule->match(cvalue.c_str());
 }
 
-wordlist *
+SBufList
 ACLHTTPHeaderData::dump()
 {
-    wordlist *W = NULL;
-    wordlistAdd(&W, hdrName.termedBuf());
-    wordlist * regex_dump = regex_rule->dump();
-    wordlistAddWl(&W, regex_dump);
-    wordlistDestroy(&regex_dump);
-    return W;
+    SBufList sl;
+    sl.push_back(SBuf(hdrName));
+    sl.splice(sl.end(),regex_rule->dump());
+    return sl;
 }
 
 void
index d2a5bd0103d4655965346e857d37373cc5fa2b27..ea05d0e7bc7ac482785ce8b5542dd89d376fd180 100644 (file)
@@ -54,7 +54,7 @@ public:
     ACLHTTPHeaderData();
     virtual ~ACLHTTPHeaderData();
     virtual bool match(HttpHeader* hdr);
-    virtual wordlist *dump();
+    virtual SBufList dump();
     virtual void parse();
     virtual bool empty() const;
     virtual ACLData<HttpHeader*> *clone() const;
index f5cc88fd57e89dd2ff822aee13839990c98bfd3d..541b3cce8732b4c90768cbe70ba5691c1c07ee6a 100644 (file)
@@ -50,14 +50,17 @@ acl_httpstatus_data::acl_httpstatus_data(int x) : status1(x), status2(x) { ; }
 
 acl_httpstatus_data::acl_httpstatus_data(int x, int y) : status1(x), status2(y) { ; }
 
-void acl_httpstatus_data::toStr(char* buf, int len) const
+SBuf
+acl_httpstatus_data::repr() const
 {
+    SBuf rv;
     if (status2 == INT_MAX)
-        snprintf(buf, len, "%d-", status1);
+        rv.Printf("%d-", status1);
     else if (status1 == status2)
-        snprintf(buf, len, "%d", status1);
+        rv.Printf("%d", status1);
     else
-        snprintf(buf, len, "%d-%d", status1, status2);
+        rv.Printf("%d-%d", status1, status2);
+    return rv;
 }
 
 int acl_httpstatus_data::compare(acl_httpstatus_data* const& a, acl_httpstatus_data* const& b)
@@ -69,13 +72,12 @@ int acl_httpstatus_data::compare(acl_httpstatus_data* const& a, acl_httpstatus_d
         ret = aclHTTPStatusCompare(a, b);
 
     if (ret == 0) {
-        char bufa[8];
-        char bufb[8];
-        a->toStr(bufa, sizeof(bufa));
-        b->toStr(bufb, sizeof(bufb));
-        debugs(28, DBG_CRITICAL, "WARNING: '" << bufa << "' is a subrange of '" << bufb << "'");
-        debugs(28, DBG_CRITICAL, "WARNING: because of this '" << bufa << "' is ignored to keep splay tree searching predictable");
-        debugs(28, DBG_CRITICAL, "WARNING: You should probably remove '" << bufb << "' from the ACL named '" << AclMatchedName << "'");
+        SBuf sa, sb;
+        sa=a->repr();
+        sb=b->repr();
+        debugs(28, DBG_CRITICAL, "WARNING: '" << sa << "' is a subrange of '" << sb << "'");
+        debugs(28, DBG_CRITICAL, "WARNING: because of this '" << sa << "' is ignored to keep splay tree searching predictable");
+        debugs(28, DBG_CRITICAL, "WARNING: You should probably remove '" << sb << "' from the ACL named '" << AclMatchedName << "'");
     }
 
     return ret;
@@ -184,15 +186,14 @@ aclHTTPStatusCompare(acl_httpstatus_data * const &a, acl_httpstatus_data * const
 static void
 aclDumpHTTPStatusListWalkee(acl_httpstatus_data * const &node, void *state)
 {
-    static char buf[8];
-    node->toStr(buf, sizeof(buf));
-    wordlistAdd((wordlist **)state, buf);
+    // state is a SBufList*
+    static_cast<SBufList *>(state)->push_back(node->repr());
 }
 
-wordlist *
+SBufList
 ACLHTTPStatus::dump() const
 {
-    wordlist *w = NULL;
+    SBufList w;
     data->walk(aclDumpHTTPStatusListWalkee, &w);
     return w;
 }
index 5f03112181d12e84a0d0a07002b58e29d58e7b4b..c28f2d12b14e20b787454cc072e0c818f7add917 100644 (file)
@@ -42,7 +42,7 @@ struct acl_httpstatus_data {
     int status1, status2;
     acl_httpstatus_data(int);
     acl_httpstatus_data(int, int);
-    void toStr(char* buf, int len) const;
+    SBuf repr() const; // was toStr
 
     static int compare(acl_httpstatus_data* const& a, acl_httpstatus_data* const& b);
 };
@@ -63,7 +63,7 @@ public:
     virtual char const *typeString() const;
     virtual void parse();
     virtual int match(ACLChecklist *checklist);
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
     virtual bool empty () const;
     virtual bool requiresReply() const { return true; }
 
index b8bc27c7c414f2890389e66388eee27f4ebaeefd..4e0275e606f66c8d117c398c70a481f7c8a3ecec 100644 (file)
@@ -64,13 +64,13 @@ Acl::InnerNode::lineParse()
     return;
 }
 
-wordlist*
+SBufList
 Acl::InnerNode::dump() const
 {
-    wordlist *values = NULL;
+    SBufList rv;
     for (Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
-        wordlistAdd(&values, (*i)->name);
-    return values;
+        rv.push_back(SBuf((*i)->name));
+    return rv;
 }
 
 int
index 81865dbbe42a8427232f87d2f0c291e6f326901c..2a38a0a27468b8ef35ff8530dd944f8ec8dfc2fe 100644 (file)
@@ -24,7 +24,7 @@ public:
     /* ACL API */
     virtual void prepareForUse();
     virtual bool empty() const;
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
 
     /// parses one "acl name type acl1 acl2..." line, appending to nodes
     void lineParse();
index 1e4c1a453ea1ad195f12fb5250af96a7c4aa5343..ea68fc464b1f1c15b694dc32429c8ebb7d39d347 100644 (file)
@@ -112,24 +112,24 @@ ACLIntRange::clone() const
 ACLIntRange::~ACLIntRange ()
 {}
 
-wordlist *
+SBufList
 ACLIntRange::dump ()
 {
-    wordlist *W = NULL;
-    char buf[32];
+    SBufList sl;
     CbDataListIterator<RangeType> iter(ranges);
 
     while (!iter.end()) {
+        SBuf sb;
         const RangeType & element = iter.next();
 
         if (element.size() == 1)
-            snprintf(buf, sizeof(buf), "%d", element.start);
+            sb.Printf("%d", element.start);
         else
-            snprintf(buf, sizeof(buf), "%d-%d", element.start, element.end-1);
+            sb.Printf("%d-%d", element.start, element.end-1);
 
-        wordlistAdd(&W, buf);
+        sl.push_back(sb);
     }
 
-    return W;
+    return sl;
 }
 
index 946290c60f094eb04ae4edf644cc93e806a0eded..1faf726ad62c7b03106f3035068f62be4b6a031a 100644 (file)
@@ -36,6 +36,7 @@
 #include "acl/Data.h"
 #include "CbDataList.h"
 #include "Range.h"
+#include "SBufList.h"
 
 /// \ingroup ACLAPI
 class ACLIntRange : public ACLData<int>
@@ -46,7 +47,7 @@ public:
 
     virtual ~ACLIntRange();
     virtual bool match(int);
-    virtual wordlist *dump();
+    virtual SBufList dump();
     virtual void parse();
     virtual bool empty() const;
     virtual ACLData<int> *clone() const;
index 81ff1becdb2c2efefdace765f2b1b908310267d1..64960b8bd900f33578ba62703fc18dc662458047 100644 (file)
@@ -528,12 +528,12 @@ ACLIP::~ACLIP()
         data->destroy(IPSplay::DefaultFree);
 }
 
-wordlist *
+SBufList
 ACLIP::dump() const
 {
-    wordlist *w = NULL;
-    data->walk (DumpIpListWalkee, &w);
-    return w;
+    SBufList sl;
+    data->walk (DumpIpListWalkee, &sl);
+    return sl;
 }
 
 bool
index 662d41424b048a038b3d1dc76c482562d4a8c9b3..616a622002571f3e22ae7760a9d9112e2ad01a0a 100644 (file)
@@ -50,6 +50,7 @@ public:
 
     acl_ip_data (Ip::Address const &, Ip::Address const &, Ip::Address const &, acl_ip_data *);
     void toStr(char *buf, int len) const;
+    SBuf toSBuf() const;
 
     Ip::Address addr1;
 
@@ -85,7 +86,7 @@ public:
     virtual void parse();
     //    virtual bool isProxyAuth() const {return true;}
     virtual int match(ACLChecklist *checklist) = 0;
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
     virtual bool empty () const;
 
 protected:
index 63ebe2db14dc258e928b29273c89fe94ed49a215..96b31a01620e848269ac2f3cd603c84a5c3713e8 100644 (file)
@@ -101,28 +101,28 @@ ACLRegexData::match(char const *word)
     return 0;
 }
 
-wordlist *
+SBufList
 ACLRegexData::dump()
 {
-    wordlist *W = NULL;
+    SBufList sl;
     RegexList *temp = data;
     int flags = REG_EXTENDED | REG_NOSUB;
 
     while (temp != NULL) {
         if (temp->flags != flags) {
             if ((temp->flags&REG_ICASE) != 0) {
-                wordlistAdd(&W, "-i");
+                sl.push_back(SBuf("-i"));
             } else {
-                wordlistAdd(&W, "+i");
+                sl.push_back(SBuf("+i"));
             }
             flags = temp->flags;
         }
 
-        wordlistAdd(&W, temp->pattern);
+        sl.push_back(SBuf(temp->pattern));
         temp = temp->next;
     }
 
-    return W;
+    return sl;
 }
 
 static const char *
index 87ca21f52c2aece4b1fc561e93dc5079f6a15ea2..5cc90da7c483d4571bd6856996bad0f9cdd1698d 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "acl/Data.h"
 #include "MemPool.h"
+#include "SBufList.h"
 
 class RegexList;
 
@@ -45,7 +46,7 @@ public:
 
     virtual ~ACLRegexData();
     virtual bool match(char const *user);
-    virtual wordlist *dump();
+    virtual SBufList dump();
     virtual void parse();
     virtual bool empty() const;
     virtual ACLData<char const *> *clone() const;
index 6a2e276c0929697d4c367d813b9da097168a2648..4beeea3c96f8b1bf19c3c612a9d5812e35745551 100644 (file)
@@ -63,7 +63,7 @@ public:
     virtual void parse();
     virtual int match(ACLChecklist *checklist);
     virtual int match (M const &);
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
     virtual bool empty () const;
     virtual bool valid () const;
     virtual ACL *clone()const;
@@ -161,7 +161,7 @@ ACLStrategised<MatchType>::match(MatchType const &toFind)
 }
 
 template <class MatchType>
-wordlist *
+SBufList
 ACLStrategised<MatchType>::dump() const
 {
     return data->dump();
index c67fd456d29ae5e47a2fe8b27d815002092b361a..60dbb544d2efe5c586c3790d0e30396025c0764a 100644 (file)
@@ -90,20 +90,20 @@ ACLStringData::match(char const *toFind)
 static void
 aclDumpStringWalkee(char * const & node_data, void *outlist)
 {
-    /* outlist is really a wordlist ** */
-    wordlistAdd((wordlist **)outlist, node_data);
+    /* outlist is really a SBufList* */
+    static_cast<SBufList*>(outlist)->push_back(SBuf(node_data));
 }
 
-wordlist *
+SBufList
 ACLStringData::dump()
 {
-    wordlist *wl = NULL;
+    SBufList sl;
     /* damn this is VERY inefficient for long ACL lists... filling
      * a wordlist this way costs Sum(1,N) iterations. For instance
      * a 1000-elements list will be filled in 499500 iterations.
      */
-    values->walk(aclDumpStringWalkee, &wl);
-    return wl;
+    values->walk(aclDumpStringWalkee, &sl);
+    return sl;
 }
 
 void
index 6da50f37ab5979fb6a4079555002c8b872d38773..a637a6dc67ed7f5765f00d43baefcdb9ce143450 100644 (file)
@@ -48,7 +48,7 @@ public:
     ACLStringData &operator= (ACLStringData const &);
     virtual ~ACLStringData();
     bool match(char const *);
-    wordlist *dump();
+    SBufList dump();
     virtual void parse();
     bool empty() const;
     virtual ACLData<char const *> *clone() const;
index 6f8a3da20a7e1d8bb1eee6cf48919344ac9b5008..98fb423d27070a2cda102bd35359b1aa9fa0ade1 100644 (file)
@@ -97,15 +97,15 @@ ACLTimeData::match(time_t when)
     return 0;
 }
 
-wordlist *
+SBufList
 ACLTimeData::dump()
 {
-    wordlist *W = NULL;
-    char buf[128];
+    SBufList sl;
     ACLTimeData *t = this;
 
     while (t != NULL) {
-        snprintf(buf, sizeof(buf), "%c%c%c%c%c%c%c %02d:%02d-%02d:%02d",
+        SBuf s;
+        s.Printf("%c%c%c%c%c%c%c %02d:%02d-%02d:%02d",
                  t->weekbits & ACL_SUNDAY ? 'S' : '-',
                  t->weekbits & ACL_MONDAY ? 'M' : '-',
                  t->weekbits & ACL_TUESDAY ? 'T' : '-',
@@ -114,11 +114,11 @@ ACLTimeData::dump()
                  t->weekbits & ACL_FRIDAY ? 'F' : '-',
                  t->weekbits & ACL_SATURDAY ? 'A' : '-',
                  t->start / 60, t->start % 60, t->stop / 60, t->stop % 60);
-        wordlistAdd(&W, buf);
+        sl.push_back(s);
         t = t->next;
     }
 
-    return W;
+    return sl;
 }
 
 void
index dca42ac47e015ca0a92aa13e16b8d8ed97feeda6..74b5f03f53f2eb03bf8860834cd8e5901825eaba 100644 (file)
@@ -48,7 +48,7 @@ public:
     ACLTimeData&operator=(ACLTimeData const &);
     virtual ~ACLTimeData();
     bool match(time_t);
-    wordlist *dump();
+    SBufList dump();
     void parse();
     bool empty() const;
     virtual ACLData<time_t> *clone() const;
index 4b79abaa94d86951ee4d2259d4314dbbd4973f2c..06b745cd857800dca3746a65653d94043c0997bb 100644 (file)
@@ -48,28 +48,25 @@ Acl::Tree::add(ACL *rule)
     InnerNode::add(rule);
 }
 
-wordlist*
+SBufList
 Acl::Tree::treeDump(const char *prefix, const ActionToString &convert) const
 {
-    wordlist *text = NULL;
+    SBufList text;
     Actions::const_iterator action = actions.begin();
     typedef Nodes::const_iterator NCI;
     for (NCI node = nodes.begin(); node != nodes.end(); ++node) {
 
-        wordlistAdd(&text, prefix);
+        text.push_back(SBuf(prefix));
 
         if (action != actions.end()) {
             const char *act = convert ? convert[action->kind] :
                               (*action == ACCESS_ALLOWED ? "allow" : "deny");
-            wordlistAdd(&text, act ? act : "???");
+            text.push_back(act?SBuf(act):SBuf("???"));
             ++action;
         }
 
-        wordlist *rule = (*node)->dump();
-        wordlistAddWl(&text, rule);
-        wordlistDestroy(&rule);
-
-        wordlistAdd(&text, "\n");
+        text.splice(text.end(),(*node)->dump());
+        text.push_back(SBuf("\n"));
     }
     return text;
 }
index a372839192034912f9ee62880cea65dc462d7356..742f4474d9f0f1753497c31b255c924a658ee4f1 100644 (file)
@@ -2,6 +2,7 @@
 #define SQUID_ACL_TREE_H
 
 #include "acl/BoolOps.h"
+#include "SBufList.h"
 
 namespace Acl
 {
@@ -14,7 +15,7 @@ public:
     /// dumps <name, action, rule, new line> tuples
     /// action.kind is mapped to a string using the supplied conversion table
     typedef const char **ActionToString;
-    wordlist* treeDump(const char *name, const ActionToString &convert) const;
+    SBufList treeDump(const char *name, const ActionToString &convert) const;
 
     /// Returns the corresponding action after a successful tree match.
     allow_t winningAction() const;
index 499400d0e3d21a5d0967e315aac65040d47122e3..08af4ee6c2c3730d964e2b1ebffc4f964efd4570 100644 (file)
@@ -97,28 +97,28 @@ ACLUserData::match(char const *user)
 static void
 aclDumpUserListWalkee(char * const & node_data, void *outlist)
 {
-    /* outlist is really a wordlist ** */
-    wordlistAdd((wordlist **)outlist, (char const *)node_data);
+    /* outlist is really a SBufList* */
+    static_cast<SBufList *>(outlist)->push_back(SBuf(node_data));
 }
 
-wordlist *
+SBufList
 ACLUserData::dump()
 {
-    wordlist *wl = NULL;
+    SBufList sl;
 
     if (flags.case_insensitive)
-        wordlistAdd(&wl, "-i");
+        sl.push_back(SBuf("-i"));
 
     /* damn this is VERY inefficient for long ACL lists... filling
      * a wordlist this way costs Sum(1,N) iterations. For instance
      * a 1000-elements list will be filled in 499500 iterations.
      */
     if (flags.required)
-        wordlistAdd(&wl, "REQUIRED");
+        sl.push_back(SBuf("REQUIRED"));
     else if (names)
-        names->walk(aclDumpUserListWalkee, &wl);
+        names->walk(aclDumpUserListWalkee, &sl);
 
-    return wl;
+    return sl;
 }
 
 void
index 0abec7663365e8fad78f09b59d98475b71cd7442..4c32c228e2c2e20b53af230159979370c3fb507f 100644 (file)
@@ -45,7 +45,7 @@ public:
 
     virtual ~ACLUserData();
     bool match(char const *user);
-    wordlist *dump();
+    SBufList dump();
     void parse();
     bool empty() const;
     virtual ACLData<char const *> *clone() const;
index 0835f120708271ca68718ccfd9d90cd211c99964..840fc53892d2e101e469eff000a60b515d4e5528 100644 (file)
@@ -99,7 +99,7 @@ ACLProxyAuth::match(ACLChecklist *checklist)
     }
 }
 
-wordlist *
+SBufList
 ACLProxyAuth::dump() const
 {
     return data->dump();
index 636c8576660d7f8498d917a5950935126f8f568a..1b00f8224d4c705d913bcebf19d62d78b1820f23 100644 (file)
@@ -65,7 +65,7 @@ public:
     virtual bool isProxyAuth() const {return true;}
 
     virtual int match(ACLChecklist *checklist);
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
     virtual bool valid() const;
     virtual bool empty() const;
     virtual bool requiresRequest() const {return true;}