summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/include/dlinklist.h
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-12-30 08:57:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:01 -0500
commita326d6dba91637d80c5f88fa450fe2e02ba445cb (patch)
tree1c9cb9d68be5782a060c2536feb1b29253ca0afb /source4/lib/ldb/include/dlinklist.h
parent4ff20fcd31bef1df561e6ae513581202b259c1f0 (diff)
downloadsamba-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/lib/ldb/include/dlinklist.h')
-rw-r--r--source4/lib/ldb/include/dlinklist.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/source4/lib/ldb/include/dlinklist.h b/source4/lib/ldb/include/dlinklist.h
index a39007375f..176c138aaf 100644
--- a/source4/lib/ldb/include/dlinklist.h
+++ b/source4/lib/ldb/include/dlinklist.h
@@ -71,6 +71,20 @@ do { \
} \
} while (0)
+/* 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 { \
+ if (!(list) || !(el)) { \
+ DLIST_ADD(list, p); \
+ } else { \
+ p->prev = el; \
+ p->next = el->next; \
+ el->next = p; \
+ 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 { \