changeset 7150:8a531386c856 HEAD

Use linked list macros for command queue.
author Timo Sirainen <tss@iki.fi>
date Sat, 12 Jan 2008 07:16:10 +0200
parents 323b425a0f46
children 2ced9dd8b2cc
files src/imap/client.c
diffstat 1 files changed, 3 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 						 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 @@
 	}
 
 	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) {