read all the available events at once
[dana/dcompmgr.git] / list.c
diff --git a/list.c b/list.c
index 83ae21e..2557bc9 100644 (file)
--- a/list.c
+++ b/list.c
@@ -116,6 +116,13 @@ list_move_before(d_list_t *list, d_list_it_t *move, d_list_it_t *before)
     if (!move->prev) list->top = move;
 }
 
+void
+list_remove(d_list_t *list, void *data)
+{
+    d_list_it_t *it = list_find(list, data);
+    if (it) list_delete_link(list, it);
+}
+
 int
 list_length(d_list_t *list)
 {
@@ -148,3 +155,13 @@ list_nth(d_list_t *list, int n)
         it = it->next;
     return it;
 }
+
+d_list_it_t*
+list_find(d_list_t *list, void *data)
+{
+    d_list_it_t *it;
+
+    for (it = list->top; it; it = it->next)
+        if (it->data == data) return it;
+    return NULL;
+}