]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Drop obsolete class StringArea
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 26 Nov 2013 09:43:29 +0000 (02:43 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 26 Nov 2013 09:43:29 +0000 (02:43 -0700)
class StringArea was always intended to only be a temporary measure
before SBuf was completed and merged. That has now happened.

src/HttpHdrCc.cc
src/auth/digest/auth_digest.cc
src/base/Makefile.am
src/base/StringArea.h [deleted file]

index a2de7e2618f91e41f51aca069e18466238530026..b550ce720b8684e3efb3228e983cdf5454d6690d 100644 (file)
  */
 
 #include "squid.h"
-#include "base/StringArea.h"
 #include "HttpHdrCc.h"
 #include "HttpHeader.h"
 #include "HttpHeaderFieldStat.h"
 #include "HttpHeaderStat.h"
 #include "HttpHeaderTools.h"
+#include "SBuf.h"
 #include "StatHist.h"
 #include "Store.h"
 #include "StrList.h"
@@ -71,7 +71,7 @@ static HttpHeaderCcFields CcAttrs[CC_ENUM_END] = {
 };
 
 /// Map an header name to its type, to expedite parsing
-typedef std::map<const StringArea,http_hdr_cc_type> CcNameToIdMap_t;
+typedef std::map<const SBuf,http_hdr_cc_type> CcNameToIdMap_t;
 static CcNameToIdMap_t CcNameToIdMap;
 
 /// used to walk a table of http_header_cc_type structs
@@ -90,7 +90,7 @@ httpHdrCcInitModule(void)
     for (int32_t i = 0; i < CC_ENUM_END; ++i) {
         const HttpHeaderCcFields &f=CcAttrs[i];
         assert(i == f.id); /* verify assumption: the id is the key into the array */
-        const StringArea k(f.name,strlen(f.name));
+        const SBuf k(f.name);
         CcNameToIdMap[k]=f.id;
     }
 }
@@ -131,7 +131,7 @@ HttpHdrCc::parse(const String & str)
         }
 
         /* find type */
-        const CcNameToIdMap_t::const_iterator i=CcNameToIdMap.find(StringArea(item,nlen));
+        const CcNameToIdMap_t::const_iterator i=CcNameToIdMap.find(SBuf(item,nlen));
         if (i==CcNameToIdMap.end())
             type=CC_OTHER;
         else
index f8dc8ca9b13c497ac7c0fa1b97fea609fd23099a..09313093eb1028e980f559649c74a0e7b40c1185 100644 (file)
@@ -41,7 +41,6 @@
 #include "auth/digest/UserRequest.h"
 #include "auth/Gadgets.h"
 #include "auth/State.h"
-#include "base/StringArea.h"
 #include "base64.h"
 #include "cache_cf.h"
 #include "event.h"
@@ -50,6 +49,7 @@
 #include "HttpRequest.h"
 #include "mgr/Registration.h"
 #include "rfc2617.h"
+#include "SBuf.h"
 #include "SquidTime.h"
 #include "Store.h"
 #include "StrList.h"
@@ -816,19 +816,19 @@ Auth::Digest::Config::decode(char const *proxy_auth)
             vlen = 0;
         }
 
-        StringArea keyName(item, nlen);
+        SBuf keyName(item, nlen);
         String value;
 
         if (vlen > 0) {
             // see RFC 2617 section 3.2.1 and 3.2.2 for details on the BNF
 
-            if (keyName == StringArea("domain",6) || keyName == StringArea("uri",3)) {
+            if (keyName == SBuf("domain",6) || keyName == SBuf("uri",3)) {
                 // domain is Special. Not a quoted-string, must not be de-quoted. But is wrapped in '"'
                 // BUG 3077: uri= can also be sent to us in a mangled (invalid!) form like domain
                 if (*p == '"' && *(p + vlen -1) == '"') {
                     value.limitInit(p+1, vlen-2);
                 }
-            } else if (keyName == StringArea("qop",3)) {
+            } else if (keyName == SBuf("qop",3)) {
                 // qop is more special.
                 // On request this must not be quoted-string de-quoted. But is several values wrapped in '"'
                 // On response this is a single un-quoted token.
index fa87fc16fb59b09e9a5ed6aad833c2dcf0438fdc..1b84589d87d419fad2124ea79ae1f23f35e0c88b 100644 (file)
@@ -22,6 +22,5 @@ libbase_la_SOURCES = \
        Subscription.h \
        TextException.cc \
        TextException.h \
-       StringArea.h \
        Vector.cc \
        Vector.h
diff --git a/src/base/StringArea.h b/src/base/StringArea.h
deleted file mode 100644 (file)
index e5b14a8..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * StringArea.h
- *
- *
- * SQUID Web Proxy Cache          http://www.squid-cache.org/
- * ----------------------------------------------------------
- *
- *  Squid is the result of efforts by numerous individuals from
- *  the Internet community; see the CONTRIBUTORS file for full
- *  details.   Many organizations have provided support for Squid's
- *  development; see the SPONSORS file for full details.  Squid is
- *  Copyrighted (C) 2001 by the Regents of the University of
- *  California; see the COPYRIGHT file for full details.  Squid
- *  incorporates software developed and/or copyrighted by other
- *  sources; see the CREDITS file for full details.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- */
-
-#ifndef SQUID_STRINGAREA_H
-#define SQUID_STRINGAREA_H
-
-#if HAVE_CSTRING
-#include <cstring>
-#endif
-#include <ostream>
-
-/** A char* plus length combination. Useful for temporary storing
- * and quickly looking up strings.
- *
- * The pointed-to string may not be null-terminated.
- * The pointed-to string is not copied.
- *
- * Not meant for stand-alone storage. Validity of the
- * pointed-to string is responsibility of the caller.
- */
-class StringArea
-{
-public:
-    /// build a StringArea by explicitly assigning pointed-to area and and length
-    StringArea(const char * ptr, size_t len): theStart(ptr), theLen(len) {}
-    bool operator==(const StringArea &s) const { return theLen==s.theLen && memcmp(theStart,s.theStart,theLen)==0; }
-    bool operator!=(const StringArea &s) const { return !operator==(s); }
-    bool operator< ( const StringArea &s) const {
-        return (theLen < s.theLen || (theLen == s.theLen && memcmp(theStart,s.theStart,theLen) < 0)) ;
-    }
-
-    void print(std::ostream &os) const { os.write(theStart, theLen); }
-
-private:
-    /// pointed to the externally-managed memory area
-    const char *theStart;
-    /// length of the string
-    size_t theLen;
-};
-
-inline std::ostream &
-operator <<(std::ostream &os, const StringArea &a)
-{
-    a.print(os);
-    return os;
-}
-
-#endif /* SQUID_STRINGAREA_H */