summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/dlinklist.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/include/dlinklist.h b/source3/include/dlinklist.h
index 447948b521..d510aad028 100644
--- a/source3/include/dlinklist.h
+++ b/source3/include/dlinklist.h
@@ -56,3 +56,18 @@
DLIST_REMOVE(list, p) \
DLIST_ADD(list, p) \
}
+
+/* demote an element to the top of the list, needs a tmp pointer */
+#define DLIST_DEMOTE(list, p, tmp) \
+{ \
+ DLIST_REMOVE(list, p) \
+ if (!(list)) { \
+ (list) = (p); \
+ (p)->next = (p)->prev = NULL; \
+ } else { \
+ for ((tmp) = (list); (tmp)->next; (tmp) = (tmp)->next) ; \
+ (tmp)->next = (p); \
+ (p)->next = NULL; \
+ (p)->prev = (tmp); \
+ } \
+}