free((void *)entry->path);
}
- oidmap_free(&missing_objects, true);
+ oidmap_clear(&missing_objects, true);
}
stop_progress(&progress);
struct filter_trees_depth_data *d = filter_data;
if (!d)
return;
- oidmap_free(&d->seen_at_depth, 1);
+ oidmap_clear(&d->seen_at_depth, 1);
free(d);
}
{
FREE_AND_NULL(o->alternate_db);
- oidmap_free(o->replace_map, 1);
+ oidmap_clear(o->replace_map, 1);
FREE_AND_NULL(o->replace_map);
pthread_mutex_destroy(&o->replace_mutex);
hashmap_init(&map->map, oidmap_neq, NULL, initial_size);
}
-void oidmap_free(struct oidmap *map, int free_entries)
+void oidmap_clear(struct oidmap *map, int free_entries)
{
if (!map)
return;
void oidmap_init(struct oidmap *map, size_t initial_size);
/*
- * Frees an oidmap structure and allocated memory.
+ * Clear an oidmap, freeing any allocated memory. The map is empty and
+ * can be reused without another explicit init.
*
* If `free_entries` is true, each oidmap_entry in the map is freed as well
* using stdlibs free().
*/
-void oidmap_free(struct oidmap *map, int free_entries);
+void oidmap_clear(struct oidmap *map, int free_entries);
/*
* Returns the oidmap entry for the specified oid, or NULL if not found.
oidset_clear(&interesting);
oidset_clear(&child_seen);
oidset_clear(&shown);
- oidmap_free(&commit2todo, 1);
- oidmap_free(&state.commit2label, 1);
+ oidmap_clear(&commit2todo, 1);
+ oidmap_clear(&state.commit2label, 1);
hashmap_clear_and_free(&state.labels, struct labels_entry, entry);
strbuf_release(&state.buf);
void test_oidmap__cleanup(void)
{
- oidmap_free(&map, 1);
+ oidmap_clear(&map, 1);
}
void test_oidmap__replace(void)