Use FIFO queue STL container instead.
ipcache.cc \
ipcache.h \
$(LEAKFINDERSOURCE) \
- SquidList.h \
- SquidList.cc \
LogTags.cc \
LogTags.h \
lookup_t.h \
MasterXaction.h \
Notes.cc \
Notes.h \
- SquidList.h \
- SquidList.cc \
mem_node.cc \
Parsing.cc \
tests/stub_libsecurity.cc \
internal.cc \
LogTags.cc \
tests/stub_libsecurity.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
multicast.h \
HttpReply.cc \
int.h \
int.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
MemBuf.cc \
internal.cc \
LogTags.cc \
tests/stub_libsecurity.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
tests/stub_libmem.cc \
internal.h \
internal.cc \
LogTags.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
MemBuf.cc \
$(IPC_SOURCE) \
ipcache.cc \
LogTags.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
MemBuf.cc \
internal.cc \
LogTags.cc \
tests/stub_libsecurity.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
multicast.h \
RequestFlags.h \
int.h \
int.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
mem_node.cc \
int.cc \
RequestFlags.h \
RequestFlags.cc \
- SquidList.h \
- SquidList.cc \
Transients.cc \
MasterXaction.cc \
MasterXaction.h \
HttpReply.cc \
int.h \
int.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
MemBuf.cc \
internal.cc \
tests/stub_libeui.cc \
LogTags.cc \
- SquidList.h \
- SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
multicast.h \
+++ /dev/null
-/*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: none Linked list functions (deprecated) */
-
-#include "squid.h"
-#include "mem/forward.h"
-#include "SquidList.h"
-
-/* This should go away, in favour of the List template class */
-
-void
-linklistPush(link_list ** L, void *p)
-{
- link_list *l = (link_list *)memAllocate(MEM_LINK_LIST);
- l->next = NULL;
- l->ptr = p;
-
- while (*L)
- L = &(*L)->next;
-
- *L = l;
-}
-
-void *
-linklistShift(link_list ** L)
-{
- void *p;
- link_list *l;
-
- if (NULL == *L)
- return NULL;
-
- l = *L;
-
- p = l->ptr;
-
- *L = (*L)->next;
-
- memFree(l, MEM_LINK_LIST);
-
- return p;
-}
-
+++ /dev/null
-/*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: none Linked list functions (deprecated) */
-
-#ifndef SQUID_SQUIDLIST_H_
-#define SQUID_SQUIDLIST_H_
-
-class link_list
-{
-public:
- void *ptr;
- link_list *next;
-};
-
-void linklistPush(link_list **, void *);
-void *linklistShift(link_list **);
-
-#endif /* SQUID_SQUIDLIST_H_ */
-
MEM_16K_BUF,
MEM_32K_BUF,
MEM_64K_BUF,
- MEM_LINK_LIST,
MEM_DREAD_CTRL,
MEM_DWRITE_Q,
MEM_MD5_DIGEST,
#include "MemBuf.h"
#include "mgr/Registration.h"
#include "SquidConfig.h"
-#include "SquidList.h"
#include "SquidTime.h"
#include "Store.h"
memDataInit(MEM_16K_BUF, "16K Buffer", 16384, 10, false);
memDataInit(MEM_32K_BUF, "32K Buffer", 32768, 10, false);
memDataInit(MEM_64K_BUF, "64K Buffer", 65536, 10, false);
- memDataInit(MEM_LINK_LIST, "link_list", sizeof(link_list), 10);
memDataInit(MEM_DREAD_CTRL, "dread_ctrl", sizeof(dread_ctrl), 0);
memDataInit(MEM_DWRITE_Q, "dwrite_q", sizeof(dwrite_q), 0);
memDataInit(MEM_MD5_DIGEST, "MD5 digest", SQUID_MD5_DIGEST_LENGTH, 0);
#include "squid.h"
#include "heap.h"
#include "MemObject.h"
-#include "SquidList.h"
#include "Store.h"
#include "store_heap_replacement.h"
#include "wordlist.h"
+#include <queue>
+
REMOVALPOLICYCREATE createRemovalPolicy_heap;
static int nr_heap_policies = 0;
/** RemovalPurgeWalker **/
-typedef struct _HeapPurgeData HeapPurgeData;
-
-struct _HeapPurgeData {
- link_list *locked_entries;
- heap_key min_age;
+class HeapPurgeData
+{
+public:
+ std::queue<StoreEntry *> locked_entries;
+ heap_key min_age = 0.0;
};
static StoreEntry *
if (entry->locked()) {
entry->lock("heap_purgeNext");
- linklistPush(&heap_walker->locked_entries, entry);
+ heap_walker->locked_entries.push(entry);
goto try_again;
}
HeapPurgeData *heap_walker = (HeapPurgeData *)walker->_data;
RemovalPolicy *policy = walker->_policy;
HeapPolicyData *h = (HeapPolicyData *)policy->_data;
- StoreEntry *entry;
assert(strcmp(policy->_type, "heap") == 0);
assert(h->nwalkers > 0);
h->nwalkers -= 1;
debugs(81, 3, "Heap age set to " << h->theHeap->age);
}
- /*
- * Reinsert the locked entries
- */
- while ((entry = (StoreEntry *)linklistShift(&heap_walker->locked_entries))) {
+ // Reinsert the locked entries
+ while (!heap_walker->locked_entries.empty()) {
+ StoreEntry *entry = heap_walker->locked_entries.front();
heap_node *node = heap_insert(h->theHeap, entry);
h->setPolicyNode(entry, node);
entry->unlock("heap_purgeDone");
+ heap_walker->locked_entries.pop();
}
- safe_free(walker->_data);
+ delete heap_walker;
delete walker;
}
HeapPurgeData *heap_walk;
h->nwalkers += 1;
walker = new RemovalPurgeWalker;
- heap_walk = (HeapPurgeData *)xcalloc(1, sizeof(*heap_walk));
- heap_walk->min_age = 0.0;
- heap_walk->locked_entries = NULL;
+ heap_walk = new HeapPurgeData;
walker->_policy = policy;
walker->_data = heap_walk;
walker->max_scan = max_scan;