Optimize lld_remove() a bit
Just need to check prev and next for NULL to know whether to mess with the head and/or tail pointers. Change-Id: I0aee057111e11735b7806e7214af0a6038f0ab53
This commit is contained in:
parent
346423c040
commit
dbacee67c4
|
@ -198,16 +198,14 @@ void lld_remove(struct lld_head *list, struct lld_node *node)
|
|||
struct lld_node *next = node->next;
|
||||
struct lld_node *prev = node->prev;
|
||||
|
||||
if (node == list->head)
|
||||
if (prev == NULL)
|
||||
list->head = next;
|
||||
|
||||
if (node == list->tail)
|
||||
list->tail = prev;
|
||||
|
||||
if (prev != NULL)
|
||||
else
|
||||
prev->next = next;
|
||||
|
||||
if (next != NULL)
|
||||
if (next == NULL)
|
||||
list->tail = prev;
|
||||
else
|
||||
next->prev = prev;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue