summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-12-07 14:35:09 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-12-13 12:32:44 +0100
commit3deed83ae2feca795c03d97eff3a66c20f637ca8 (patch)
treedfab804732c0dfdec2abd67c5a57a12d5f8dc737 /src/shared
parentin-addr-util: introduce in_addr_data_hash_ops_free and expose its compare and... (diff)
downloadsystemd-3deed83ae2feca795c03d97eff3a66c20f637ca8.tar.xz
systemd-3deed83ae2feca795c03d97eff3a66c20f637ca8.zip
dns-domain: introduce dns_name_hash_ops_free
Preparation for later commits.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/dns-domain.c13
-rw-r--r--src/shared/dns-domain.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index ebf86d2405..a071976442 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -527,7 +527,18 @@ int dns_name_compare_func(const char *a, const char *b) {
}
}
-DEFINE_HASH_OPS(dns_name_hash_ops, char, dns_name_hash_func, dns_name_compare_func);
+DEFINE_HASH_OPS(
+ dns_name_hash_ops,
+ char,
+ dns_name_hash_func,
+ dns_name_compare_func);
+
+DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
+ dns_name_hash_ops_free,
+ char,
+ dns_name_hash_func,
+ dns_name_compare_func,
+ free);
int dns_name_equal(const char *x, const char *y) {
int r, q;
diff --git a/src/shared/dns-domain.h b/src/shared/dns-domain.h
index 5421c60ee7..7a35ae43bc 100644
--- a/src/shared/dns-domain.h
+++ b/src/shared/dns-domain.h
@@ -67,6 +67,7 @@ static inline bool dns_name_is_empty(const char *s) {
void dns_name_hash_func(const char *s, struct siphash *state);
int dns_name_compare_func(const char *a, const char *b);
extern const struct hash_ops dns_name_hash_ops;
+extern const struct hash_ops dns_name_hash_ops_free;
int dns_name_between(const char *a, const char *b, const char *c);
int dns_name_equal(const char *x, const char *y);