mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-08-16 04:41:16 +00:00
list: don't splice empty lists onto the head.
fixes bug #56 Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
2125310c93
commit
c77c0a98ef
@ -157,11 +157,13 @@ static inline void qb_list_splice(struct qb_list_head *list,
|
||||
struct qb_list_head *last = list->prev;
|
||||
struct qb_list_head *at = head->next;
|
||||
|
||||
first->prev = head;
|
||||
head->next = first;
|
||||
if (!qb_list_empty(list)) {
|
||||
first->prev = head;
|
||||
head->next = first;
|
||||
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,11 +178,13 @@ static inline void qb_list_splice_tail(struct qb_list_head *list,
|
||||
struct qb_list_head *last = list->prev;
|
||||
struct qb_list_head *at = head;
|
||||
|
||||
first->prev = head->prev;
|
||||
head->prev->next = first;
|
||||
if (!qb_list_empty(list)) {
|
||||
first->prev = head->prev;
|
||||
head->prev->next = first;
|
||||
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user