From dd638d3e53be51fa77af77f5c94d33b23c26ef22 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 3 Feb 2005 04:02:48 +0000 Subject: r5187: ordered the timed events in the events code, which makes processing events much more efficient (no linked lists need to be traversed, so large numbers of timers are no problem) (This used to be commit b45b9436d78b0ad288b27a1023579bb566ca6202) --- source4/include/dlinklist.h | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'source4/include') diff --git a/source4/include/dlinklist.h b/source4/include/dlinklist.h index 40f7f0a0c7..fbc7b43652 100644 --- a/source4/include/dlinklist.h +++ b/source4/include/dlinklist.h @@ -71,23 +71,15 @@ do { \ } \ } while (0) -/* demote an element to the end of the list, needs a tmp pointer */ -#define DLIST_DEMOTE(list, p, tmp) \ +/* insert 'p' after the given element 'el' in a list. If el is NULL then + this is the same as a DLIST_ADD() */ +#define DLIST_ADD_AFTER(list, p, el) \ do { \ - DLIST_REMOVE(list, p); \ - DLIST_ADD_END(list, p, tmp); \ -} while (0) - -/* concatenate two lists - putting all elements of the 2nd list at the - end of the first list */ -#define DLIST_CONCATENATE(list1, list2, type) \ -do { \ - if (!(list1)) { \ - (list1) = (list2); \ - } else { \ - type tmp; \ - for (tmp = (list1); tmp->next; tmp = tmp->next) ; \ - tmp->next = (list2); \ - (list2)->prev = tmp; \ - } \ + if (!(list) || !(el)) { \ + DLIST_ADD(list, p); \ + } else { \ + p->prev = el; \ + p->next = el->next; \ + el->next = p; \ + }\ } while (0) -- cgit