ensure links only belong to 1 list

also some small documentation changes.
This commit is contained in:
2026-01-14 10:41:54 -05:00
parent e498c821bf
commit 4db7dfeb5d
3 changed files with 18 additions and 0 deletions

View File

@@ -57,6 +57,10 @@ int main (void)
t->data3 = rand() % UINT64_MAX;
t->data4 = rand() % UINT64_MAX;
// ensure our link points at nothing.
t->link.next = NULL;
t->link.prev = NULL;
ni_list__push_back(&data_instances, &(t->link));
printf("write: n = %d: %ld %ld %ld %ld \n\tnext: %p\n\tprev: %p\n",
@@ -75,6 +79,7 @@ int main (void)
}
}
// drain from back of list and remove then free entries
while (!ni_list__is_empty(&data_instances)) {
ni_list_node* tail = ni_list__get_back(&data_instances);
ni_list__remove(&data_instances, tail);