diff options
Diffstat (limited to '')
-rw-r--r-- | src/ClientRead.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ClientRead.cxx b/src/ClientRead.cxx index 8f7c4cf7e..af2e572a2 100644 --- a/src/ClientRead.cxx +++ b/src/ClientRead.cxx @@ -22,27 +22,25 @@ #include "Main.hxx" #include "event/Loop.hxx" -#include <glib.h> - #include <assert.h> #include <string.h> BufferedSocket::InputResult -Client::OnSocketInput(const void *data, size_t length) +Client::OnSocketInput(void *data, size_t length) { - const char *p = (const char *)data; - const char *newline = (const char *)memchr(p, '\n', length); + char *p = (char *)data; + char *newline = (char *)memchr(p, '\n', length); if (newline == NULL) return InputResult::MORE; TimeoutMonitor::ScheduleSeconds(client_timeout); - char *line = g_strndup(p, newline - p); - BufferedSocket::ConsumeInput(newline + 1 - p); + /* terminate the string at the end of the line */ + *newline = 0; - enum command_return result = client_process_line(this, line); - g_free(line); + BufferedSocket::ConsumeInput(newline + 1 - p); + enum command_return result = client_process_line(this, p); switch (result) { case COMMAND_RETURN_OK: case COMMAND_RETURN_IDLE: |