]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/StoreMap.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / StoreMap.cc
index a0b999af49b94058d0e8a14d73d4b7b20396ef25..41fdf6f0f96dac759ab1114c47dff2e86282ad2a 100644 (file)
@@ -1,13 +1,12 @@
 /*
- * $Id$
- *
  * DEBUG: section 54    Interprocess Communication
  */
 
 #include "squid.h"
-#include "protos.h"
-#include "Store.h"
 #include "ipc/StoreMap.h"
+#include "Store.h"
+#include "store_key_md5.h"
+#include "tools.h"
 
 Ipc::StoreMap::Owner *
 Ipc::StoreMap::Init(const char *const path, const int limit, const size_t extrasSize)
@@ -256,24 +255,23 @@ void
 Ipc::StoreMap::freeLocked(Slot &s, bool keepLocked)
 {
     if (s.state == Slot::Readable && cleaner)
-        cleaner->cleanReadable(&s - shared->slots);
+        cleaner->cleanReadable(&s - shared->slots.raw());
 
     s.waitingToBeFreed = false;
     s.state = Slot::Empty;
     if (!keepLocked)
         s.lock.unlockExclusive();
     --shared->count;
-    debugs(54, 5, HERE << " freed slot at " << (&s - shared->slots) <<
+    debugs(54, 5, HERE << " freed slot at " << (&s - shared->slots.raw()) <<
            " in map [" << path << ']');
 }
 
-
 /* Ipc::StoreMapSlot */
 
 Ipc::StoreMapSlot::StoreMapSlot(): state(Empty)
 {
-    xmemset(&key, 0, sizeof(key));
-    xmemset(&basics, 0, sizeof(basics));
+    memset(&key, 0, sizeof(key));
+    memset(&basics, 0, sizeof(basics));
 }
 
 void
@@ -306,14 +304,8 @@ Ipc::StoreMapSlot::set(const StoreEntry &from)
 /* Ipc::StoreMap::Shared */
 
 Ipc::StoreMap::Shared::Shared(const int aLimit, const size_t anExtrasSize):
-        limit(aLimit), extrasSize(anExtrasSize), count(0)
-{
-    slots=new Slot[limit];
-}
-
-Ipc::StoreMap::Shared::~Shared()
+        limit(aLimit), extrasSize(anExtrasSize), count(0), slots(aLimit)
 {
-    delete[] slots;
 }
 
 size_t