| 29 | } |
| 30 | |
| 31 | void oidmap_clear_with_free(struct oidmap *map, |
| 32 | oidmap_free_fn free_fn) |
| 33 | { |
| 34 | struct hashmap_iter iter; |
| 35 | struct hashmap_entry *e; |
| 36 | |
| 37 | if (!map || !map->map.cmpfn) |
| 38 | return; |
| 39 | |
| 40 | hashmap_iter_init(&map->map, &iter); |
| 41 | while ((e = hashmap_iter_next(&iter))) { |
| 42 | struct oidmap_entry *entry = |
| 43 | container_of(e, struct oidmap_entry, internal_entry); |
| 44 | if (free_fn) |
| 45 | free_fn(entry); |
| 46 | } |
| 47 | |
| 48 | hashmap_clear(&map->map); |
| 49 | } |
| 50 | |
| 51 | void *oidmap_get(const struct oidmap *map, const struct object_id *key) |
| 52 | { |