Mesa (master): util: fix list_is_singular()
Timothy Arceri
tarceri at kemper.freedesktop.org
Thu Jan 12 02:58:41 UTC 2017
Module: Mesa
Branch: master
Commit: 0252ba26c545a9752b158470cb66741df0f222ce
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0252ba26c545a9752b158470cb66741df0f222ce
Author: Timothy Arceri <timothy.arceri at collabora.com>
Date: Wed Jan 11 15:13:35 2017 +1100
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" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/util/list.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)
More information about the mesa-commit
mailing list