From 59d38f876a22ef520c6b897a356e8fb8677481aa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 7 Aug 2014 15:15:56 +0200 Subject: util/StringUtil: add StripRight() overload with "end" argument --- src/client/ClientRead.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/client/ClientRead.cxx') diff --git a/src/client/ClientRead.cxx b/src/client/ClientRead.cxx index ae8eda8bb..9cfb1271f 100644 --- a/src/client/ClientRead.cxx +++ b/src/client/ClientRead.cxx @@ -22,7 +22,7 @@ #include "Partition.hxx" #include "Instance.hxx" #include "event/Loop.hxx" -#include "util/CharUtil.hxx" +#include "util/StringUtil.hxx" #include @@ -39,11 +39,10 @@ Client::OnSocketInput(void *data, size_t length) BufferedSocket::ConsumeInput(newline + 1 - p); /* skip whitespace at the end of the line */ - while (newline > p && IsWhitespaceFast(newline[-1])) - --newline; + char *end = StripRight(p, newline); /* terminate the string at the end of the line */ - *newline = 0; + *end = 0; CommandResult result = client_process_line(*this, p); switch (result) { -- cgit v1.2.3