util/list: use helper function in list_is_singular
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Tue, 15 Dec 2020 15:06:57 +0000 (16:06 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 18 Dec 2020 01:46:00 +0000 (01:46 +0000)
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>

src/util/list.h

index 9de8a28..0e71a66 100644 (file)
@@ -124,7 +124,7 @@ static inline bool list_is_linked(const struct list_head *list)
  */
 static inline bool list_is_singular(const struct list_head *list)
 {
-   return list_is_linked(list) && list->next != list && list->next->next == list;
+   return list_is_linked(list) && !list_is_empty(list) && list->next->next == list;
 }
 
 static inline unsigned list_length(const struct list_head *list)