diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/dllist.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/common/dllist.h b/src/common/dllist.h index 504291e..f309dc9 100644 --- a/src/common/dllist.h +++ b/src/common/dllist.h @@ -108,11 +108,28 @@ void __dl_list_del(dl_list_item *, dl_list_head *); } \ while(0) +#define dl_list_merge(head1, head2, type, member) \ + do \ + { \ + if (dl_list_empty(*head1)) *head1 = *head2; \ + else if (!dl_list_empty(*head2)) \ + { \ + dl_list_item *hmbr1 = &(*head1)->member; \ + dl_list_item *hmbr2 = &(*head2)->member; \ + dl_list_item *mid = hmbr1->prev; \ + mid->next = hmbr2; \ + hmbr1->prev = hmbr2->prev; \ + hmbr2->prev->next = hmbr1; \ + hmbr2->prev = mid; \ + } \ + } \ + while(0) + #define dl_list_push dl_list_add_tail #define dl_list_pop(head, type, member) \ ({ \ - type *_result = *head; \ + type *_result = *head;/* FIXME : ARgh ! */ \ dl_list_del(_result, head, type, member); \ _result; \ }) |