remove unused got_object_idset_remove_random()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/lib/got_lib_object_idset.h b/lib/got_lib_object_idset.h
index 7d98296..a64e2b7 100644
--- a/lib/got_lib_object_idset.h
+++ b/lib/got_lib_object_idset.h
@@ -24,8 +24,6 @@ const struct got_error *got_object_idset_add(void **,
void *got_object_idset_get(struct got_object_idset *, struct got_object_id *);
const struct got_error *got_object_idset_remove(void **,
struct got_object_idset *, struct got_object_id *);
-const struct got_error *got_object_idset_remove_random(void **,
- struct got_object_idset *);
int got_object_idset_contains(struct got_object_idset *,
struct got_object_id *);
void got_object_idset_for_each(struct got_object_idset *,
diff --git a/lib/object_idset.c b/lib/object_idset.c
index 5603540..75d0573 100644
--- a/lib/object_idset.c
+++ b/lib/object_idset.c
@@ -193,49 +193,6 @@ got_object_idset_remove(void **data, struct got_object_idset *set,
return got_error(GOT_ERR_NO_OBJ);
}
-const struct got_error *
-got_object_idset_remove_random(void **data, struct got_object_idset *set)
-{
- struct got_object_idset_element *entry, *tmp;
- int i, n, totelem;
-
- if (data)
- *data = NULL;
-
- if (set->totelem == 0)
- return got_error(GOT_ERR_NO_OBJ);
-
- /* Pick a random element index across all lists. */
- if (set->totelem == 1)
- n = 0;
- else
- n = arc4random_uniform(set->totelem);
-
- totelem = 0;
- for (i = 0; i < nitems(set->entries); i++) {
- /* Skip lists which don't contain the element we picked. */
- totelem += set->nelem[i];
- if (totelem == 0 || n > totelem - 1) {
- n -= set->nelem[i];
- continue;
- }
- TAILQ_FOREACH_SAFE(entry, &set->entries[i], entry, tmp) {
- if (n == 0) {
- TAILQ_REMOVE(&set->entries[i], entry, entry);
- if (data)
- *data = entry->data;
- free(entry);
- set->nelem[i]--;
- set->totelem--;
- return NULL;
- }
- n--;
- }
- }
-
- return got_error(GOT_ERR_NO_OBJ);
-}
-
int
got_object_idset_contains(struct got_object_idset *set,
struct got_object_id *id)