summaryrefslogtreecommitdiff
path: root/src/cgtop
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-11-28 12:35:49 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-11-28 21:30:30 +0100
commit224b0e7ad0116579f830b7dd387b97c3facb65d9 (patch)
treed769049843011ec955d86af31e2f0d62c4521f38 /src/cgtop
parentec1d290903538df3183dac2771b5db429b6f7688 (diff)
downloadsystemd-224b0e7ad0116579f830b7dd387b97c3facb65d9.tar.gz
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/cgtop')
-rw-r--r--src/cgtop/cgtop.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 8add7e73e4..fe339eb493 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -105,10 +105,7 @@ static void group_free(Group *g) {
}
static void group_hashmap_clear(Hashmap *h) {
- Group *g;
-
- while ((g = hashmap_steal_first(h)))
- group_free(g);
+ hashmap_clear_with_destructor(h, group_free);
}
static void group_hashmap_free(Hashmap *h) {