ensure links only belong to 1 list
also some small documentation changes.
This commit is contained in:
@@ -47,9 +47,13 @@ static inline ni_list_node* ni_list__get_back(ni_list* l) {
|
||||
|
||||
/* Iter Helpers */
|
||||
|
||||
// helper macro for element traversal, ordering of operations may cause seg faults
|
||||
// generally just don't remove 'it', this causes it->next on the next loop to segfault
|
||||
#define NI_LIST__FOREACH(lptr) \
|
||||
for (ni_list_node* it = (lptr)->head.next; it != &(lptr)->head; it = it->next)
|
||||
|
||||
// helper macro for element traversal, that also makes a copy of it in tmp
|
||||
// useful for removing/moving the current node (it)
|
||||
#define NI_LIST_FOREACH_SAFE(tmp, lptr) \
|
||||
for (ni_list_node* it = (lptr)->head.next, *tmp = it->next; \
|
||||
it != &(lptr)->head; \
|
||||
|
||||
Reference in New Issue
Block a user