MCPcopy Create free account
hub / github.com/EIPStackGroup/OpENer / DoublyLinkedListRemoveNode

Function DoublyLinkedListRemoveNode

source/src/utils/doublylinkedlist.c:113–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void DoublyLinkedListRemoveNode(DoublyLinkedList *const list,
114 DoublyLinkedListNode **pointer_to_node_pointer)
115{
116 DoublyLinkedListNode *node = *pointer_to_node_pointer;
117 DoublyLinkedListNode *previous = node->previous;
118 DoublyLinkedListNode *next = node->next;
119
120 if (node == list->first && node == list->last) {
121 list->first = NULL;
122 list->last = NULL;
123 } else {
124 if(node == list->first) {
125 list->first = next;
126 }
127 if(node == list->last) {
128 list->last = previous;
129 }
130 if(NULL != previous) {
131 previous->next = next;
132 }
133 if(NULL != next) {
134 next->previous = previous;
135 }
136
137 }
138
139
140 DoublyLinkedListNodeDestroy(list, pointer_to_node_pointer);
141}

Callers 2

TESTFunction · 0.85

Calls 1

Tested by 1

TESTFunction · 0.68