···55#include "object.h"
66#include "list.h"
77#include "oidset.h"
88+#include "oidmap.h"
89#include "thread-utils.h"
9101011struct oidmap;
···109110 * Objects that should be substituted by other objects
110111 * (see git-replace(1)).
111112 */
112112- struct oidmap *replace_map;
113113+ struct oidmap replace_map;
113114 unsigned replace_map_initialized : 1;
114115 pthread_mutex_t replace_mutex; /* protect object replace functions */
115116
+1-1
oidmap.c
···2222 hashmap_init(&map->map, oidmap_neq, NULL, initial_size);
2323}
24242525-void oidmap_free(struct oidmap *map, int free_entries)
2525+void oidmap_clear(struct oidmap *map, int free_entries)
2626{
2727 if (!map)
2828 return;
+7-2
oidmap.h
···3636void oidmap_init(struct oidmap *map, size_t initial_size);
37373838/*
3939- * Frees an oidmap structure and allocated memory.
3939+ * Clear an oidmap, freeing any allocated memory. The map is empty and
4040+ * can be reused without another explicit init.
4041 *
4142 * If `free_entries` is true, each oidmap_entry in the map is freed as well
4243 * using stdlibs free().
4344 */
4444-void oidmap_free(struct oidmap *map, int free_entries);
4545+void oidmap_clear(struct oidmap *map, int free_entries);
45464647/*
4748 * Returns the oidmap entry for the specified oid, or NULL if not found.
···6667 */
6768void *oidmap_remove(struct oidmap *map, const struct object_id *key);
68697070+static inline unsigned int oidmap_get_size(struct oidmap *map)
7171+{
7272+ return hashmap_get_size(&map->map);
7373+}
69747075struct oidmap_iter {
7176 struct hashmap_iter h_iter;