summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Toorop <willem@nlnetlabs.nl>2014-10-06 10:45:47 +0200
committerWillem Toorop <willem@nlnetlabs.nl>2014-10-06 10:45:47 +0200
commit85de578d77efd36e0633211403a4ef452964b7d4 (patch)
tree58755fd75ca8fe851a649dbc96d57fcd99cb29bd
parentf6c744276685b9157fa09c914e3f9445af1c3eb2 (diff)
downloadldns-85de578d77efd36e0633211403a4ef452964b7d4.tar.gz
Process a review comment
-rw-r--r--rr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/rr.c b/rr.c
index 40fdad19..e52ea809 100644
--- a/rr.c
+++ b/rr.c
@@ -670,14 +670,19 @@ ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str,
true);
}
+/* Strip whitespace from the start and the end of <line>. */
static char *
ldns_strip_ws(char *line)
{
char *s = line, *e;
- for (s = line; *s && isspace(*s); s++);
- for (e = strchr(s, 0); e-2 > s && isspace(e[-1]) && e[-2] != '\\'; e--);
+ for (s = line; *s && isspace(*s); s++)
+ ;
+
+ for (e = strchr(s, 0); e > s+2 && isspace(e[-1]) && e[-2] != '\\'; e--)
+ ;
*e = 0;
+
return s;
}