aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/config-file.cpp15
1 files changed, 5 insertions, 10 deletions
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;
}