summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-11-28 12:35:49 +0100
committerSven Eden <yamakuzure@gmx.net>2017-11-28 12:35:49 +0100
commit6c66e1744f4b338d6b2f003920356d63bc6259f3 (patch)
treef29ad59ac6bf74b0a3c6fe3675e3525d7ee557af /src/shared
parent84dc26bac24fa3a916147d375d28f8bc41e7b3b5 (diff)
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/shared')
-rw-r--r--src/shared/bus-util.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 0fb28c24d..81e1db34f 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -555,12 +555,7 @@ int bus_verify_polkit_async(
void bus_verify_polkit_async_registry_free(Hashmap *registry) {
#if ENABLE_POLKIT
- AsyncPolkitQuery *q;
-
- while ((q = hashmap_steal_first(registry)))
- async_polkit_query_free(q);
-
- hashmap_free(registry);
+ hashmap_free_with_destructor(registry, async_polkit_query_free);
#endif
}