9#ifndef SQUID_SRC_ACL_SPLAYINSERTER_H
10#define SQUID_SRC_ACL_SPLAYINSERTER_H
21template <
class DataValue>
66template <
class DataValue>
71 while (
const auto oldItemPointer = storage.
insert(newItem, comparator)) {
72 const auto oldItem = *oldItemPointer;
74 if (IsSubset(newItem, oldItem)) {
76 Debug::Extra <<
"advice: Remove value " << newItem <<
" from the ACL");
77 DestroyValue(newItem);
81 if (IsSubset(oldItem, newItem)) {
83 Debug::Extra <<
"advice: Remove value " << oldItem <<
" from the ACL");
84 storage.
remove(oldItem, comparator);
85 DestroyValue(oldItem);
89 const auto combinedItem = MakeCombinedValue(oldItem, newItem);
91 Debug::Extra <<
"advice: Replace values " << newItem <<
" and " << oldItem <<
" with " << combinedItem <<
" in the ACL");
92 DestroyValue(newItem);
93 newItem = combinedItem;
94 storage.
remove(oldItem, comparator);
95 DestroyValue(oldItem);
static Value MakeCombinedValue(const Value &a, const Value &b)
static void DestroyValue(Value v)
A Splay::SPLAYFREE-like function that destroys parsed ACL parameter values.
static int Compare(const Value &a, const Value &b)
static bool IsSubset(const Value &a, const Value &b)
static void Merge(Splay< Value > &, Value &&)
static std::ostream & Extra(std::ostream &)
void remove(Value const &, SPLAYCMP *compare)
const Value * insert(const Value &, SPLAYCMP *)
#define DBG_PARSE_NOTE(x)
#define debugs(SECTION, LEVEL, CONTENT)