portable: release 0.93
[got-portable.git] / lib / got_lib_object_idset.h
blob750be4962021434fb27d2dcc95867ff2e333a776
1 /*
2 * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 * Copyright (c) 2019 Ori Bernstein <stsp@openbsd.org>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 struct got_object_idset;
20 struct got_object_idset *got_object_idset_alloc(void);
21 void got_object_idset_free(struct got_object_idset *);
23 const struct got_error *got_object_idset_add(struct got_object_idset *,
24 struct got_object_id *, void *);
25 void *got_object_idset_get(struct got_object_idset *, struct got_object_id *);
26 const struct got_error *got_object_idset_remove(void **,
27 struct got_object_idset *, struct got_object_id *);
28 int got_object_idset_contains(struct got_object_idset *,
29 struct got_object_id *);
30 const struct got_error *got_object_idset_for_each(struct got_object_idset *,
31 const struct got_error *(*cb)(struct got_object_id *, void *, void *),
32 void *);
33 int got_object_idset_num_elements(struct got_object_idset *);