diff options
Diffstat (limited to 'lib/hash.c')
| -rw-r--r-- | lib/hash.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/hash.c b/lib/hash.c index 97a77a2b9a..df56243985 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -297,6 +297,16 @@ void hash_clean(struct hash *hash, void (*free_func)(void *)) hash->stats.empty = hash->size; } +void hash_clean_and_free(struct hash **hash, void (*free_func)(void *)) +{ + if (!*hash) + return; + + hash_clean(*hash, free_func); + hash_free(*hash); + *hash = NULL; +} + static void hash_to_list_iter(struct hash_bucket *hb, void *arg) { struct list *list = arg; |
