From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Thu, 10 Aug 2023 05:51:42 +0000 (+0000) Subject: Maintenance: use SBuf instead of SquidString in CommonPool (#1449) X-Git-Tag: SQUID_7_0_1~374 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e9de476025da0a04a6b36978c40f8e43b1c0839;p=thirdparty%2Fsquid.git Maintenance: use SBuf instead of SquidString in CommonPool (#1449) --- diff --git a/src/CommonPool.h b/src/CommonPool.h index abbd2a3ea3..0c0a023af4 100644 --- a/src/CommonPool.h +++ b/src/CommonPool.h @@ -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 */ diff --git a/src/DelayPool.cc b/src/DelayPool.cc index 14b57fb705..bfb3655513 100644 --- a/src/DelayPool.cc +++ b/src/DelayPool.cc @@ -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); diff --git a/src/delay_pools.cc b/src/delay_pools.cc index 37408e7e31..677097206c 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -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");