dovecot: Added macros for handling a doubly linked list.

dovecot at dovecot.org dovecot at dovecot.org
Sun Jan 6 02:18:55 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/b626d8975193
changeset: 7118:b626d8975193
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jan 06 02:18:20 2008 +0200
description:
Added macros for handling a doubly linked list.

diffstat:

2 files changed, 22 insertions(+)
src/lib/Makefile.am |    1 +
src/lib/llist.h     |   21 +++++++++++++++++++++

diffs (36 lines):

diff -r 769181a20483 -r b626d8975193 src/lib/Makefile.am
--- a/src/lib/Makefile.am	Sun Jan 06 01:56:37 2008 +0200
+++ b/src/lib/Makefile.am	Sun Jan 06 02:18:20 2008 +0200
@@ -146,6 +146,7 @@ headers = \
 	ioloop-notify-fd.h \
 	lib.h \
 	lib-signals.h \
+	llist.h \
 	macros.h \
 	md4.h \
 	md5.h \
diff -r 769181a20483 -r b626d8975193 src/lib/llist.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/llist.h	Sun Jan 06 02:18:20 2008 +0200
@@ -0,0 +1,21 @@
+#ifndef LLIST_H
+#define LLIST_H
+
+/* Doubly linked list */
+#define DLLIST_PREPEND(list, item) STMT_START { \
+	(item)->prev = NULL; \
+	(item)->next = *(list); \
+	if (*(list) != NULL) (*(list))->prev = (item); \
+	*(list) = (item); \
+	} STMT_END
+
+#define DLLIST_REMOVE(list, item) STMT_START { \
+	if ((item)->prev == NULL) \
+		*(list) = (item)->next; \
+	else \
+		(item)->prev->next = (item)->next; \
+	if ((item)->next != NULL) \
+		(item)->next->prev = (item)->prev; \
+	} STMT_END
+
+#endif


More information about the dovecot-cvs mailing list