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>
This commit is contained in:
Jakub Dabek 2018-09-03 16:33:22 +02:00
parent 6af5984cb9
commit 471db48e1a
1 changed files with 12 additions and 1 deletions

View File

@ -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)