+/* Return the next file handler to handle, and advance to the next
+ file handler, wrapping around if the end of the list is
+ reached. */
+
+static file_handler *
+get_next_file_handler_to_handle_and_advance (void)
+{
+ file_handler *curr_next;
+
+ /* The first time around, this is still NULL. */
+ if (gdb_notifier.next_file_handler == NULL)
+ gdb_notifier.next_file_handler = gdb_notifier.first_file_handler;
+
+ curr_next = gdb_notifier.next_file_handler;
+ gdb_assert (curr_next != NULL);
+
+ /* Advance. */
+ gdb_notifier.next_file_handler = curr_next->next_file;
+ /* Wrap around, if necessary. */
+ if (gdb_notifier.next_file_handler == NULL)
+ gdb_notifier.next_file_handler = gdb_notifier.first_file_handler;
+
+ return curr_next;
+}
+