diff options
Diffstat (limited to 'src/common/dllist.h')
-rw-r--r-- | src/common/dllist.h | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/common/dllist.h b/src/common/dllist.h index 3feef5c..499151e 100644 --- a/src/common/dllist.h +++ b/src/common/dllist.h @@ -58,9 +58,6 @@ void __dl_list_add(dl_list_item *, dl_list_head *, dl_list_item *, dl_list_item /* Supprime un élément d'une liste doublement chaînée. */ void __dl_list_del(dl_list_item *, dl_list_head *); -/* Insère une liste au sein d'une autre. */ -void __dl_list_splice(dl_list_item *, dl_list_head); - #define dl_list_empty(head) \ ((head) == NULL) @@ -79,6 +76,17 @@ void __dl_list_splice(dl_list_item *, dl_list_head); } \ while (0) +#define dl_list_add_before(new, head, pos, member) \ + do \ + { \ + pos->member.prev->next = &new->member; \ + new->member.prev = pos->member.prev; \ + pos->member.prev = &new->member; \ + new->member.next = &pos->member; \ + if (pos == *head) *head = new; \ + } \ + while (0) + #define dl_list_add_tail(new, head, type, member) \ do \ { \ @@ -109,21 +117,6 @@ void __dl_list_splice(dl_list_item *, dl_list_head); _result; \ }) -#define dl_list_splice_before(pos, head1, head2, type, member) \ - do \ - { \ - if (pos == *head1) \ - { \ - __dl_list_splice(head2->member.prev, &(*head1)->member); \ - *head1 = head2; \ - } \ - else __dl_list_splice(pos->member.prev, &head2->member); \ - } \ - while(0) - -#define dl_list_splice_after(pos, head2, type, member) \ - __dl_list_splice(&pos->member, &head2->member); - #define dl_list_next_iter(iter, head, type, member) \ (iter->member.next == &head->member ? \ NULL : container_of(iter->member.next, type, member)) |