util/list.h: Add docstrings for list_add and list_addtail

Which have easily confused parameters: the first argument is the item to
be added, the second is the list to add to; but this could easily be the
other way around.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14983>
This commit is contained in:
Dylan Baker 2022-03-16 10:41:29 -07:00 committed by Marge Bot
parent b0faf422b7
commit 4b10a4aaaa
1 changed files with 12 additions and 0 deletions

View File

@ -61,6 +61,12 @@ static inline void list_inithead(struct list_head *item)
item->next = item;
}
/**
* Prepend an item to a list
*
* @param item The element to add to the list
* @param list The list to prepend to
*/
static inline void list_add(struct list_head *item, struct list_head *list)
{
item->prev = list;
@ -69,6 +75,12 @@ static inline void list_add(struct list_head *item, struct list_head *list)
list->next = item;
}
/**
* Append an item to a list
*
* @param item The element to add to the list
* @param list The list to append to
*/
static inline void list_addtail(struct list_head *item, struct list_head *list)
{
item->next = list;