diff options
author | Kenny Levinsen <kl@kl.wtf> | 2020-08-31 02:26:47 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2020-08-31 14:09:59 +0200 |
commit | bbfb770c73498413055c7af8d3e1b8db36560016 (patch) | |
tree | 8d7130502352a1dc523d4959f7945899491b9e40 /common/linked_list.c | |
parent | d75b617fafa41b83aab5943827224df8b7ff9e4a (diff) |
linked_list: linked_list_take should concat lists
Diffstat (limited to 'common/linked_list.c')
-rw-r--r-- | common/linked_list.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/common/linked_list.c b/common/linked_list.c index 3d2ee7d..7383de0 100644 --- a/common/linked_list.c +++ b/common/linked_list.c @@ -35,14 +35,12 @@ bool linked_list_empty(struct linked_list *list) { void linked_list_take(struct linked_list *target, struct linked_list *source) { if (linked_list_empty(source)) { - linked_list_init(target); return; } + source->next->prev = target; + source->prev->next = target->next; + target->next->prev = source->prev; target->next = source->next; - target->prev = source->prev; - target->next->prev = target; - target->prev->next = target; - linked_list_init(source); } |