diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-12-03 17:59:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-03 17:59:44 +0100 |
commit | 76b31bbb2442f52c5877ff99047955adf806a5b2 (patch) | |
tree | c057c509b68133f8afd542cf66ad6064aac9f09e /src/network/networkd-address.c | |
parent | a20f73221ad3662690fb08830cda421b6db35600 (diff) | |
parent | 71da167373b79d062f91988d19f83836dc2b7396 (diff) | |
download | systemd-76b31bbb2442f52c5877ff99047955adf806a5b2.tar.gz |
Merge pull request #10920 from yuwata/hashmap-destructor
hashmap: make hashmap_free() call destructors of key or value
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r-- | src/network/networkd-address.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index dce9a73c19..9f0a22b827 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -114,9 +114,7 @@ void address_free(Address *address) { free(address); } -static void address_hash_func(const void *b, struct siphash *state) { - const Address *a = b; - +static void address_hash_func(const Address *a, struct siphash *state) { assert(a); siphash24_compress(&a->family, sizeof(a->family), state); @@ -149,8 +147,7 @@ static void address_hash_func(const void *b, struct siphash *state) { } } -static int address_compare_func(const void *c1, const void *c2) { - const Address *a1 = c1, *a2 = c2; +static int address_compare_func(const Address *a1, const Address *a2) { int r; r = CMP(a1->family, a2->family); @@ -194,10 +191,7 @@ static int address_compare_func(const void *c1, const void *c2) { } } -static const struct hash_ops address_hash_ops = { - .hash = address_hash_func, - .compare = address_compare_func -}; +DEFINE_PRIVATE_HASH_OPS(address_hash_ops, Address, address_hash_func, address_compare_func); bool address_equal(Address *a1, Address *a2) { if (a1 == a2) |