mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
util: Add list_is_singular() helper function
Returns whether the list has exactly one element. Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
94ff35204d
commit
fb3b5669ce
1 changed files with 8 additions and 0 deletions
|
|
@ -99,6 +99,14 @@ static inline bool list_empty(struct list_head *list)
|
|||
return list->next == list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the list has exactly one element.
|
||||
*/
|
||||
static inline bool list_is_singular(const struct list_head *list)
|
||||
{
|
||||
return list->next != NULL && list->next->next == list;
|
||||
}
|
||||
|
||||
static inline unsigned list_length(struct list_head *list)
|
||||
{
|
||||
struct list_head *node;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue