shithub: scc

Download patch

ref: 60c8089ebc884a96d6a89c7388c579973d3e59fd
parent: 3247a8c80df95ae35bfeca4c59a8788344076fc2
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Jan 25 16:45:41 EST 2018

[as] Use isspace() in field()

We have verified the input string, so we can call isspace
without problems.

--- a/as/parser.c
+++ b/as/parser.c
@@ -296,7 +296,7 @@
 	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 @@
 	*siz -= begin - t;
 	*oldp = t;
 
-	while (t >= s && *t == ' ')
+	while (t >= s && isspace(*t))
 		*t-- = '\0';
 	return (*s != '\0') ? s : NULL;
 }