Commit 314f354e authored by Jeff Hostetler's avatar Jeff Hostetler Committed by Junio C Hamano

oidmap: add oidmap iterator methods

Add the usual map iterator functions to oidmap.
Signed-off-by: default avatarJeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: default avatarJonathan Tan <jonathantanmy@google.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 578d81d0
......@@ -65,4 +65,26 @@ extern void *oidmap_put(struct oidmap *map, void *entry);
*/
extern void *oidmap_remove(struct oidmap *map, const struct object_id *key);
struct oidmap_iter {
struct hashmap_iter h_iter;
};
static inline void oidmap_iter_init(struct oidmap *map, struct oidmap_iter *iter)
{
hashmap_iter_init(&map->map, &iter->h_iter);
}
static inline void *oidmap_iter_next(struct oidmap_iter *iter)
{
return hashmap_iter_next(&iter->h_iter);
}
static inline void *oidmap_iter_first(struct oidmap *map,
struct oidmap_iter *iter)
{
oidmap_iter_init(map, iter);
return oidmap_iter_next(iter);
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment