diff -r e8619defde14 -r 27c7511c0e34 src/server/ucx/dlist.c --- a/src/server/ucx/dlist.c Wed May 16 12:47:28 2012 +0200 +++ b/src/server/ucx/dlist.c Thu May 24 12:51:52 2012 +0200 @@ -45,6 +45,7 @@ nl->data = data; nl->next = NULL; if (l == NULL) { + nl->prev = NULL; return nl; } else { UcxDlist *t = ucx_dlist_last(l); @@ -111,14 +112,6 @@ return s; } -void ucx_dlist_foreach(UcxDlist *l, ucx_callback fnc, void* data) { - UcxDlist *e = l; - while (e != NULL) { - fnc(e, data); - e = e->next; - } -} - /* dlist specific functions */ UcxDlist *ucx_dlist_first(UcxDlist *l) { if (l == NULL) return NULL; @@ -129,3 +122,20 @@ } return e; } + +UcxDlist *ucx_dlist_remove(UcxDlist *l, UcxDlist *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; + e->next->prev = e->prev; + } + free(e); + return l; +}