Module: Mesa Branch: main Commit: 4b10a4aaaaf078d911271c9b3126c6bac9cf24f9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b10a4aaaaf078d911271c9b3126c6bac9cf24f9
Author: Dylan Baker <[email protected]> Date: Wed Mar 16 10:41:29 2022 -0700 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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14983> --- src/util/list.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util/list.h b/src/util/list.h index 0e71a66a7d5..383073b122a 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -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;
