summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-01-11 15:13:35 +1100
committerEmil Velikov <[email protected]>2017-01-24 01:13:28 +0000
commit0c54aa1568256725d2f87261bc0ba55b35ced1f9 (patch)
tree8935e2e63a85411d761e88d4fff5957e5278a690 /src
parente2a522b7556489e7d2fdcefc5438f94f485e639b (diff)
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" <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> (cherry picked from commit 0252ba26c545a9752b158470cb66741df0f222ce)
Diffstat (limited to 'src')
-rw-r--r--src/util/list.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/list.h b/src/util/list.h
index e8a99ac8e00..07eb9f3e6aa 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)