Merge pull request #303 from dabekjakub/list_delete

list: added list_item_del_init
This commit is contained in:
Liam Girdwood 2018-09-03 19:32:08 +01:00 committed by GitHub
commit 4c0b1d4712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)