]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
More conversions; now builds
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 12 Apr 2014 09:11:20 +0000 (11:11 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 12 Apr 2014 09:11:20 +0000 (11:11 +0200)
src/ExternalACL.h
src/acl/Ip.cc
src/cache_cf.cc
src/external_acl.cc
src/ident/AclIdent.cc
src/ident/AclIdent.h

index 7d5e3c8a8a9b61a49ec233ad5e7512d2ebb9b4e8..a8087e7dc0c1b26f78678528ea6bffd83f9cc44d 100644 (file)
@@ -80,7 +80,7 @@ public:
     /* when requiresRequest is made dynamic, review this too */
     //    virtual bool requiresReply() const {return true;}
     virtual bool isProxyAuth() const;
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
     virtual bool valid () const;
     virtual bool empty () const;
 
index 7a153563121dbc4d1f0353204719d3fff114306d..e0354b7e75af83b62c69ee054db0a39e48a6324f 100644 (file)
@@ -62,20 +62,7 @@ ACLIP::operator delete (void *address)
 void
 ACLIP::DumpIpListWalkee(acl_ip_data * const & ip, void *state)
 {
-    char tmpbuf[ ((MAX_IPSTRLEN*2)+6) ]; // space for 2 IPs and a CIDR mask(3) and seperators(3).
-    MemBuf mb;
-    wordlist **W = static_cast<wordlist **>(state);
-    tmpbuf[0] = '\0';
-
-    mb.init();
-    assert(mb.max_capacity > 0 && 1==1 );
-
-    ip->toStr(tmpbuf, sizeof(tmpbuf) );
-    assert(mb.max_capacity > 0 && 2==2 );
-    mb.append(tmpbuf, strlen(tmpbuf) );
-    assert(mb.max_capacity > 0 && 3==3);
-    wordlistAdd(W, mb.buf);
-    mb.clean();
+    static_cast<SBufList *>(state)->push_back(ip->toSBuf());
 }
 
 /**
@@ -115,6 +102,16 @@ acl_ip_data::toStr(char *buf, int len) const
         b3[0] = '\0';
 }
 
+SBuf
+acl_ip_data::toSBuf() const
+{
+    const int bufsz = MAX_IPSTRLEN*2+6;
+    static char tmpbuf[ bufsz ];
+    toStr(tmpbuf,bufsz);
+    return SBuf(tmpbuf);
+}
+
+
 /*
  * aclIpAddrNetworkCompare - The guts of the comparison for IP ACLs
  * matching checks.  The first argument (p) is a "host" address,
index 9774fb6c9c2e0d11156167732713e1eba87a2b02..4fa96cf48324cbe98bb11d67c13430eb66b4e53c 100644 (file)
@@ -72,6 +72,7 @@
 #include "PeerDigest.h"
 #include "RefreshPattern.h"
 #include "rfc1738.h"
+#include "SBufList.h"
 #include "SquidConfig.h"
 #include "SquidString.h"
 #include "ssl/ProxyCerts.h"
@@ -1287,15 +1288,13 @@ parseBytesUnits(const char *unit)
     return 0;
 }
 
-/*****************************************************************************
- * Max
- *****************************************************************************/
-
 static void
-dump_wordlist(StoreEntry * entry, wordlist *words)
+dump_SBufList(StoreEntry * entry, const SBufList &words)
 {
-    for (wordlist *word = words; word; word = word->next)
-        storeAppendPrintf(entry, "%s ", word->key);
+    for (SBufList::const_iterator i = words.begin(); i != words.end(); ++i) {
+        entry->append(i->rawContent(), i->length());
+        entry->append(" ",1);
+    }
 }
 
 static void
@@ -1308,11 +1307,7 @@ dump_acl(StoreEntry * entry, const char *name, ACL * ae)
                           ae->name,
                           ae->typeString(),
                           ae->flags.flagsStr());
-        wordlist *w = ae->dump();
-        dump_wordlist(entry, w);
-
-        storeAppendPrintf(entry, "\n");
-        wordlistDestroy(&w);
+        dump_SBufList(entry, ae->dump());
         ae = ae->next;
     }
 }
@@ -1332,19 +1327,14 @@ free_acl(ACL ** ae)
 void
 dump_acl_list(StoreEntry * entry, ACLList * head)
 {
-    wordlist *values = head->dump();
-    dump_wordlist(entry, values);
-    wordlistDestroy(&values);
+    dump_SBufList(entry, head->dump());
 }
 
 void
 dump_acl_access(StoreEntry * entry, const char *name, acl_access * head)
 {
-    if (head) {
-        wordlist *lines = head->treeDump(name, NULL);
-        dump_wordlist(entry, lines);
-        wordlistDestroy(&lines);
-    }
+    if (head)
+        dump_SBufList(entry, head->dump());
 }
 
 static void
@@ -4880,11 +4870,8 @@ static void parse_ftp_epsv(acl_access **ftp_epsv)
 
 static void dump_ftp_epsv(StoreEntry *entry, const char *name, acl_access *ftp_epsv)
 {
-    if (ftp_epsv) {
-        wordlist *lines = ftp_epsv->treeDump(name, NULL);
-        dump_wordlist(entry, lines);
-        wordlistDestroy(&lines);
-    }
+    if (ftp_epsv)
+        dump_SBufList(entry, ftp_epsv->treeDump(name, NULL));
 }
 
 static void free_ftp_epsv(acl_access **ftp_epsv)
index 02ccc2632005c819cf07e00947f8a57131bb6787..97ce564af33907c7f0d625eb490663fb0cf5f1f7 100644 (file)
@@ -930,23 +930,20 @@ ACLExternal::match(ACLChecklist *checklist)
     }
 }
 
-wordlist *
+SBufList
 ACLExternal::dump() const
 {
     external_acl_data const *acl = data;
-    wordlist *result = NULL;
-    wordlist *arg;
-    MemBuf mb;
-    mb.init();
-    mb.Printf("%s", acl->def->name);
+    SBufList rv;
+    rv.push_back(SBuf(acl->def->name));
 
-    for (arg = acl->arguments; arg; arg = arg->next) {
-        mb.Printf(" %s", arg->key);
+    for (wordlist *arg = acl->arguments; arg; arg = arg->next) {
+        SBuf s;
+        s.Printf(" %s", arg->key);
+        rv.push_back(s);
     }
 
-    wordlistAdd(&result, mb.buf);
-    mb.clean();
-    return result;
+    return rv;
 }
 
 /******************************************************************
index 7ab36c5821c014c81a9485d7ced1b296f602217c..7c73dfff0cb7c58416cbcfe338206dfee2fc024a 100644 (file)
@@ -103,7 +103,7 @@ ACLIdent::match(ACLChecklist *cl)
     return -1;
 }
 
-wordlist *
+SBufList
 ACLIdent::dump() const
 {
     return data->dump();
index d6e2d1ae6f965e35c2aab64d2a8d4ea7af95d017..fc161bfdf90303d0f27e58c99714830d4b38424c 100644 (file)
@@ -70,7 +70,7 @@ public:
     virtual bool isProxyAuth() const {return true;}
 
     virtual int match(ACLChecklist *checklist);
-    virtual wordlist *dump() const;
+    virtual SBufList dump() const;
     virtual bool empty () const;
     virtual ACL *clone()const;