]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: rename String::limitInit() to assign() (#488)
authorjosepjones <josepjones@expedia.com>
Thu, 3 Oct 2019 13:57:32 +0000 (13:57 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 3 Oct 2019 16:05:47 +0000 (16:05 +0000)
13 files changed:
src/HttpHeader.cc
src/HttpHeaderTools.cc
src/HttpReply.cc
src/SquidString.h
src/String.cc
src/adaptation/ServiceConfig.cc
src/adaptation/ServiceGroups.cc
src/auth/digest/Config.cc
src/cache_cf.cc
src/esi/Segment.cc
src/esi/VarState.cc
src/ipc/TypedMsgHdr.cc
src/sbuf/StringConvert.h

index 774e0cf8fb040ca21ecb7d24554bad2c6c4e4518..d161cbfa29cb2d6965f6840ba82f3fe55ddc783d 100644 (file)
@@ -1493,7 +1493,7 @@ HttpHeaderEntry::parse(const char *field_start, const char *field_end, const htt
     }
 
     /* set field value */
-    value.limitInit(value_start, field_end - value_start);
+    value.assign(value_start, field_end - value_start);
 
     if (id != Http::HdrType::BAD_HDR)
         ++ headerStatsTable[id].seenCount;
index b4f1ab111b6a38eb174bec9b209453f70c8cc44d..7f82551928398b6432f83e2ac48cd381a032dbef 100644 (file)
@@ -229,7 +229,7 @@ httpHeaderParseQuotedString(const char *start, const int len, String *val)
     }
     /* Make sure it's defined even if empty "" */
     if (!val->termedBuf())
-        val->limitInit("", 0);
+        val->assign("", 0);
     return 1;
 }
 
index 38ea4638a2bee78fd705bce9fcbd5f2e3c1b4f6f..0cc0c190f89d864a2f2d450faf55c2b8c5c23611 100644 (file)
@@ -335,7 +335,7 @@ HttpReply::hdrCacheInit()
     const char *str = header.getStr(Http::HdrType::CONTENT_TYPE);
 
     if (str)
-        content_type.limitInit(str, strcspn(str, ";\t "));
+        content_type.assign(str, strcspn(str, ";\t "));
     else
         content_type = String();
 
index d7af11fbfb04cb46e8fa7725c2e2ca62c9bf6fb5..cda4d986db7178c94ffc47d1f96b3e495f55a5fd 100644 (file)
@@ -90,7 +90,7 @@ public:
      */
     char const * termedBuf() const { return buf_; }
 
-    void limitInit(const char *str, int len); // TODO: rename to assign()
+    void assign(const char *str, int len);
     void clean();
     void reset(char const *str);
     void append(char const *buf, int len);
index 62a839e7eac83b295144ae169a618f06e4a12fac..9fccddc45a5702c3a12030617468d09189a97c8f 100644 (file)
@@ -91,7 +91,7 @@ String::operator !=(String const &that) const
 
 // public interface, makes sure that we clean the old buffer first
 void
-String::limitInit(const char *str, int len)
+String::assign(const char *str, int len)
 {
     clean(); // TODO: optimize to avoid cleaning the buffer we can use
     allocAndFill(str, len);
@@ -228,7 +228,7 @@ String::substr(String::size_type from, String::size_type to) const
     Must(to > from);
 
     String rv;
-    rv.limitInit(rawBuf()+from,to-from);
+    rv.assign(rawBuf()+from, to-from);
     return rv;
 }
 
index 59fcd87faafea38f01d1dd7ded361165e6858dd9..e7b9078b1a43e2d3a02f9d6019bad41866ad1c69 100644 (file)
@@ -244,7 +244,7 @@ Adaptation::ServiceConfig::grokUri(const char *value)
         len = e - s;
     }
 
-    host.limitInit(s, len);
+    host.assign(s, len);
 #if USE_OPENSSL
     if (secure.sslDomain.isEmpty())
         secure.sslDomain.assign(host.rawBuf(), host.size());
@@ -285,7 +285,7 @@ Adaptation::ServiceConfig::grokUri(const char *value)
                "long resource name (>1024), probably wrong");
     }
 
-    resource.limitInit(s, len + 1);
+    resource.assign(s, len + 1);
     return true;
 }
 
index c419ac887bdcb898d8c1c82876eb8854549091c2..8c738acb034b1bab3318ebc10e453df073531682 100644 (file)
@@ -252,7 +252,7 @@ Adaptation::DynamicServiceChain::Split(const ServiceFilter &filter,
     const char *pos = NULL;
     while (strListGetItem(&ids, ',', &item, &ilen, &pos)) {
         String id;
-        id.limitInit(item, ilen);
+        id.assign(item, ilen);
         ServicePointer service = FindService(id);
         if (doingCurrent) {
             if (!service || // cannot tell or matches current location
index 67498d0bf9c5b3ff25ed6d943164bd280d21f206..8621d8eb9fee6433e2451bd7e2c102f07cea3f2f 100644 (file)
@@ -777,16 +777,16 @@ Auth::Digest::Config::decode(char const *proxy_auth, const char *aRequestRealm)
                 // 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 (vlen > 1 && *p == '"' && *(p + vlen -1) == '"') {
-                    value.limitInit(p+1, vlen-2);
+                    value.assign(p+1, vlen-2);
                 }
             } 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.
                 if (vlen > 1 && *p == '"' && *(p + vlen -1) == '"') {
-                    value.limitInit(p+1, vlen-2);
+                    value.assign(p+1, vlen-2);
                 } else {
-                    value.limitInit(p, vlen);
+                    value.assign(p, vlen);
                 }
             } else if (*p == '"') {
                 if (!httpHeaderParseQuotedString(p, vlen, &value)) {
@@ -794,7 +794,7 @@ Auth::Digest::Config::decode(char const *proxy_auth, const char *aRequestRealm)
                     continue;
                 }
             } else {
-                value.limitInit(p, vlen);
+                value.assign(p, vlen);
             }
         } else {
             debugs(29, 9, "Failed to parse attribute '" << item << "' in '" << temp << "'");
index 4ef581279b703b2b45fcd2f4d6757c68cfe47386..fba5e6847b105387313e3d85608ef002988f6362 100644 (file)
@@ -1289,7 +1289,7 @@ parseBytesOptionValue(size_t * bptr, const char *units, char const * value)
     }
 
     String number;
-    number.limitInit(number_begin, number_end - number_begin);
+    number.assign(number_begin, number_end - number_begin);
 
     int d = xatoi(number.termedBuf());
     int m;
index 1dab735fecd97c45e187f829a6a4e89bfea1c4bc..d20304c11fc2267ae16dfea7da9d8aa1c006d7a9 100644 (file)
@@ -191,7 +191,7 @@ void
 ESISegment::dumpOne() const
 {
     String temp;
-    temp.limitInit(buf, len);
+    temp.assign(buf, len);
     debugs(86, 9, "ESISegment::dumpOne: \"" << temp << "\"");
 }
 
index b5daf6cde3704b0f5ca32beb3a2d56cab4b9702f..d59a77c760bcb8ec00e5107c240c89fd2a2b5c33 100644 (file)
@@ -282,7 +282,7 @@ void
 ESIVarState::addVariable(char const *name, size_t len, Variable *aVariable)
 {
     String temp;
-    temp.limitInit (name, len);
+    temp.assign(name, len);
     removeVariable (temp);
     variables.add(name, len, aVariable);
     variablesForCleanup.push_back(aVariable);
index 99c94b42bd9bb57592598e0c01e0efac5441d29e..b9a5844cd2a4a8a108a09bff045d3437a5b0c094 100644 (file)
@@ -143,7 +143,7 @@ Ipc::TypedMsgHdr::getString(String &s) const
     // TODO: use SBuf.reserve() instead of a temporary buffer
     char buf[maxSize];
     getRaw(&buf, length);
-    s.limitInit(buf, length);
+    s.assign(buf, length);
 }
 
 void
index 7223d8dabb0de1ff62e033fdd002de895caa329f..df55575f3e159a42c494c55f02fcae11a82e770e 100644 (file)
@@ -26,7 +26,7 @@ inline String
 SBufToString(const SBuf &s)
 {
     String rv;
-    rv.limitInit(s.rawContent(), s.length());
+    rv.assign(s.rawContent(), s.length());
     return rv;
 }