Commit Graph

29 Commits

Author SHA1 Message Date
Max Kellermann
9691b609a2 util/IntrusiveHashSet: remove_and_dispose() returns number of removed elements 2023-08-03 20:44:47 +02:00
Max Kellermann
250fa8c732 util/IntrusiveHashSet: rename remove_and_dispose() to remove_and_dispose_key() 2023-08-03 20:44:39 +02:00
Max Kellermann
2cd5f4cd3e util/IntrusiveHashSet: replace template parameters Hash/Equal with a single one
Preparing to add a key extraction function.  Without this "Operators"
template parameter, we'd have even more template parameters, and that
parameter list would grow too complex.  Better wrap it in one single
template that contains all operators.

This is an API change which all callers need to adjust to, but it will
be worth it.
2023-08-03 20:44:14 +02:00
Max Kellermann
dcd7c6337c util/Intrusive{List,HashSet}: reimplement hook mode detection with implicit cast 2023-08-03 20:33:15 +02:00
Max Kellermann
acc92b156b util/Concepts: remove obsolete fallbacks 2023-07-21 19:43:04 +02:00
Max Kellermann
aeadae5399 util/IntrusiveHashSet: insert_check() returns the bucket head on success
The list head is a stable value that is guaranteed to be still valid
when insert_commit() gets called.

This fixes a linked list corruption bug in class StaticCache which
occurs when the cache item pointed to by the iterator gets evicted
between insert_check() and insert_commit().
2023-07-21 19:42:35 +02:00
Max Kellermann
42d5b05f54 util/IntrusiveHashSet: rename insert() to insert_commit()
Clarify that the method is not a freestanding insertion method but
should only be used after insert_check().
2023-07-21 19:42:26 +02:00
Max Kellermann
e133f621a4 util/IntrusiveHashSet: add insert_check() documentation 2023-07-21 19:41:46 +02:00
Max Kellermann
99885c4cbc util/IntrusiveHashSet: add method remove_and_dispose() 2023-04-22 08:40:53 +02:00
Max Kellermann
148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann
f1cea1f152 util/IntrusiveHashSet: add unlink(), is_linked() 2023-01-31 13:07:26 +01:00
Max Kellermann
868958e159 util/IntrusiveHashSet: fix find_if() concept 2023-01-22 12:25:55 +01:00
Max Kellermann
52af03a5a6 util/IntrusiveHashSet: implement remove_and_dispose_if() with constant_time_size 2023-01-22 12:24:50 +01:00
Max Kellermann
c65b1fee8d util/IntrusiveHashSet: check key equivalence in remove_and_dispose_if() 2023-01-22 12:24:41 +01:00
Max Kellermann
57673136d8 util/IntrusiveHashSet: add method expire_find_if() 2023-01-22 12:24:30 +01:00
Max Kellermann
49e122a81d util/IntrusiveHashSet: add method remove_and_dispose_if(key) 2023-01-22 12:24:23 +01:00
Max Kellermann
c7a0597fe7 util/Intrusive*: add C++20 concept checks 2022-12-01 15:43:51 +01:00
Max Kellermann
5945877313 util/IntrusiveHashSet: add missing Cast()/ToHook() functions to IntrusiveHashSetMemberHookTraits 2022-12-01 15:10:42 +01:00
Max Kellermann
fe3e1d31bf util/IntrusiveHashSet: remove unused type alias "ListHookTraits" 2022-12-01 15:10:38 +01:00
Max Kellermann
65f1cafa43 util/IntrusiveHashSet: add method find_if() 2022-12-01 15:10:32 +01:00
Max Kellermann
e3ef0929f1 util/IntrusiveHashSet: add const overloads 2022-12-01 15:10:20 +01:00
Max Kellermann
8860962e09 util/IntrusiveHashSet: make several methods const 2022-12-01 15:10:13 +01:00
Max Kellermann
d0d095cbcd util/IntrusiveHashSet: rename "slot" to "bucket" 2022-11-22 21:40:52 +01:00
Max Kellermann
3239fce5c1 util/IntrusiveHashSet: add remove_and_dispose_if() 2022-11-22 21:40:11 +01:00
Max Kellermann
200b770104 util/IntrusiveHashSet: add for_each() 2022-11-22 21:40:04 +01:00
Max Kellermann
3aa959eda7 util/IntrusiveHashSet: add erase_and_dispose() 2022-11-22 21:39:40 +01:00
Max Kellermann
72c047f4f0 util/IntrusiveHashSet: add hash_function(), key_eq() 2022-11-21 09:10:44 +01:00
Max Kellermann
85ab89a08b util/IntrusiveHashSet: add missing typename (to make clang happy) 2022-11-13 08:40:53 +01:00
Max Kellermann
c943e27d51 util/IntrusiveHashSet: new class
Incomplete draft implementation, just enough methods for current
needs.
2022-11-13 08:38:53 +01:00