From: Timothy Arceri Date: Wed, 11 Jan 2017 04:13:35 +0000 (+1100) Subject: util: fix list_is_singular() X-Git-Tag: upstream/17.1.0~3224 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0252ba26c545a9752b158470cb66741df0f222ce;p=platform%2Fupstream%2Fmesa.git util: fix list_is_singular() Currently its dependant on the user calling and checking the result of list_empty() before using the result of list_is_singular(). Cc: "13.0" Reviewed-by: Jason Ekstrand --- diff --git a/src/util/list.h b/src/util/list.h index e8a99ac..07eb9f3 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -110,7 +110,7 @@ static inline bool list_empty(struct list_head *list) */ static inline bool list_is_singular(const struct list_head *list) { - return list->next != NULL && list->next->next == list; + return list->next != NULL && list->next != list && list->next->next == list; } static inline unsigned list_length(struct list_head *list)