Added a list_get_last_item() call - one day we should make most of them inline.

Or use the C++ list implementation where possible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17901 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-06-21 16:13:34 +00:00
parent 0ba0370464
commit f62d3b77aa
2 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,7 @@ extern void list_add_link_to_tail(struct list *list, void *_link);
extern void list_remove_link(void *_link);
extern void *list_get_next_item(struct list *list, void *item);
extern void *list_get_prev_item(struct list *list, void *item);
extern void *list_get_last_item(struct list *list);
extern void list_add_item(struct list *list, void *item);
extern void list_remove_item(struct list *list, void *item);
extern void list_insert_item_before(struct list *list, void *before, void *item);

View File

@ -134,6 +134,13 @@ list_get_prev_item(struct list *list, void *item)
}
void *
list_get_last_item(struct list *list)
{
return list_is_empty(list) ? NULL : GET_ITEM(list, list->link.prev);
}
/** Adds an item to the end of the list.
* Similar to list_add_link_to_tail() but works on the item, not the link.
*/