aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-28 20:03:56 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-01 18:35:18 -0700
commitd6c92ea1348730de5ed8d31b40c92eb5b8e71944 (patch)
tree82b070f01045e5fd527e51198848ef3c709caf7a /src/client.c
parent3682efe7a705043f9005c456cfc806aeefa788ff (diff)
downloadmpd-d6c92ea1348730de5ed8d31b40c92eb5b8e71944.tar.gz
mpd-d6c92ea1348730de5ed8d31b40c92eb5b8e71944.tar.xz
mpd-d6c92ea1348730de5ed8d31b40c92eb5b8e71944.zip
client: client_defer_output() can create the first defer buffer
client_defer_output() was designed to add new buffers to an existing deferred_send buffer. Tweak it and allow it to create a new buffer list.
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client.c b/src/client.c
index 6457fb373..531177ab2 100644
--- a/src/client.c
+++ b/src/client.c
@@ -719,7 +719,7 @@ int client_print(int fd, const char *buffer, size_t buflen)
static void client_defer_output(struct client *client,
const void *data, size_t length)
{
- struct sllnode *buf;
+ struct sllnode **buf_r;
assert(client->deferred_send != NULL);
@@ -735,10 +735,10 @@ static void client_defer_output(struct client *client,
return;
}
- buf = client->deferred_send;
- while (buf->next)
- buf = buf->next;
- buf->next = new_sllnode(data, length);
+ buf_r = &client->deferred_send;
+ while (*buf_r != NULL)
+ buf_r = &(*buf_r)->next;
+ *buf_r = new_sllnode(data, length);
}
static void client_write_output(struct client *client)