]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: use SBuf instead of SquidString in CommonPool (#1449)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Thu, 10 Aug 2023 05:51:42 +0000 (05:51 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 11 Aug 2023 07:24:44 +0000 (07:24 +0000)
src/CommonPool.h
src/DelayPool.cc
src/delay_pools.cc

index abbd2a3ea35b40b4d4613a5b2aec2a6039b40b68..0c0a023af466ca21afc0d96da2c0af3105682b2d 100644 (file)
@@ -13,7 +13,7 @@
 
 #if USE_DELAY_POOLS
 #include "CompositePoolNode.h"
-#include "SquidString.h"
+#include "sbuf/SBuf.h"
 
 /*
  \ingroup DelayPoolsAPI
@@ -28,11 +28,11 @@ class CommonPool
 
 public:
     static CommonPool *Factory (unsigned char _class, CompositePoolNode::Pointer&);
-    char const* theClassTypeLabel() const {return typeLabel.termedBuf();}
+    const SBuf &classTypeLabel() const { return typeLabel; }
 
 protected:
     CommonPool();
-    String typeLabel;
+    SBuf typeLabel;
 };
 
 #endif /* USE_DELAY_POOLS */
index 14b57fb705e2c708db0ffa70a894342e222efaa0..bfb3655513f71dc643e3e5b60a972c9d6c5e5dc1 100644 (file)
@@ -44,7 +44,7 @@ DelayPool::dump(StoreEntry *entry, unsigned int i) const
     if (theComposite() == nullptr)
         return;
 
-    storeAppendPrintf(entry, "delay_class %d %s\n", i + 1, pool->theClassTypeLabel());
+    storeAppendPrintf(entry, "delay_class %d " SQUIDSBUFPH "\n", i + 1, SQUIDSBUFPRINT(pool->classTypeLabel()));
 
     LOCAL_ARRAY(char, nom, 32);
 
index 37408e7e31cb94257697d6a78eda0ea6be071fc8..677097206cb744a8f3b343119e4e7d46a9f42eda 100644 (file)
@@ -35,7 +35,7 @@
 #include "MemObject.h"
 #include "mgr/Registration.h"
 #include "NullDelayId.h"
-#include "SquidString.h"
+#include "sbuf/SBuf.h"
 #include "Store.h"
 #include "StoreClient.h"
 
@@ -256,11 +256,11 @@ CommonPool::Factory(unsigned char _class, CompositePoolNode::Pointer& compositeC
 
     case 1:
         compositeCopy = new Aggregate;
-        result->typeLabel = "1";
+        result->typeLabel = SBuf("1");
         break;
 
     case 2:
-        result->typeLabel = "2";
+        result->typeLabel = SBuf("2");
         {
             DelayVector::Pointer temp = new DelayVector;
             compositeCopy = temp.getRaw();
@@ -270,7 +270,7 @@ CommonPool::Factory(unsigned char _class, CompositePoolNode::Pointer& compositeC
         break;
 
     case 3:
-        result->typeLabel = "3";
+        result->typeLabel = SBuf("3");
         {
             DelayVector::Pointer temp = new DelayVector;
             compositeCopy = temp.getRaw();
@@ -281,7 +281,7 @@ CommonPool::Factory(unsigned char _class, CompositePoolNode::Pointer& compositeC
         break;
 
     case 4:
-        result->typeLabel = "4";
+        result->typeLabel = SBuf("4");
         {
             DelayVector::Pointer temp = new DelayVector;
             compositeCopy = temp.getRaw();
@@ -295,7 +295,7 @@ CommonPool::Factory(unsigned char _class, CompositePoolNode::Pointer& compositeC
         break;
 
     case 5:
-        result->typeLabel = "5";
+        result->typeLabel = SBuf("5");
         compositeCopy = new DelayTagged;
         break;
 
@@ -544,7 +544,7 @@ DelayPools::Stats(StoreEntry * sentry)
 
     for (unsigned short i = 0; i < DelayPools::pools(); ++i) {
         if (DelayPools::delay_data[i].theComposite().getRaw()) {
-            storeAppendPrintf(sentry, "Pool: %d\n\tClass: %s\n\n", i + 1, DelayPools::delay_data[i].pool->theClassTypeLabel());
+            storeAppendPrintf(sentry, "Pool: %d\n\tClass: " SQUIDSBUFPH "\n\n", i + 1, SQUIDSBUFPRINT(DelayPools::delay_data[i].pool->classTypeLabel()));
             DelayPools::delay_data[i].theComposite()->stats (sentry);
         } else
             storeAppendPrintf(sentry, "\tMisconfigured pool.\n\n");