dovecot: Use linked list macros for handling clients linked list.

dovecot at dovecot.org dovecot at dovecot.org
Sun Jan 6 02:19:34 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/eb71cda96663
changeset: 7120:eb71cda96663
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jan 06 02:19:29 2008 +0200
description:
Use linked list macros for handling clients linked list.

diffstat:

1 file changed, 3 insertions(+), 11 deletions(-)
src/login-common/client-common.c |   14 +++-----------

diffs (38 lines):

diff -r 8c6a7af67e8c -r eb71cda96663 src/login-common/client-common.c
--- a/src/login-common/client-common.c	Sun Jan 06 02:18:51 2008 +0200
+++ b/src/login-common/client-common.c	Sun Jan 06 02:19:29 2008 +0200
@@ -2,6 +2,7 @@
 
 #include "common.h"
 #include "hostpid.h"
+#include "llist.h"
 #include "str.h"
 #include "str-sanitize.h"
 #include "var-expand.h"
@@ -15,11 +16,7 @@ unsigned int clients_count = 0;
 
 void client_link(struct client *client)
 {
-	client->prev = NULL;
-	client->next = clients;
-	if (clients != NULL)
-		clients->prev = client;
-	clients = client;
+	DLLIST_PREPEND(&clients, client);
 	clients_count++;
 }
 
@@ -28,12 +25,7 @@ void client_unlink(struct client *client
 	i_assert(clients_count > 0);
 
 	clients_count--;
-	if (client->prev == NULL)
-		clients = client->next;
-	else
-		client->prev->next = client->next;
-	if (client->next != NULL)
-		client->next->prev = client->prev;
+	DLLIST_REMOVE(&clients, client);
 }
 
 unsigned int clients_get_count(void)


More information about the dovecot-cvs mailing list