diff options
author | Max Kellermann <max@duempel.org> | 2008-08-28 20:03:56 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-28 20:03:56 +0200 |
commit | 4516bd117cfe95156e2ade4f92737cc94d19863d (patch) | |
tree | 61bdcbe0e28b3665cbd670825fa6f940719f44ec | |
parent | 20f06162dd6e301c539e6275dd93f05736f42925 (diff) | |
download | mpd-4516bd117cfe95156e2ade4f92737cc94d19863d.tar.gz mpd-4516bd117cfe95156e2ade4f92737cc94d19863d.tar.xz mpd-4516bd117cfe95156e2ade4f92737cc94d19863d.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 '')
-rw-r--r-- | src/client.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client.c b/src/client.c index 2aa52de4f..529e3012d 100644 --- a/src/client.c +++ b/src/client.c @@ -722,7 +722,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); @@ -738,10 +738,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) |