scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 96b634603d7d245952e8053e5184f6a0959f8a0c
parent d325a0554a3098a01f317f54a46643827c1f777d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 22 Sep 2017 07:48:11 +0200

[as] Fix split()

This function was discarding the full input except the label becase
'\0' wasn't handled correctly.

Diffstat:
Mas/parser.c | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/as/parser.c b/as/parser.c @@ -95,15 +95,14 @@ field(char **oldp) return NULL; for (s = begin; ; s++) { - switch (c = *s) { - case '\t': - *s = '\0'; - *oldp = s; + switch (*s) { + case '\0': + *oldp = NULL; goto out_loop; + case '\t': case ';': *s = '\0'; - case '\0': - *oldp = NULL; + *oldp = s+1; goto out_loop; case '\'': if (*++s == '\0' || *++s != '\'') @@ -116,7 +115,7 @@ field(char **oldp) error("unterminated string"); break; default: - *s = toupper(c); + *s = toupper(*s); break; } }