/* Returns: either @list or the new start of the #GList if @list was NULL  */
GList* g_list_append(GList *list, gpointer data)
/* Returns: either @list or the new start of the #GList if @list was NULL  */
GList* g_list_append(GList *list, gpointer data)
{
  GList *new_list;
  GList *last;
  new_list = _g_list_alloc ();
  new_list->data = data;
  new_list->next = NULL;
  if (list)
    {
      last = g_list_last (list);
      last->next = new_list;
      new_list->prev = last;
      return list;
    }
  else
    {
      new_list->prev = NULL;
      return new_list;
    }
}