Skip to content

Commit bf86d8e

Browse files
author
Jakub Dabek
committed
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 <jakub.dabek@linux.intel.com>
1 parent f34116d commit bf86d8e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/include/sof/list.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,24 @@ static inline void list_item_append(struct list_item *item,
7272
list->prev = item;
7373
}
7474

75-
/* delete item from the list */
75+
/* delete item from the list leaves deleted list item
76+
*in undefined state list_is_empty won't return true
77+
*/
7678
static inline void list_item_del(struct list_item *item)
7779
{
7880
item->next->prev = item->prev;
7981
item->prev->next = item->next;
8082
}
8183

84+
/* delete item from the list list iteam will be reinitialised
85+
* and list_is_empty will return true
86+
*/
87+
static inline void list_item_del_init(struct list_item *item)
88+
{
89+
list_item_del(item);
90+
list_init(item);
91+
}
92+
8293
/* is list item the last item in list ? */
8394
static inline int list_item_is_last(struct list_item *item,
8495
struct list_item *list)

0 commit comments

Comments
 (0)