aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-06 10:31:53 +0200
committerMax Kellermann <max@duempel.org>2015-08-06 10:36:24 +0200
commit6cce3d29964a7d2912168b28b6774b10b5e43ef4 (patch)
tree430b207fe16150549e225593dc7ded1932a2de6a
parent77b34fa9619817ca31412a12db6723092157efae (diff)
downloadmpd-6cce3d29964a7d2912168b28b6774b10b5e43ef4.tar.gz
mpd-6cce3d29964a7d2912168b28b6774b10b5e43ef4.tar.xz
mpd-6cce3d29964a7d2912168b28b6774b10b5e43ef4.zip
ClientWrite: merge client_write() into Client::Write()
-rw-r--r--src/client/Client.hxx2
-rw-r--r--src/client/ClientWrite.cxx16
2 files changed, 6 insertions, 12 deletions
diff --git a/src/client/Client.hxx b/src/client/Client.hxx
index 83909f68b..0e3047d58 100644
--- a/src/client/Client.hxx
+++ b/src/client/Client.hxx
@@ -112,7 +112,7 @@ public:
void Close();
void SetExpired();
- using FullyBufferedSocket::Write;
+ bool Write(const void *data, size_t length);
/**
* returns the uid of the client process, or a negative value
diff --git a/src/client/ClientWrite.cxx b/src/client/ClientWrite.cxx
index 88611ee25..f30f2f8b3 100644
--- a/src/client/ClientWrite.cxx
+++ b/src/client/ClientWrite.cxx
@@ -23,30 +23,24 @@
#include <string.h>
-/**
- * Write a block of data to the client.
- */
-static void
-client_write(Client &client, const char *data, size_t length)
+bool
+Client::Write(const void *data, size_t length)
{
/* if the client is going to be closed, do nothing */
- if (client.IsExpired() || length == 0)
- return;
-
- client.Write(data, length);
+ return !IsExpired() && FullyBufferedSocket::Write(data, length);
}
void
client_puts(Client &client, const char *s)
{
- client_write(client, s, strlen(s));
+ client.Write(s, strlen(s));
}
void
client_vprintf(Client &client, const char *fmt, va_list args)
{
char *p = FormatNewV(fmt, args);
- client_write(client, p, strlen(p));
+ client.Write(p, strlen(p));
delete[] p;
}