]>
git.ipfire.org Git - thirdparty/git.git/blob - oidset.c
4 int oidset_contains(const struct oidset
*set
, const struct object_id
*oid
)
6 if (!set
->map
.map
.tablesize
)
8 return !!oidmap_get(&set
->map
, oid
);
11 int oidset_insert(struct oidset
*set
, const struct object_id
*oid
)
13 struct oidmap_entry
*entry
;
15 if (!set
->map
.map
.tablesize
)
16 oidmap_init(&set
->map
, 0);
17 else if (oidset_contains(set
, oid
))
20 entry
= xmalloc(sizeof(*entry
));
21 oidcpy(&entry
->oid
, oid
);
23 oidmap_put(&set
->map
, entry
);
27 int oidset_remove(struct oidset
*set
, const struct object_id
*oid
)
29 struct oidmap_entry
*entry
;
31 entry
= oidmap_remove(&set
->map
, oid
);
34 return (entry
!= NULL
);
37 void oidset_clear(struct oidset
*set
)
39 oidmap_free(&set
->map
, 1);