Git fork

oidmap: rename oidmap_free() to oidmap_clear()

This function does not free the oidmap struct itself; it just drops all
items from the map (using hashmap_clear_() internally). It should be
called oidmap_clear(), per CodingGuidelines.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Jeff King and committed by
Junio C Hamano
27446468 7a1d2bd0

+10 -9
+1 -1
builtin/rev-list.c
··· 924 924 free((void *)entry->path); 925 925 } 926 926 927 - oidmap_free(&missing_objects, true); 927 + oidmap_clear(&missing_objects, true); 928 928 } 929 929 930 930 stop_progress(&progress);
+1 -1
list-objects-filter.c
··· 244 244 struct filter_trees_depth_data *d = filter_data; 245 245 if (!d) 246 246 return; 247 - oidmap_free(&d->seen_at_depth, 1); 247 + oidmap_clear(&d->seen_at_depth, 1); 248 248 free(d); 249 249 } 250 250
+1 -1
object-store.c
··· 1017 1017 { 1018 1018 FREE_AND_NULL(o->alternate_db); 1019 1019 1020 - oidmap_free(o->replace_map, 1); 1020 + oidmap_clear(o->replace_map, 1); 1021 1021 FREE_AND_NULL(o->replace_map); 1022 1022 pthread_mutex_destroy(&o->replace_mutex); 1023 1023
+1 -1
oidmap.c
··· 22 22 hashmap_init(&map->map, oidmap_neq, NULL, initial_size); 23 23 } 24 24 25 - void oidmap_free(struct oidmap *map, int free_entries) 25 + void oidmap_clear(struct oidmap *map, int free_entries) 26 26 { 27 27 if (!map) 28 28 return;
+3 -2
oidmap.h
··· 36 36 void oidmap_init(struct oidmap *map, size_t initial_size); 37 37 38 38 /* 39 - * Frees an oidmap structure and allocated memory. 39 + * Clear an oidmap, freeing any allocated memory. The map is empty and 40 + * can be reused without another explicit init. 40 41 * 41 42 * If `free_entries` is true, each oidmap_entry in the map is freed as well 42 43 * using stdlibs free(). 43 44 */ 44 - void oidmap_free(struct oidmap *map, int free_entries); 45 + void oidmap_clear(struct oidmap *map, int free_entries); 45 46 46 47 /* 47 48 * Returns the oidmap entry for the specified oid, or NULL if not found.
+2 -2
sequencer.c
··· 6053 6053 oidset_clear(&interesting); 6054 6054 oidset_clear(&child_seen); 6055 6055 oidset_clear(&shown); 6056 - oidmap_free(&commit2todo, 1); 6057 - oidmap_free(&state.commit2label, 1); 6056 + oidmap_clear(&commit2todo, 1); 6057 + oidmap_clear(&state.commit2label, 1); 6058 6058 hashmap_clear_and_free(&state.labels, struct labels_entry, entry); 6059 6059 strbuf_release(&state.buf); 6060 6060
+1 -1
t/unit-tests/u-oidmap.c
··· 35 35 36 36 void test_oidmap__cleanup(void) 37 37 { 38 - oidmap_free(&map, 1); 38 + oidmap_clear(&map, 1); 39 39 } 40 40 41 41 void test_oidmap__replace(void)