changeset 7120:eb71cda96663 HEAD

Use linked list macros for handling clients linked list.
author Timo Sirainen <tss@iki.fi>
date Sun, 06 Jan 2008 02:19:29 +0200
parents 8c6a7af67e8c
children 05bc8679c886
files src/login-common/client-common.c
diffstat 1 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 
 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 @@
 	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)