Hi all, There may be an issue in blow function when deleted the node is the first one, that mean n->prev is NULL....., similarly, same issue as the last one node is deleted. LIST_INLINE void rem_node(node *n) { node *z = n->prev; node *x = n->next; z->next = x; x->prev = z; n->next = NULL; n->prev = NULL; } Thanks Arvin
Hello! See the init_list() function and the list structure. All lists in lib/lists.[hc] have heads. Therefore if n->prev is NULL, you don't have a valid node but a list head, the same for list tail and n->next. All valid nodes have valid both prev and next pointers. Maria On July 27, 2018 8:53:18 AM GMT+02:00, Arvin Gan <AGan@advaoptical.com> wrote:
Hi all, There may be an issue in blow function when deleted the node is the first one, that mean n->prev is NULL....., similarly, same issue as the last one node is deleted.
LIST_INLINE void rem_node(node *n) { node *z = n->prev; node *x = n->next;
z->next = x; x->prev = z; n->next = NULL; n->prev = NULL; }
Thanks Arvin
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
participants (2)
-
Arvin Gan -
Maria Jan Matějka