diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-03 04:02:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:29 -0500 |
commit | dd638d3e53be51fa77af77f5c94d33b23c26ef22 (patch) | |
tree | 4b653f9fdf04db55d98fcc6f4d9ab29c743b94c0 /source4/include | |
parent | 66170ef8b36b499aa5b44ef10c1bd362a50f2636 (diff) | |
download | samba-dd638d3e53be51fa77af77f5c94d33b23c26ef22.tar.gz samba-dd638d3e53be51fa77af77f5c94d33b23c26ef22.tar.bz2 samba-dd638d3e53be51fa77af77f5c94d33b23c26ef22.zip |
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)
Diffstat (limited to 'source4/include')
-rw-r--r-- | source4/include/dlinklist.h | 28 |
1 files changed, 10 insertions, 18 deletions
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) |