From 878c4156afe9aba0bc70767c75ef30ac0cffcc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 26 Jan 2003 23:30:53 +0000 Subject: [PATCH] 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 --- src/kernel/core/list.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/kernel/core/list.c b/src/kernel/core/list.c index c061df2afb..9c13093fef 100644 --- a/src/kernel/core/list.c +++ b/src/kernel/core/list.c @@ -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. * Returns NULL if the list is empty. */