aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-17 23:53:16 +0200
committerMax Kellermann <max@duempel.org>2008-10-17 23:53:16 +0200
commitf8d5b7407160a2c9ec96026b7f7cbd2f4b40afdc (patch)
tree88f57d0be22eae200d944f6c31e93d9eb90f76dd
parentbdbccc633d136bf0d34b89ec772e05f138d7e647 (diff)
downloadmpd-f8d5b7407160a2c9ec96026b7f7cbd2f4b40afdc.tar.gz
mpd-f8d5b7407160a2c9ec96026b7f7cbd2f4b40afdc.tar.xz
mpd-f8d5b7407160a2c9ec96026b7f7cbd2f4b40afdc.zip
client: eliminate variable "left" in client_write()
Reduce two temporary variables to only one.
Diffstat (limited to '')
-rw-r--r--src/client.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client.c b/src/client.c
index aa7194502..b0cd8c8d7 100644
--- a/src/client.c
+++ b/src/client.c
@@ -759,19 +759,19 @@ static void client_write_output(struct client *client)
void client_write(struct client *client, const char *buffer, size_t buflen)
{
- size_t copylen;
-
/* if the client is going to be closed, do nothing */
if (client_is_expired(client))
return;
while (buflen > 0 && !client_is_expired(client)) {
- size_t left;
+ size_t copylen;
assert(client->send_buf_used < sizeof(client->send_buf));
- left = sizeof(client->send_buf) - client->send_buf_used;
- copylen = buflen > left ? left : buflen;
+ copylen = sizeof(client->send_buf) - client->send_buf_used;
+ if (copylen > buflen)
+ copylen = buflen;
+
memcpy(client->send_buf + client->send_buf_used, buffer,
copylen);
buflen -= copylen;