--- /dev/null
+/*
+ * Copyright (C) 1996-2015 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.
+ */
+
+#include "squid.h"
+#include "acl/AclSizeLimit.h"
+#include "acl/Gadgets.h"
+
+CBDATA_CLASS_INIT(AclSizeLimit);
+
+AclSizeLimit::~AclSizeLimit()
+{
+ aclDestroyAclList(&aclList);
+ delete next;
+}
#define SQUID_ACLSIZELIMIT_H_
#include "acl/forward.h"
+#include "cbdata.h"
/// representation of a class of Size-limit ACLs
-// a POD. TODO: convert to new ACL framework
class AclSizeLimit
{
+ CBDATA_CLASS(AclSizeLimit);
+
public:
+ AclSizeLimit() : next(NULL), aclList(NULL), size(0) {}
+ ~AclSizeLimit();
+
AclSizeLimit *next;
ACLList *aclList;
int64_t size;
}
#endif /* SO_MARK */
-CBDATA_TYPE(AclSizeLimit);
-
static void
dump_acl_b_size_t(StoreEntry * entry, const char *name, AclSizeLimit * head)
{
- AclSizeLimit *l;
-
- for (l = head; l; l = l->next) {
+ for (AclSizeLimit *l = head; l; l = l->next) {
if (l->size != -1)
storeAppendPrintf(entry, "%s %d %s\n", name, (int) l->size, B_BYTES_STR);
else
}
}
-static void
-freed_acl_b_size_t(void *data)
-{
- AclSizeLimit *l = static_cast<AclSizeLimit *>(data);
- aclDestroyAclList(&l->aclList);
-}
-
static void
parse_acl_b_size_t(AclSizeLimit ** head)
{
- AclSizeLimit *l;
- AclSizeLimit **tail = head; /* sane name below */
-
- CBDATA_INIT_TYPE_FREECB(AclSizeLimit, freed_acl_b_size_t);
-
- l = cbdataAlloc(AclSizeLimit);
+ AclSizeLimit *l = new AclSizeLimit;
parse_b_int64_t(&l->size);
aclParseAclList(LegacyParser, &l->aclList, l->size);
+ AclSizeLimit **tail = head; /* sane name below */
while (*tail)
tail = &(*tail)->next;
static void
free_acl_b_size_t(AclSizeLimit ** head)
{
- while (*head) {
- AclSizeLimit *l = *head;
- *head = l->next;
- l->next = NULL;
- cbdataFree(l);
- }
+ delete *head;
+ *head = NULL;
}
#if USE_DELAY_POOLS