summaryrefslogtreecommitdiff
path: root/src/basic/hash-funcs.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-04-11 18:08:57 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-19 16:50:36 +0200
commit87da87846dbfb07358d01f9d53f1c35ec61b447d (patch)
tree1568e43f10f8f8526e4e73adcf492eccb8b31df8 /src/basic/hash-funcs.c
parent0bf2c5e5ec1b756e95f0e0792bfa473b2e140a64 (diff)
downloadsystemd-87da87846dbfb07358d01f9d53f1c35ec61b447d.tar.gz
basic/hashmap: add hashops variant that does strdup/freeing on its own
So far, we'd use hashmap_free_free to free both keys and values along with the hashmap. I think it's better to make this more encapsulated: in this variant the way contents are freed can be decided when the hashmap is created, and users of the hashmap can always use hashmap_free.
Diffstat (limited to 'src/basic/hash-funcs.c')
-rw-r--r--src/basic/hash-funcs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/basic/hash-funcs.c b/src/basic/hash-funcs.c
index 1be43d41a9..11cd371fad 100644
--- a/src/basic/hash-funcs.c
+++ b/src/basic/hash-funcs.c
@@ -10,6 +10,9 @@ void string_hash_func(const char *p, struct siphash *state) {
}
DEFINE_HASH_OPS(string_hash_ops, char, string_hash_func, string_compare_func);
+DEFINE_HASH_OPS_FULL(string_hash_ops_free_free,
+ char, string_hash_func, string_compare_func, free,
+ char, free);
void path_hash_func(const char *q, struct siphash *state) {
size_t n;