/* Returns: the (possibly changed) start of the #GList  */
GList* g_list_remove_all(GList *list, gconstpointer data)
/* Returns: the (possibly changed) start of the #GList  */
GList* g_list_remove_all(GList *list, gconstpointer data)
{
  GList *tmp = list;
  while (tmp)
    {
      if (tmp->data != data)
        tmp = tmp->next;
      else
        {
          GList *next = tmp->next;
          if (tmp->prev)
            tmp->prev->next = next;
          else
            list = next;
          if (next)
            next->prev = tmp->prev;
          _g_list_free1 (tmp);
          tmp = next;
        }
    }
  return list;
}