]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Process a review comment
authorWillem Toorop <willem@nlnetlabs.nl>
Mon, 6 Oct 2014 08:45:47 +0000 (10:45 +0200)
committerWillem Toorop <willem@nlnetlabs.nl>
Mon, 6 Oct 2014 08:45:47 +0000 (10:45 +0200)
rr.c

diff --git a/rr.c b/rr.c
index 40fdad1914ed2e0b08d16604ea2c3f0a59571caa..e52ea8094ec599520459275a7a373e80bbda2fef 100644 (file)
--- 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;
 }