X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Flist.h;h=d6bd55c11013b54dadb2d0e615882058ace32e64;hp=763178ba71f16fb596e3ecfcde22a03ca3f34ead;hb=8e5d4209c12a7436488d9a3d1f8d59383c5c48f2;hpb=f24f8409b041727329e980fdc81e84a7c9b00e5b diff --git a/include/wimlib/list.h b/include/wimlib/list.h index 763178ba..d6bd55c1 100644 --- a/include/wimlib/list.h +++ b/include/wimlib/list.h @@ -129,6 +129,15 @@ static inline int list_empty(const struct list_head *head) return head->next == head; } +/** + * list_is_singular - tests whether a list has just one entry. + * @head: the list to test. + */ +static inline int list_is_singular(const struct list_head *head) +{ + return !list_empty(head) && (head->next == head->prev); +} + static inline void __list_splice(const struct list_head *list, struct list_head *prev, struct list_head *next)