]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use SBuf instead of SquidString in MemObject (#1558)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Thu, 2 Nov 2023 23:24:56 +0000 (23:24 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 2 Nov 2023 23:25:10 +0000 (23:25 +0000)
src/MemObject.cc
src/MemObject.h

index d8f6687fe7f2ead83ccf4b4b61a91da8a10093c4..6e6f301e160b52944c2ebe3d2b5c0567557272ef 100644 (file)
@@ -52,24 +52,24 @@ MemObject::inUseCount()
 const char *
 MemObject::storeId() const
 {
-    if (!storeId_.size()) {
+    if (storeId_.isEmpty()) {
         debugs(20, DBG_IMPORTANT, "ERROR: Squid BUG: Missing MemObject::storeId value");
         dump();
         storeId_ = "[unknown_URI]";
     }
-    return storeId_.termedBuf();
+    return storeId_.c_str();
 }
 
 const char *
 MemObject::logUri() const
 {
-    return logUri_.size() ? logUri_.termedBuf() : storeId();
+    return logUri_.isEmpty() ? storeId() : logUri_.c_str();
 }
 
 bool
 MemObject::hasUris() const
 {
-    return storeId_.size();
+    return !storeId_.isEmpty();
 }
 
 void
@@ -83,7 +83,7 @@ MemObject::setUris(char const *aStoreId, char const *aLogUri, const HttpRequestM
 
     // fast pointer comparison for a common storeCreateEntry(url,url,...) case
     if (!aLogUri || aLogUri == aStoreId)
-        logUri_.clean(); // use storeId_ by default to minimize copying
+        logUri_.clear(); // use storeId_ by default to minimize copying
     else
         logUri_ = aLogUri;
 
index 1e842d2b2b69c9246afeb40098d62761d9bdaebb..5e90a4734a735d6c696f769abf6bc8a3e7707290 100644 (file)
@@ -14,7 +14,7 @@
 #include "http/RequestMethod.h"
 #include "HttpReply.h"
 #include "RemovalPolicy.h"
-#include "SquidString.h"
+#include "sbuf/SBuf.h"
 #include "stmem.h"
 #include "store/forward.h"
 #include "StoreIOBuffer.h"
@@ -234,8 +234,8 @@ private:
     HttpReplyPointer reply_; ///< \see baseReply()
     HttpReplyPointer updatedReply_; ///< \see updatedReply()
 
-    mutable String storeId_; ///< StoreId for our entry (usually request URI)
-    mutable String logUri_;  ///< URI used for logging (usually request URI)
+    mutable SBuf storeId_; ///< StoreId for our entry (usually request URI)
+    mutable SBuf logUri_;  ///< URI used for logging (usually request URI)
 
     DelayedAsyncCalls deferredReads;
 };