svn commit: samba r12601 - in branches/SAMBA_4_0/source: include lib/ldb/include

abartlet at samba.org abartlet at samba.org
Fri Dec 30 08:57:33 GMT 2005


Author: abartlet
Date: 2005-12-30 08:57:33 +0000 (Fri, 30 Dec 2005)
New Revision: 12601

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12601

Log:
Syncronise both copies of dlinklist.h.

Should we somehow link these, or just use the version in ldb?

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/include/dlinklist.h
   branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h


Changeset:
Modified: branches/SAMBA_4_0/source/include/dlinklist.h
===================================================================
--- branches/SAMBA_4_0/source/include/dlinklist.h	2005-12-30 08:50:47 UTC (rev 12600)
+++ branches/SAMBA_4_0/source/include/dlinklist.h	2005-12-30 08:57:33 UTC (rev 12601)
@@ -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 @@
 		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)

Modified: branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h	2005-12-30 08:50:47 UTC (rev 12600)
+++ branches/SAMBA_4_0/source/lib/ldb/include/dlinklist.h	2005-12-30 08:57:33 UTC (rev 12601)
@@ -71,6 +71,20 @@
 		} \
 } 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 { \



More information about the samba-cvs mailing list