When doing remove_last on a dlist, use the ->previous property well!
authorSebastian Dransfeld <sd@tango.flipp.net>
Sat, 13 Jan 2007 17:49:15 +0000 (17:49 +0000)
committerSebastian Dransfeld <sd@tango.flipp.net>
Sat, 13 Jan 2007 17:49:15 +0000 (17:49 +0000)
SVN revision: 27948

legacy/ecore/src/lib/ecore/ecore_list.c

index 7de969f..6cfc1de 100644 (file)
@@ -1431,10 +1431,28 @@ EAPI void *
 ecore_dlist_remove_last(Ecore_DList *list)
 {
    void *ret;
+   Ecore_List_Node *node;
 
    CHECK_PARAM_POINTER_RETURN("list", list, NULL);
 
-   ret = _ecore_list_remove_last(list);
+   if (ecore_list_is_empty(list))
+     return NULL;
+
+   node = list->last;
+   list->last = ECORE_LIST_NODE(ECORE_DLIST_NODE(node)->previous);
+   if (list->last)
+     list->last->next = NULL;
+   if (list->first == node)
+     list->first = NULL;
+   if (list->current == node)
+     list->current = NULL;
+
+   ret = node->data;
+   ecore_list_node_destroy(node, NULL);
+
+   list->nodes--;
+   if (list->index >= list->nodes)
+     list->index--;
 
    return ret;
 }