machine-image: convert image_hashmap_free() to an static inline helper

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-11-28 21:30:43 +01:00
parent 224b0e7ad0
commit e85b096b43
2 changed files with 3 additions and 10 deletions
-9
View File
@@ -457,15 +457,6 @@ int image_discover(Hashmap *h) {
return 0;
}
void image_hashmap_free(Hashmap *map) {
Image *i;
while ((i = hashmap_steal_first(map)))
image_unref(i);
hashmap_free(map);
}
int image_remove(Image *i) {
_cleanup_release_lock_file_ LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
_cleanup_strv_free_ char **settings = NULL;
+3 -1
View File
@@ -64,7 +64,9 @@ typedef struct Image {
} Image;
Image *image_unref(Image *i);
void image_hashmap_free(Hashmap *map);
static inline Hashmap* image_hashmap_free(Hashmap *map) {
return hashmap_free_with_destructor(map, image_unref);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(Image*, image_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, image_hashmap_free);