summaryrefslogtreecommitdiffstats
path: root/src/basic/ether-addr-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-12-24 09:51:30 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-12-25 07:38:59 +0100
commitc01a5c0527b7c49d4b10f5d525de060feb2b37f2 (patch)
tree9831d585e249cbcb21ccb24194e93e48dfff3aab /src/basic/ether-addr-util.c
parentresolve: don't add sockets to the graveyard on shutdown (diff)
downloadsystemd-c01a5c0527b7c49d4b10f5d525de060feb2b37f2.tar.xz
systemd-c01a5c0527b7c49d4b10f5d525de060feb2b37f2.zip
siphash24: introduce siphash24_compress_typesafe() macro
To prevent copy-and-paste mistake. This also introduce in_addr_hash_func(). No functional change, just refactoring.
Diffstat (limited to 'src/basic/ether-addr-util.c')
-rw-r--r--src/basic/ether-addr-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/ether-addr-util.c b/src/basic/ether-addr-util.c
index 12c256a474..4bf91f690f 100644
--- a/src/basic/ether-addr-util.c
+++ b/src/basic/ether-addr-util.c
@@ -59,8 +59,8 @@ void hw_addr_hash_func(const struct hw_addr_data *p, struct siphash *state) {
assert(p);
assert(state);
- siphash24_compress(&p->length, sizeof(p->length), state);
- siphash24_compress(p->bytes, p->length, state);
+ siphash24_compress_typesafe(p->length, state);
+ siphash24_compress_safe(p->bytes, p->length, state);
}
DEFINE_HASH_OPS(hw_addr_hash_ops, struct hw_addr_data, hw_addr_hash_func, hw_addr_compare);
@@ -106,7 +106,7 @@ int ether_addr_compare(const struct ether_addr *a, const struct ether_addr *b) {
}
static void ether_addr_hash_func(const struct ether_addr *p, struct siphash *state) {
- siphash24_compress(p, sizeof(struct ether_addr), state);
+ siphash24_compress_typesafe(*p, state);
}
DEFINE_HASH_OPS(ether_addr_hash_ops, struct ether_addr, ether_addr_hash_func, ether_addr_compare);