From e1dc8358c8515ec456e255585e2952c6c01b62ea Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 24 Nov 2020 22:17:44 -0800 Subject: Convert list to new test framework; detached node fixes. List nodes that are not part of a list should return NULL when asking for the next or previous item. --- src/core/list.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/core/list.c') diff --git a/src/core/list.c b/src/core/list.c index f489a705..65e86670 100644 --- a/src/core/list.c +++ b/src/core/list.c @@ -1,7 +1,6 @@ // -// Copyright 2017 Garrett D'Amore // Copyright 2017 Capitar IT Group BV -// Copyright 2017 Staysail Systems, Inc. +// Copyright 2020 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -114,7 +113,7 @@ nni_list_next(const nni_list *list, void *item) { nni_list_node *node = NODE(list, item); - if ((node = node->ln_next) == &list->ll_head) { + if (((node = node->ln_next) == &list->ll_head) || (node == NULL)) { return (NULL); } return (ITEM(list, node)); @@ -125,7 +124,7 @@ nni_list_prev(const nni_list *list, void *item) { nni_list_node *node = NODE(list, item); - if ((node = node->ln_prev) == &list->ll_head) { + if (((node = node->ln_prev) == &list->ll_head) || (node == NULL)) { return (NULL); } return (ITEM(list, node)); -- cgit v1.2.3-70-g09d2