summaryrefslogtreecommitdiff
path: root/ares
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-10-10 12:29:32 +0000
committerYang Tse <yangsita@gmail.com>2009-10-10 12:29:32 +0000
commit640e49976f34d766124cb6988dc4849c4acab6d0 (patch)
tree78d4ae77225e32e08a33cea945ec244adb67ef96 /ares
parentf1aa936d2c48a5a4cd860d22b8db566a1dd848b2 (diff)
downloadcurl-640e49976f34d766124cb6988dc4849c4acab6d0.tar.gz
Fix compiler warning: loop without body
Diffstat (limited to 'ares')
-rw-r--r--ares/ares_init.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/ares/ares_init.c b/ares/ares_init.c
index e9cf9dbc5..9f90f9e20 100644
--- a/ares/ares_init.c
+++ b/ares/ares_init.c
@@ -1383,25 +1383,29 @@ static const char *try_option(const char *p, const char *q, const char *opt)
static char *try_config(char *s, const char *opt)
{
size_t len;
- ssize_t i;
- ssize_t j;
char *p;
+ char *q;
if (!s || !opt)
/* no line or no option */
return NULL;
/* trim line comment */
- for (i = 0; s[i] && s[i] != '#'; ++i);
- s[i] = '\0';
+ p = s;
+ while (*p && (*p != '#'))
+ p++;
+ *p = '\0';
/* trim trailing whitespace */
- for (j = i-1; j >= 0 && ISSPACE(s[j]); --j);
- s[++j] = '\0';
+ q = p - 1;
+ while ((q >= s) && ISSPACE(*q))
+ q--;
+ *++q = '\0';
/* skip leading whitespace */
- for (i = 0; s[i] && ISSPACE(s[i]); ++i);
- p = &s[i];
+ p = s;
+ while (*p && ISSPACE(*p))
+ p++;
if (!*p)
/* empty line */