]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Change Config.cacheSwap.swapDirs and StoreEntry::store() type to SwapDir.
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Wed, 27 Apr 2011 19:05:15 +0000 (23:05 +0400)
committerDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Wed, 27 Apr 2011 19:05:15 +0000 (23:05 +0400)
This allows using SwapDir API without dynamic_cast.

src/Store.h
src/SwapDir.h
src/store.cc
src/store_dir.cc
src/structs.h

index 5a0075e2506bc8d4c1022cc73144e093877892cf..de48b5187ba2b8e82312bfc3b54f143972e5b8e2 100644 (file)
@@ -57,8 +57,8 @@
 class AsyncCall;
 class StoreClient;
 class MemObject;
-class Store;
 class StoreSearch;
+class SwapDir;
 
 typedef struct {
 
@@ -143,7 +143,7 @@ public:
     bool hasIfNoneMatchEtag(const HttpRequest &request) const;
 
     /** What store does this entry belong too ? */
-    virtual RefCount<Store> store() const;
+    virtual RefCount<SwapDir> store() const;
 
     MemObject *mem_obj;
     MemObject *hidden_mem_obj; ///< mem_obj created before URLs were known
index 3dc7b96fb0765b7986cc58fc51ec282c05c2ede1..16c1000fc313c1ee67fe565a69b3bf350ccdd3d1 100644 (file)
@@ -123,6 +123,8 @@ class SwapDir : public Store
 {
 
 public:
+    typedef RefCount<SwapDir> Pointer;
+
     SwapDir(char const *aType);
     virtual ~SwapDir();
     virtual void reconfigure(int, char *) = 0;
index cf31227c16498811b957c68961c2b0fa0bada7ad..37ab844696dc8135f3721d431166b44410a25100 100644 (file)
@@ -2062,7 +2062,7 @@ StoreEntry::hasOneOfEtags(const String &reqETags, const bool allowWeakMatch) con
     return matched;
 }
 
-StorePointer
+SwapDir::Pointer
 StoreEntry::store() const
 {
     assert(0 <= swap_dirn && swap_dirn < Config.cacheSwap.n_configured);
index 398345d55ba642dc944f6c3b73ba023d30899cd8..95c9995a273af1ec50e888cb0b6d09585d5da152 100644 (file)
@@ -639,13 +639,12 @@ allocate_new_swapdir(SquidConfig::_cacheSwap * swap)
 {
     if (swap->swapDirs == NULL) {
         swap->n_allocated = 4;
-        swap->swapDirs = static_cast<StorePointer *>(xcalloc(swap->n_allocated, sizeof(StorePointer)));
+        swap->swapDirs = static_cast<SwapDir::Pointer *>(xcalloc(swap->n_allocated, sizeof(SwapDir::Pointer)));
     }
 
     if (swap->n_allocated == swap->n_configured) {
-        StorePointer *tmp;
         swap->n_allocated <<= 1;
-        tmp = static_cast<StorePointer *>(xcalloc(swap->n_allocated, sizeof(StorePointer)));
+        SwapDir::Pointer *const tmp = static_cast<SwapDir::Pointer *>(xcalloc(swap->n_allocated, sizeof(SwapDir::Pointer)));
         memcpy(tmp, swap->swapDirs, swap->n_configured * sizeof(SwapDir *));
         xfree(swap->swapDirs);
         swap->swapDirs = tmp;
index 7272341a04e97ee40e34d3de8dab11ee7bbaf2c1..a52894e855edeb1059fd2ebcf2e36a7e00e3dcdd 100644 (file)
@@ -143,7 +143,7 @@ struct relist {
 class CpuAffinityMap;
 class RemovalPolicySettings;
 class external_acl;
-class Store;
+class SwapDir;
 
 struct SquidConfig {
 
@@ -494,7 +494,7 @@ struct SquidConfig {
     refresh_t *Refresh;
 
     struct _cacheSwap {
-        RefCount<class Store> *swapDirs;
+        RefCount<SwapDir> *swapDirs;
         int n_allocated;
         int n_configured;
         ///< number of disk processes required to support all cache_dirs