diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-11-24 22:17:44 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-11-24 22:17:44 -0800 |
| commit | e1dc8358c8515ec456e255585e2952c6c01b62ea (patch) | |
| tree | 757ed88b70c05d3ad53ec9e6355cd86384f50fa9 /src/core/list.c | |
| parent | 5ea2a1845f3393e91d6d102a8a89f339dd24f467 (diff) | |
| download | nng-e1dc8358c8515ec456e255585e2952c6c01b62ea.tar.gz nng-e1dc8358c8515ec456e255585e2952c6c01b62ea.tar.bz2 nng-e1dc8358c8515ec456e255585e2952c6c01b62ea.zip | |
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.
Diffstat (limited to 'src/core/list.c')
| -rw-r--r-- | src/core/list.c | 7 |
1 files changed, 3 insertions, 4 deletions
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 <garrett@damore.org> // Copyright 2017 Capitar IT Group BV <info@capitar.com> -// Copyright 2017 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> // // 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)); |
