From 94dd3a569c541be760355e63d44e4b257374220b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 13 Apr 2025 01:22:34 +0900 Subject: [PATCH] event-util: use DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR() to define event_source_hash_ops Currently, the hash_ops is only used by set, so this does not change anything. But, there are several benefits, - we can drop cast in the definition, - the hash_ops can be also used by hashmap. --- src/libsystemd/sd-event/event-util.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libsystemd/sd-event/event-util.c b/src/libsystemd/sd-event/event-util.c index d4e986fc491..d7f15882c8f 100644 --- a/src/libsystemd/sd-event/event-util.c +++ b/src/libsystemd/sd-event/event-util.c @@ -12,12 +12,10 @@ #define SI_FLAG_FORWARD (INT32_C(1) << 30) #define SI_FLAG_POSITIVE (INT32_C(1) << 29) -DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR( +DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR( event_source_hash_ops, - sd_event_source, - (void (*)(const sd_event_source*, struct siphash*)) trivial_hash_func, - (int (*)(const sd_event_source*, const sd_event_source*)) trivial_compare_func, - sd_event_source_disable_unref); + void, trivial_hash_func, trivial_compare_func, + sd_event_source, sd_event_source_disable_unref); int event_reset_time( sd_event *e, -- 2.47.3