struct NodeList
{
struct NodeHandle* node;
struct NodeList* prev;
struct NodeList* next;
};
This seems dangerous, can you really have the same 'struct NodeHandle'
be reachable from
different NodeLists? If there is a 1:1 relationship, you should just
"inline" the NodeHandle here
and simplify your allocation/datastructures. If one NodeHandle can be
in multiple NodeLists,
you are in for a world of pain to ensure the memory is managed properly
(I don't see a reference
counter, so how do you know when it is safe to free one?). Looking at
the code, it seems
clear that there is a 1:1 relationship and you should just combine the
two structs into one.