summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/common/util.c b/src/common/util.c
index d0f568486c..b572c3a745 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -413,17 +413,23 @@ eat_whitespace(const char *s)
{
tor_assert(s);
- while (TOR_ISSPACE(*s) || *s == '#') {
- while (TOR_ISSPACE(*s))
- s++;
- if (*s == '#') { /* read to a \n or \0 */
+ while (1) {
+ switch (*s) {
+ case '\0':
+ default:
+ return s;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ ++s;
+ break;
+ case '#':
+ ++s;
while (*s && *s != '\n')
- s++;
- if (!*s)
- return s;
+ ++s;
}
}
- return s;
}
/** Return a pointer to the first char of s that is not a space or a tab,