commit d1bdc6c0d2c7fafc7a076ba65a6e381f7bafb776
parent 5375d415a2b2b47fa9288fcf759ff17abdf30c39
Author: oblique <psyberbits@gmail.com>
Date: Wed, 31 Oct 2012 23:55:03 +0200
add list_move_tail()
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/list.h b/include/list.h
@@ -53,21 +53,28 @@ list_del(struct list_head *entry)
static inline void
list_add(struct list_head *entry, struct list_head *head)
{
- head->next->prev = entry;
entry->next = head->next;
entry->prev = head;
+ head->next->prev = entry;
head->next = entry;
}
static inline void
list_add_tail(struct list_head *entry, struct list_head *head)
{
- head->prev->next = entry;
entry->next = head;
entry->prev = head->prev;
+ head->prev->next = entry;
head->prev = entry;
}
+static inline void
+list_move_tail(struct list_head *entry, struct list_head *head)
+{
+ list_del(entry);
+ list_add_tail(entry, head);
+}
+
static inline int
list_empty(const struct list_head *head)
{