ucx/list.c

changeset 29
c96169444d88
parent 0
1f419bd32da1
child 124
80609f9675f1
--- a/ucx/list.c	Sun Apr 06 13:21:37 2014 +0200
+++ b/ucx/list.c	Thu Apr 10 11:37:41 2014 +0200
@@ -304,18 +304,18 @@
 }
     
 UcxList *ucx_list_remove_a(UcxAllocator *alloc, UcxList *l, UcxList *e) {
-    if (e->prev == NULL) {
-        if(e->next != NULL) {
-            e->next->prev = NULL;
-            l = e->next;
-        } else {
-            l = NULL;
-        }
-        
-    } else {
-        e->prev->next = e->next;
+    if (l == e) {
+        l = e->next;
+    }
+    
+    if (e->next) {
         e->next->prev = e->prev;
     }
+    
+    if (e->prev) {
+        e->prev->next = e->next;
+    }
+    
     alloc->free(alloc->pool, e);
     return l;
 }

mercurial