summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index 9cb775b..fd9db77 100644
--- a/utils.h
+++ b/utils.h
@@ -30,6 +30,15 @@ static inline void list_add(struct list_head *new, struct list_head *list)
list->next = new;
}
+static inline void list_replace(struct list_head *old, struct list_head *new)
+{
+ old->prev->next = new;
+ old->next->prev = new;
+ new->next = old->next;
+ new->prev = old->prev;
+ old->next = old->prev = NULL;
+}
+
static inline bool list_empty(struct list_head *list)
{
return list->next == list;