commit b4dd373179be477ee99841c21119700ae4159510
parent 86f0bd836d6ae1320126ed4c8d46afa628f5beec
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 25 Jan 2018 21:45:41 +0100
[as] Use isspace() in field()
We have verified the input string, so we can call isspace
without problems.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/as/parser.c b/as/parser.c
@@ -296,7 +296,7 @@ field(char **oldp, size_t *siz)
if ((begin = *oldp) == NULL)
return NULL;
- for (s = begin; *s == ' '; ++s)
+ for (s = begin; isspace(*s) && *s != '\t'; ++s)
;
if (*s == '\0' || *s == '/' || *s == ';') {
*t = '\0';
@@ -310,7 +310,7 @@ field(char **oldp, size_t *siz)
*siz -= begin - t;
*oldp = t;
- while (t >= s && *t == ' ')
+ while (t >= s && isspace(*t))
*t-- = '\0';
return (*s != '\0') ? s : NULL;
}