From: Francesco Chemolli Date: Sat, 12 Apr 2014 09:11:20 +0000 (+0200) Subject: More conversions; now builds X-Git-Tag: SQUID_3_5_0_1~295^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dfad5100f30862632628277b0860e8c7f57f33b3;p=thirdparty%2Fsquid.git More conversions; now builds --- diff --git a/src/ExternalACL.h b/src/ExternalACL.h index 7d5e3c8a8a..a8087e7dc0 100644 --- a/src/ExternalACL.h +++ b/src/ExternalACL.h @@ -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; diff --git a/src/acl/Ip.cc b/src/acl/Ip.cc index 7a15356312..e0354b7e75 100644 --- a/src/acl/Ip.cc +++ b/src/acl/Ip.cc @@ -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(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(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, diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 9774fb6c9c..4fa96cf483 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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) diff --git a/src/external_acl.cc b/src/external_acl.cc index 02ccc26320..97ce564af3 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -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; } /****************************************************************** diff --git a/src/ident/AclIdent.cc b/src/ident/AclIdent.cc index 7ab36c5821..7c73dfff0c 100644 --- a/src/ident/AclIdent.cc +++ b/src/ident/AclIdent.cc @@ -103,7 +103,7 @@ ACLIdent::match(ACLChecklist *cl) return -1; } -wordlist * +SBufList ACLIdent::dump() const { return data->dump(); diff --git a/src/ident/AclIdent.h b/src/ident/AclIdent.h index d6e2d1ae6f..fc161bfdf9 100644 --- a/src/ident/AclIdent.h +++ b/src/ident/AclIdent.h @@ -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;