From c48464670d40acbab03483f96d82d639d5c7cf26 Mon Sep 17 00:00:00 2001 From: Philipp Kaeser Date: Fri, 1 May 2026 07:39:04 +0000 Subject: [PATCH] dllist: Strengthen a verification in test. --- src/dllist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dllist.c b/src/dllist.c index c2cd7bd..0ea7dd8 100644 --- a/src/dllist.c +++ b/src/dllist.c @@ -816,6 +816,7 @@ void bs_dllist_test_sort(bs_test_t *test_ptr) } /* ------------------------------------------------------------------------- */ +/** Tests randomized sort. */ void bs_dllist_test_sort_random(bs_test_t *test_ptr) { bs_dllist_t list = {}; @@ -831,8 +832,9 @@ void bs_dllist_test_sort_random(bs_test_t *test_ptr) bs_dllist_sort(&list, _bs_dllist_test_sort_cmp); bs_dllist_node_t *n1 = bs_dllist_pop_front(&list); - bs_dllist_node_t *n2; - while (NULL != (n2 = bs_dllist_pop_front(&list))) { + for (bs_dllist_node_t *n2 = bs_dllist_pop_front(&list); + n2 != NULL; + n1 = n2, n2 = bs_dllist_pop_front(&list)) { struct _bs_dllist_test_sort_node *v1 = BS_CONTAINER_OF( n1, struct _bs_dllist_test_sort_node, dlnode); struct _bs_dllist_test_sort_node *v2 = BS_CONTAINER_OF(