oidset: add iterator methods to oidset

Add the usual iterator methods to oidset.
Add oidset_remove().

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff Hostetler
2017-11-21 20:58:49 +00:00
committed by Junio C Hamano
parent 314f354ee7
commit c3a9ad3117
2 changed files with 46 additions and 0 deletions

View File

@ -24,6 +24,16 @@ int oidset_insert(struct oidset *set, const struct object_id *oid)
return 0;
}
int oidset_remove(struct oidset *set, const struct object_id *oid)
{
struct oidmap_entry *entry;
entry = oidmap_remove(&set->map, oid);
free(entry);
return (entry != NULL);
}
void oidset_clear(struct oidset *set)
{
oidmap_free(&set->map, 1);