Added two convenience functions: list_add_item(), list_remove_item().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2566 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -134,6 +134,28 @@ list_get_prev_item(struct list *list, void *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Adds an item to the end of the list.
|
||||||
|
* Similar to list_add_link_to_tail() but works on the item, not the link.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
list_add_item(struct list *list, void *item)
|
||||||
|
{
|
||||||
|
list_add_link_to_tail(list, GET_LINK(list, item));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Removes an item from the list.
|
||||||
|
* Similar to list_remove_link() but works on the item, not the link.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
list_remove_item(struct list *list, void *item)
|
||||||
|
{
|
||||||
|
list_remove_link(GET_LINK(list, item));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Removes the first item in the list and returns it.
|
/** Removes the first item in the list and returns it.
|
||||||
* Returns NULL if the list is empty.
|
* Returns NULL if the list is empty.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user