diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-11-28 12:35:49 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-11-28 21:30:30 +0100 |
commit | 224b0e7ad0116579f830b7dd387b97c3facb65d9 (patch) | |
tree | d769049843011ec955d86af31e2f0d62c4521f38 /src/busctl | |
parent | ec1d290903538df3183dac2771b5db429b6f7688 (diff) | |
download | systemd-224b0e7ad0116579f830b7dd387b97c3facb65d9.tar.gz systemd-224b0e7ad0116579f830b7dd387b97c3facb65d9.tar.bz2 systemd-224b0e7ad0116579f830b7dd387b97c3facb65d9.zip |
Add set/hashmap helpers for non-trivial freeing and use where straighforward
A macro is needed because otherwise we couldn't ensure type safety.
Some simple tests are included.
No functional change intended.
Diffstat (limited to 'src/busctl')
-rw-r--r-- | src/busctl/busctl.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index 3b2b5f3fc2..44110b63f9 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -692,12 +692,7 @@ static void member_free(Member *m) { DEFINE_TRIVIAL_CLEANUP_FUNC(Member*, member_free); static void member_set_free(Set *s) { - Member *m; - - while ((m = set_steal_first(s))) - member_free(m); - - set_free(s); + set_free_with_destructor(s, member_free); } DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, member_set_free); |