diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-24 09:51:30 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-25 07:38:59 +0100 |
commit | c01a5c0527b7c49d4b10f5d525de060feb2b37f2 (patch) | |
tree | 9831d585e249cbcb21ccb24194e93e48dfff3aab /src/basic/hash-funcs.c | |
parent | resolve: don't add sockets to the graveyard on shutdown (diff) | |
download | systemd-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/hash-funcs.c')
-rw-r--r-- | src/basic/hash-funcs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/hash-funcs.c b/src/basic/hash-funcs.c index 5fac467185..251ee4f069 100644 --- a/src/basic/hash-funcs.c +++ b/src/basic/hash-funcs.c @@ -33,7 +33,7 @@ void path_hash_func(const char *q, struct siphash *state) { /* if path is absolute, add one "/" to the hash. */ if (path_is_absolute(q)) - siphash24_compress("/", 1, state); + siphash24_compress_byte('/', state); for (;;) { const char *e; @@ -67,7 +67,7 @@ DEFINE_HASH_OPS_FULL(path_hash_ops_free_free, void, free); void trivial_hash_func(const void *p, struct siphash *state) { - siphash24_compress(&p, sizeof(p), state); + siphash24_compress_typesafe(p, state); } int trivial_compare_func(const void *a, const void *b) { @@ -93,7 +93,7 @@ const struct hash_ops trivial_hash_ops_free_free = { }; void uint64_hash_func(const uint64_t *p, struct siphash *state) { - siphash24_compress(p, sizeof(uint64_t), state); + siphash24_compress_typesafe(*p, state); } int uint64_compare_func(const uint64_t *a, const uint64_t *b) { @@ -104,7 +104,7 @@ DEFINE_HASH_OPS(uint64_hash_ops, uint64_t, uint64_hash_func, uint64_compare_func #if SIZEOF_DEV_T != 8 void devt_hash_func(const dev_t *p, struct siphash *state) { - siphash24_compress(p, sizeof(dev_t), state); + siphash24_compress_typesafe(*p, state); } #endif |