diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-11-28 12:37:14 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-11-28 21:34:34 +0100 |
commit | 39ab16e3970cfce48a9b72125cd9be7afe1e3a8e (patch) | |
tree | 8ed348799ac92d40b5631e9f761f2789b83b4923 /src/coredump/coredump-vacuum.c | |
parent | e85b096b439306b95869c3ae10b6e6761cbf6eca (diff) | |
download | systemd-39ab16e3970cfce48a9b72125cd9be7afe1e3a8e.tar.gz |
coredump: fix typo and use hashmap_free_with_destructor
Diffstat (limited to 'src/coredump/coredump-vacuum.c')
-rw-r--r-- | src/coredump/coredump-vacuum.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c index 5a9b7f38e7..aede180b43 100644 --- a/src/coredump/coredump-vacuum.c +++ b/src/coredump/coredump-vacuum.c @@ -52,16 +52,11 @@ static void vacuum_candidate_free(struct vacuum_candidate *c) { DEFINE_TRIVIAL_CLEANUP_FUNC(struct vacuum_candidate*, vacuum_candidate_free); -static void vacuum_candidate_hasmap_free(Hashmap *h) { - struct vacuum_candidate *c; - - while ((c = hashmap_steal_first(h))) - vacuum_candidate_free(c); - - hashmap_free(h); +static void vacuum_candidate_hashmap_free(Hashmap *h) { + hashmap_free_with_destructor(h, vacuum_candidate_free); } -DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, vacuum_candidate_hasmap_free); +DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, vacuum_candidate_hashmap_free); static int uid_from_file_name(const char *filename, uid_t *uid) { const char *p, *e, *u; @@ -160,7 +155,7 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) { } for (;;) { - _cleanup_(vacuum_candidate_hasmap_freep) Hashmap *h = NULL; + _cleanup_(vacuum_candidate_hashmap_freep) Hashmap *h = NULL; struct vacuum_candidate *worst = NULL; struct dirent *de; uint64_t sum = 0; |