Add helper function for delete and reinitialize list element.
Signed-off-by: Zbigniew Kempczyński <redacted>
Cc: Petri Latvala <redacted>
Cc: Chris Wilson <redacted>
---
lib/igt_list.c | 6 ++++++
lib/igt_list.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/lib/igt_list.c b/lib/igt_list.c
index 5e30b19b6..37ae139c4 100644
--- a/lib/igt_list.c
+++ b/lib/igt_list.c
@@ -46,6 +46,12 @@ void igt_list_del(struct igt_list_head *elem)
elem->prev = NULL;
}
+void igt_list_del_init(struct igt_list_head *elem)
+{
+ igt_list_del(elem);
+ IGT_INIT_LIST_HEAD(elem);
+}
+
void igt_list_move(struct igt_list_head *elem, struct igt_list_head *list)
{
igt_list_del(elem);diff --git a/lib/igt_list.h b/lib/igt_list.h
index dbf5f802c..cc93d7a0d 100644
--- a/lib/igt_list.h
+++ b/lib/igt_list.h
@@ -75,6 +75,7 @@ struct igt_list_head {
void IGT_INIT_LIST_HEAD(struct igt_list_head *head);
void igt_list_add(struct igt_list_head *elem, struct igt_list_head *head);
void igt_list_del(struct igt_list_head *elem);
+void igt_list_del_init(struct igt_list_head *elem);
void igt_list_move(struct igt_list_head *elem, struct igt_list_head *list);
void igt_list_move_tail(struct igt_list_head *elem, struct igt_list_head *list);
int igt_list_length(const struct igt_list_head *head);--
2.26.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev