]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
busctl: set destructor to member_hash_ops
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Apr 2025 03:18:40 +0000 (12:18 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Apr 2025 03:23:13 +0000 (12:23 +0900)
Then, we can drop the custom destructor of 'Set *mmebers'.

src/busctl/busctl.c

index 557a4571f216cf1d27c67c3440e9517ef6caab49..9a9f98c8081a99ded3f3c778eabc3ee9615d7815 100644 (file)
@@ -808,11 +808,6 @@ static Member* member_free(Member *m) {
 }
 DEFINE_TRIVIAL_CLEANUP_FUNC(Member*, member_free);
 
-static Set* member_set_free(Set *s) {
-        return set_free_with_destructor(s, member_free);
-}
-DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, member_set_free);
-
 static int on_interface(const char *interface, uint64_t flags, void *userdata) {
         _cleanup_(member_freep) Member *m = NULL;
         Set *members = ASSERT_PTR(userdata);
@@ -969,7 +964,12 @@ static int on_property(const char *interface, const char *name, const char *sign
         return 0;
 }
 
-DEFINE_PRIVATE_HASH_OPS(member_hash_ops, Member, member_hash_func, member_compare_func);
+DEFINE_PRIVATE_HASH_OPS_WITH_KEY_DESTRUCTOR(
+                member_hash_ops,
+                Member,
+                member_hash_func,
+                member_compare_func,
+                member_free);
 
 static int introspect(int argc, char **argv, void *userdata) {
         static const XMLIntrospectOps ops = {
@@ -982,7 +982,7 @@ static int introspect(int argc, char **argv, void *userdata) {
         _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply_xml = NULL;
         _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_(member_set_freep) Set *members = NULL;
+        _cleanup_set_free_ Set *members = NULL;
         unsigned name_width, type_width, signature_width, result_width;
         Member *m;
         const char *xml;