Statedump improvements
[libside.git] / src / list.h
index fc9760594531ad22753ab96b86460dc4f9874ca1..5c1c37a522851428703888bae45e41a83e84f7f2 100644 (file)
@@ -8,6 +8,12 @@
 
 #include "list_types.h"
 
+static inline
+void side_list_head_init(struct side_list_head *head)
+{
+       head->node.next = head->node.prev = &head->node;
+}
+
 static inline
 void side_list_insert_node_tail(struct side_list_head *head, struct side_list_node *node)
 {
@@ -33,6 +39,26 @@ void side_list_remove_node(struct side_list_node *node)
        node->prev->next = node->next;
 }
 
+static inline
+bool side_list_empty(struct side_list_head *head)
+{
+       return &head->node == head->node.next;
+}
+
+/*
+ * Splice "from" list at the beginning of "to" list.
+ */
+static inline
+void side_list_splice(struct side_list_head *from, struct side_list_head *to)
+{
+       if (side_list_empty(from))
+               return;
+       from->node.next->prev = &to->node;
+       from->node.prev->next = to->node.next;
+       to->node.next->prev = from->node.prev;
+       to->node.next = from->node.next;
+}
+
 #define side_list_for_each_entry(_entry, _head, _member) \
        for ((_entry) = side_container_of((_head)->node.next, __typeof__(*(_entry)), _member); \
                &(_entry)->_member != &(_head)->node; \
This page took 0.022747 seconds and 4 git commands to generate.