2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
27 #include "reentrant-list.h"
34 static GSList *working_list = NULL; /* of Iteration */
37 * deletes an element from the list - in a re-entrant
38 * safe fashion; advances the element pointer to the next
42 spi_re_entrant_list_delete_link (GList * const *element_ptr)
48 GList *dummy; /* suppress warning */
50 g_return_if_fail (element_ptr != NULL);
52 element = *element_ptr;
53 g_return_if_fail (element != NULL);
56 first_item = (element->prev == NULL);
58 dummy = g_list_remove_link (NULL, element);
60 for (l = working_list; l; l = l->next)
62 Iteration *i = l->data;
64 if (i->iterator == element)
69 if (first_item && *(i->list) == element)
75 g_list_free_1 (element);
79 spi_re_entrant_list_foreach (GList **list,
93 working_list = g_slist_prepend (working_list, &i);
96 GList *l = i.iterator;
98 func (&i.iterator, user_data);
101 i.iterator = i.iterator->next;
104 working_list = g_slist_remove (working_list, &i);