LogBackend: use StripRight()

Eliminate duplicate code.
This commit is contained in:
Max Kellermann 2014-08-07 15:36:03 +02:00
parent 74aafe6a10
commit 5c5c6a965c
2 changed files with 5 additions and 6 deletions

View File

@ -1796,6 +1796,7 @@ test_run_avahi_CPPFLAGS = $(AM_CPPFLAGS) \
test_run_avahi_LDADD = \ test_run_avahi_LDADD = \
libevent.a \ libevent.a \
libsystem.a \ libsystem.a \
libutil.a \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(AVAHI_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_CPPFLAGS = $(AM_CPPFLAGS) $(CPPUNIT_CFLAGS) -DCPPUNIT_HAVE_RTTI=0
test_test_mixramp_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations test_test_mixramp_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations
test_test_mixramp_LDADD = \ test_test_mixramp_LDADD = \
libutil.a \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(CPPUNIT_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_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations
test_test_archive_LDADD = \ test_test_archive_LDADD = \
libarchive.a \ libarchive.a \
libutil.a \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(CPPUNIT_LIBS) $(CPPUNIT_LIBS)

View File

@ -21,7 +21,7 @@
#include "LogBackend.hxx" #include "LogBackend.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/CharUtil.hxx" #include "util/StringUtil.hxx"
#ifdef HAVE_GLIB #ifdef HAVE_GLIB
#include <glib.h> #include <glib.h>
@ -119,11 +119,7 @@ static int
chomp_length(const char *p) chomp_length(const char *p)
{ {
size_t length = strlen(p); size_t length = strlen(p);
return StripRight(p, length);
while (length > 0 && IsWhitespaceFast(p[length - 1]))
--length;
return (int)length;
} }
#ifdef HAVE_SYSLOG #ifdef HAVE_SYSLOG