[Mesa-dev] [RFC 2/3] util: add LIST_MOVE_TAIL to list.h
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Jun 2 13:15:03 PDT 2015
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/util/list.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/util/list.h b/src/util/list.h
index fb566f5..c782ef5 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -116,12 +116,21 @@ static inline void list_validate(struct list_head *list)
assert(node->next->prev == node && node->prev->next == node);
}
+static inline void list_move_tail(struct list_head *list,
+ struct list_head *head)
+{
+ list->next->prev = list->prev;
+ list->prev->next = list->next;
+ list_addtail(list, head);
+}
+
#define LIST_INITHEAD(__item) list_inithead(__item)
#define LIST_ADD(__item, __list) list_add(__item, __list)
#define LIST_ADDTAIL(__item, __list) list_addtail(__item, __list)
#define LIST_REPLACE(__from, __to) list_replace(__from, __to)
#define LIST_DEL(__item) list_del(__item)
#define LIST_DELINIT(__item) list_delinit(__item)
+#define LIST_MOVE_TAIL(__list, __head) list_move_tail(__list, __head)
#define LIST_ENTRY(__type, __item, __field) \
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
--
2.4.2
More information about the mesa-dev
mailing list