summaryrefslogtreecommitdiff
path: root/firmware/common/linked_list.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-04-13 18:56:13 -0400
committerMichael Sevakis <jethead71@rockbox.org>2017-04-13 18:59:45 -0400
commitdbacee67c415abdd799580efe7949d8012739017 (patch)
treec3caab8d2ad37eb454ae97c1ba686a436fc46120 /firmware/common/linked_list.c
parent346423c040fe4ac31dae7c1afcb1d853cc80635c (diff)
downloadrockbox-dbacee67c415abdd799580efe7949d8012739017.tar.gz
rockbox-dbacee67c415abdd799580efe7949d8012739017.zip
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
Diffstat (limited to 'firmware/common/linked_list.c')
-rw-r--r--firmware/common/linked_list.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/firmware/common/linked_list.c b/firmware/common/linked_list.c
index a5b3de3cf7..b8f2dd181c 100644
--- a/firmware/common/linked_list.c
+++ b/firmware/common/linked_list.c
@@ -198,16 +198,14 @@ void lld_remove(struct lld_head *list, struct lld_node *node)
198 struct lld_node *next = node->next; 198 struct lld_node *next = node->next;
199 struct lld_node *prev = node->prev; 199 struct lld_node *prev = node->prev;
200 200
201 if (node == list->head) 201 if (prev == NULL)
202 list->head = next; 202 list->head = next;
203 203 else
204 if (node == list->tail)
205 list->tail = prev;
206
207 if (prev != NULL)
208 prev->next = next; 204 prev->next = next;
209 205
210 if (next != NULL) 206 if (next == NULL)
207 list->tail = prev;
208 else
211 next->prev = prev; 209 next->prev = prev;
212} 210}
213 211