From 471db48e1a047110ff53a39e5339fe5af98d4b0e Mon Sep 17 00:00:00 2001 From: Jakub Dabek Date: Mon, 3 Sep 2018 16:33:22 +0200 Subject: [PATCH] list: added list_item_del_init Added function that will delete and reinitialize list. Reinitialized lists show up as empty unlike deleted with list_item_del. Signed-off-by: Jakub Dabek --- src/include/sof/list.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/include/sof/list.h b/src/include/sof/list.h index 15bb266002b5..3174377ee19e 100644 --- a/src/include/sof/list.h +++ b/src/include/sof/list.h @@ -72,13 +72,24 @@ static inline void list_item_append(struct list_item *item, list->prev = item; } -/* delete item from the list */ +/* delete item from the list leaves deleted list item + *in undefined state list_is_empty won't return true + */ static inline void list_item_del(struct list_item *item) { item->next->prev = item->prev; item->prev->next = item->next; } +/* delete item from the list list iteam will be reinitialised + * and list_is_empty will return true + */ +static inline void list_item_del_init(struct list_item *item) +{ + list_item_del(item); + list_init(item); +} + /* is list item the last item in list ? */ static inline int list_item_is_last(struct list_item *item, struct list_item *list)