dovecot-2.2: liblib: Added DLLIST2_INSERT_AFTER_FULL()

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 17 18:48:00 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/bafcb428167b
changeset: 16296:bafcb428167b
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Wed Apr 17 18:47:36 2013 +0300
description:
liblib: Added DLLIST2_INSERT_AFTER_FULL()
For inserting a new element in a doubly-linked list after an existing
element.

diffstat:

 src/lib/llist.h |  12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r cc0dd0d79952 -r bafcb428167b src/lib/llist.h
--- a/src/lib/llist.h	Wed Apr 17 18:44:52 2013 +0300
+++ b/src/lib/llist.h	Wed Apr 17 18:47:36 2013 +0300
@@ -48,6 +48,18 @@
 #define DLLIST2_APPEND(head, tail, item) \
 	DLLIST2_APPEND_FULL(head, tail, item, prev, next)
 
+#define DLLIST2_INSERT_AFTER_FULL(head, tail, after, item, prev, next) \
+	STMT_START { \
+	(item)->prev = (after); \
+	(item)->next = (after)->next; \
+	(after)->next = (item); \
+	if (*(tail) == (after)) \
+		*(tail) = (item); \
+	} STMT_END
+
+#define DLLIST2_INSERT_AFTER(head, tail, after, item) \
+	DLLIST2_INSERT_AFTER_FULL(head, tail, after, item, prev, next)
+
 #define DLLIST2_REMOVE_FULL(head, tail, item, prev, next) STMT_START { \
 	if ((item)->prev == NULL) \
 		*(head) = (item)->next; \


More information about the dovecot-cvs mailing list