2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #include <glib/gmessages.h>
24 #include <glib/gslist.h>
26 #include "spi-private.h"
33 static GSList *working_list = NULL; /* of Iteration */
36 * deletes an element from the list - in a re-entrant
37 * safe fashion; advances the element pointer to the next
41 spi_re_entrant_list_delete_link (GList * const *element_ptr)
48 g_return_if_fail (element_ptr != NULL);
50 element = *element_ptr;
51 g_return_if_fail (element != NULL);
54 first_item = (element->prev == NULL);
56 g_list_remove_link (NULL, element);
58 for (l = working_list; l; l = l->next)
60 Iteration *i = l->data;
62 if (i->iterator == element)
67 if (first_item && *(i->list) == element)
73 g_list_free_1 (element);
77 spi_re_entrant_list_foreach (GList **list,
91 working_list = g_slist_prepend (working_list, &i);
94 GList *l = i.iterator;
96 func (&i.iterator, user_data);
99 i.iterator = i.iterator->next;
102 working_list = g_slist_remove (working_list, &i);