hashmap: introduce hashmap_free_entries
`hashmap_free_entries' behaves like `container_of' and passes the offset of the hashmap_entry struct to the internal `hashmap_free_' function, allowing the function to free any struct pointer regardless of where the hashmap_entry field is located. `hashmap_free' no longer takes any arguments aside from the hashmap itself. Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
8a973d0bb3
commit
c8e424c9c9
@ -136,7 +136,7 @@ static void paths_and_oids_clear(struct hashmap *map)
|
||||
free(entry->path);
|
||||
}
|
||||
|
||||
hashmap_free(map, 1);
|
||||
hashmap_free_entries(map, struct path_and_oids_entry, ent);
|
||||
}
|
||||
|
||||
static void paths_and_oids_insert(struct hashmap *map,
|
||||
|
Reference in New Issue
Block a user