-/* Return a pointer to the first inferior in LIST, or NULL if there isn't one.
- This is for cases where the caller needs a thread, but doesn't care
- which one. */
-
-struct inferior_list_entry *
-get_first_inferior (struct inferior_list *list)
-{
- if (list->head != NULL)
- return list->head;
- return NULL;
-}
-
-/* Find the first inferior_list_entry E in LIST for which FUNC (E, ARG)
- returns non-zero. If no entry is found then return NULL. */
-
-struct inferior_list_entry *
-find_inferior (struct inferior_list *list,
- int (*func) (struct inferior_list_entry *, void *), void *arg)
-{
- struct inferior_list_entry *inf = list->head;
-
- while (inf != NULL)
- {
- struct inferior_list_entry *next;
-
- next = inf->next;
- if ((*func) (inf, arg))
- return inf;
- inf = next;
- }
-
- return NULL;
-}
-
-/* Find the random inferior_list_entry E in LIST for which FUNC (E, ARG)
- returns non-zero. If no entry is found then return NULL. */
-
-struct inferior_list_entry *
-find_inferior_in_random (struct inferior_list *list,
- int (*func) (struct inferior_list_entry *, void *),
- void *arg)
-{
- struct inferior_list_entry *inf = list->head;
- int count = 0;
- int random_selector;
-
- /* First count how many interesting entries we have. */
- while (inf != NULL)
- {
- struct inferior_list_entry *next;
-
- next = inf->next;
- if ((*func) (inf, arg))
- count++;
- inf = next;
- }
-
- if (count == 0)
- return NULL;
-
- /* Now randomly pick an entry out of those. */
- random_selector = (int)
- ((count * (double) rand ()) / (RAND_MAX + 1.0));
-
- inf = list->head;
- while (inf != NULL)
- {
- struct inferior_list_entry *next;
-
- next = inf->next;
- if ((*func) (inf, arg) && (random_selector-- == 0))
- return inf;
- inf = next;
- }
-
- gdb_assert_not_reached ("failed to find an inferior in random.");
- return NULL;
-}
-
-struct inferior_list_entry *
-find_inferior_id (struct inferior_list *list, ptid_t id)
-{
- struct inferior_list_entry *inf = list->head;
-
- while (inf != NULL)
- {
- if (ptid_equal (inf->id, id))
- return inf;
- inf = inf->next;
- }
-
- return NULL;
-}
-