diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-12-30 08:57:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:49:01 -0500 |
commit | a326d6dba91637d80c5f88fa450fe2e02ba445cb (patch) | |
tree | 1c9cb9d68be5782a060c2536feb1b29253ca0afb /source4/include | |
parent | 4ff20fcd31bef1df561e6ae513581202b259c1f0 (diff) | |
download | samba-a326d6dba91637d80c5f88fa450fe2e02ba445cb.tar.gz samba-a326d6dba91637d80c5f88fa450fe2e02ba445cb.tar.bz2 samba-a326d6dba91637d80c5f88fa450fe2e02ba445cb.zip |
r12601: Syncronise both copies of dlinklist.h.
Should we somehow link these, or just use the version in ldb?
Andrew Bartlett
(This used to be commit e98d14668e3fdee01b103adb5aec733790eee96d)
Diffstat (limited to 'source4/include')
-rw-r--r-- | source4/include/dlinklist.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/source4/include/dlinklist.h b/source4/include/dlinklist.h index d50a46c5d4..176c138aaf 100644 --- a/source4/include/dlinklist.h +++ b/source4/include/dlinklist.h @@ -21,10 +21,6 @@ /* To use these macros you must have a structure containing a next and prev pointer */ -struct dlist_item { - struct dlist_item *prev, *next; - void *ptr; -}; /* hook into the front of the list */ #define DLIST_ADD(list, p) \ @@ -88,3 +84,26 @@ do { \ if (p->next) p->next->prev = p; \ }\ } while (0) + +/* demote an element to the end of the list, needs a tmp pointer */ +#define DLIST_DEMOTE(list, p, tmp) \ +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); \ + if (list2) { \ + (list2)->prev = tmp; \ + } \ + } \ +} while (0) |