From 72d6179c470fc99a05942110fe5338f7b42181dc Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 21 May 2003 16:48:25 +0000 Subject: fixed ltrim/rtrim svn-id: r7788 --- common/config-file.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'common') diff --git a/common/config-file.cpp b/common/config-file.cpp index ac349f6fb5..58c37ff125 100644 --- a/common/config-file.cpp +++ b/common/config-file.cpp @@ -30,20 +30,15 @@ #define MAXLINELEN 256 static char *ltrim(char *t) { - for (; *t && (*t == ' '); t++); + while (*t == ' ') + t++; return t; } static char *rtrim(char *t) { - int l; - - for (l = strlen(t) - 1; l; l--) { - if (t[l] == ' ') { - *t = 0; - } else { - return t; - } - } + int l = strlen(t) - 1; + while (l >= 0 && t[l] == ' ') + t[l--] = 0; return t; } -- cgit v1.2.3