shithub: scc

Download patch

ref: dd38947f50a478becb34f0023cc9302568c7cb6b
parent: ff65381396b1a9615287dee92ccb00f6f0158122
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Sep 22 03:48:11 EDT 2017

[as] Fix split()

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

--- a/as/parser.c
+++ b/as/parser.c
@@ -95,15 +95,14 @@
 		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 @@
 				error("unterminated string");
 			break;
 		default:
-			*s = toupper(c);
+			*s = toupper(*s);
 			break;
 		}
 	}