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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-11-28 21:30:30 +01:00
parent ec1d290903
commit 224b0e7ad0
19 changed files with 106 additions and 114 deletions
+2 -8
View File
@@ -2393,14 +2393,8 @@ int main(int argc, char *argv[]) {
}
finish:
while ((a = ordered_hashmap_steal_first(items)))
item_array_free(a);
while ((a = ordered_hashmap_steal_first(globs)))
item_array_free(a);
ordered_hashmap_free(items);
ordered_hashmap_free(globs);
ordered_hashmap_free_with_destructor(items, item_array_free);
ordered_hashmap_free_with_destructor(globs, item_array_free);
free(arg_include_prefixes);
free(arg_exclude_prefixes);