dovecot: Use linked list macros for command queue.

dovecot at dovecot.org dovecot at dovecot.org
Sat Jan 12 08:51:21 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/8a531386c856
changeset: 7150:8a531386c856
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jan 12 07:16:10 2008 +0200
description:
Use linked list macros for command queue.

diffstat:

1 file changed, 3 insertions(+), 12 deletions(-)
src/imap/client.c |   15 +++------------

diffs (39 lines):

diff -r 323b425a0f46 -r 8a531386c856 src/imap/client.c
--- a/src/imap/client.c	Sat Jan 12 06:56:16 2008 +0200
+++ b/src/imap/client.c	Sat Jan 12 07:16:10 2008 +0200
@@ -2,6 +2,7 @@
 
 #include "common.h"
 #include "ioloop.h"
+#include "llist.h"
 #include "str.h"
 #include "network.h"
 #include "istream.h"
@@ -391,12 +392,7 @@ client_command_new(struct client *client
 						 imap_max_line_length);
 	}
 
-	/* add to beginning of the queue */
-	if (client->command_queue != NULL) {
-		client->command_queue->prev = cmd;
-		cmd->next = client->command_queue;
-	}
-	client->command_queue = cmd;
+	DLLIST_PREPEND(&client->command_queue, cmd);
 	client->command_queue_size++;
 
 	return cmd;
@@ -432,12 +428,7 @@ void client_command_free(struct client_c
 	}
 
 	client->command_queue_size--;
-	if (cmd->prev != NULL)
-		cmd->prev->next = cmd->next;
-	else
-		client->command_queue = cmd->next;
-	if (cmd->next != NULL)
-		cmd->next->prev = cmd->prev;
+	DLLIST_REMOVE(&client->command_queue, cmd);
 	cmd = NULL;
 
 	if (client->command_queue == NULL) {


More information about the dovecot-cvs mailing list