summaryrefslogtreecommitdiff
path: root/oidset.c
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2017-11-21 20:58:49 +0000
committerJunio C Hamano <gitster@pobox.com>2017-11-22 14:11:56 +0900
commitc3a9ad311793e16f6f5c5dcc3559133700c70288 (patch)
tree43562a397e500c26e455411a946cfcb94fea3e18 /oidset.c
parent314f354ee77892664f49b4b44d2052df139ece7e (diff)
downloadgit-c3a9ad311793e16f6f5c5dcc3559133700c70288.tar.gz
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>
Diffstat (limited to 'oidset.c')
-rw-r--r--oidset.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/oidset.c b/oidset.c
index f1f874aaad..454c54f933 100644
--- a/oidset.c
+++ b/oidset.c
@@ -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);