aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-07 15:36:03 +0200
committerMax Kellermann <max@duempel.org>2014-08-07 16:08:02 +0200
commit5c5c6a965cc3af4c8e725c7c9cc377e80f728279 (patch)
treeb29fdff7344e3cfecf532e5afbfdf1f8469d4803
parent74aafe6a105f807f4ee2a8c59096aa82d8432b67 (diff)
downloadmpd-5c5c6a965cc3af4c8e725c7c9cc377e80f728279.tar.gz
mpd-5c5c6a965cc3af4c8e725c7c9cc377e80f728279.tar.xz
mpd-5c5c6a965cc3af4c8e725c7c9cc377e80f728279.zip
LogBackend: use StripRight()
Eliminate duplicate code.
-rw-r--r--Makefile.am3
-rw-r--r--src/LogBackend.cxx8
2 files changed, 5 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 212d198cf..038b8db9b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1796,6 +1796,7 @@ test_run_avahi_CPPFLAGS = $(AM_CPPFLAGS) \
test_run_avahi_LDADD = \
libevent.a \
libsystem.a \
+ libutil.a \
$(GLIB_LIBS) \
$(AVAHI_LIBS)
@@ -1928,6 +1929,7 @@ test_test_mixramp_SOURCES = \
test_test_mixramp_CPPFLAGS = $(AM_CPPFLAGS) $(CPPUNIT_CFLAGS) -DCPPUNIT_HAVE_RTTI=0
test_test_mixramp_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations
test_test_mixramp_LDADD = \
+ libutil.a \
$(GLIB_LIBS) \
$(CPPUNIT_LIBS)
@@ -1970,6 +1972,7 @@ test_test_archive_CPPFLAGS = $(AM_CPPFLAGS) $(CPPUNIT_CFLAGS) -DCPPUNIT_HAVE_RTT
test_test_archive_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations
test_test_archive_LDADD = \
libarchive.a \
+ libutil.a \
$(GLIB_LIBS) \
$(CPPUNIT_LIBS)
diff --git a/src/LogBackend.cxx b/src/LogBackend.cxx
index 6f1794521..6591fef2d 100644
--- a/src/LogBackend.cxx
+++ b/src/LogBackend.cxx
@@ -21,7 +21,7 @@
#include "LogBackend.hxx"
#include "Log.hxx"
#include "util/Domain.hxx"
-#include "util/CharUtil.hxx"
+#include "util/StringUtil.hxx"
#ifdef HAVE_GLIB
#include <glib.h>
@@ -119,11 +119,7 @@ static int
chomp_length(const char *p)
{
size_t length = strlen(p);
-
- while (length > 0 && IsWhitespaceFast(p[length - 1]))
- --length;
-
- return (int)length;
+ return StripRight(p, length);
}
#ifdef HAVE_SYSLOG