diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-08 12:36:31 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-08 12:36:31 -0700 |
| commit | 4a4656d0832ba14b2a41e5feba70fb388216f4f8 (patch) | |
| tree | 7de431a5a5c9ecf1189b3bf5f142e1e346935be7 | |
| parent | 6f84262c44a89851c3ae5a6e4c1a9d06b2068d75 (diff) | |
| parent | 9481877de342425ea1d3cd10f7a212e99d4e2670 (diff) | |
| download | git-4a4656d0832ba14b2a41e5feba70fb388216f4f8.tar.gz | |
Merge branch 'en/hashmap-clear-fix'
hashmap API clean-up to ensure hashmap_clear() leaves a cleared map
in a reusable state.
* en/hashmap-clear-fix:
hashmap: ensure hashmaps are reusable after hashmap_clear()
| -rw-r--r-- | hashmap.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -205,8 +205,9 @@ void hashmap_clear_(struct hashmap *map, ssize_t entry_offset) return; if (entry_offset >= 0) /* called by hashmap_clear_and_free */ free_individual_entries(map, entry_offset); - free(map->table); - memset(map, 0, sizeof(*map)); + FREE_AND_NULL(map->table); + map->tablesize = 0; + map->private_size = 0; } struct hashmap_entry *hashmap_get(const struct hashmap *map, |
