]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
event-util: use DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR() to define event_source_hash_ops
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Apr 2025 16:22:34 +0000 (01:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Apr 2025 19:28:35 +0000 (04:28 +0900)
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

index d4e986fc49105ccfe0748c2c4c5ed24da974439d..d7f15882c8f8f65df5c97ce2522433a56ea374f6 100644 (file)
 #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,