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:
Angus Salkeld 2013-03-07 16:47:08 +11:00
parent 2125310c93
commit c77c0a98ef

View File

@ -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;
}
}
/**