shithub: scc

Download patch

ref: 7e66667e18139577f1a0f61969316579fd853ae4
parent: 2346a6274196c02e801c7bb1dfab68332ce1e766
author: Quentin Rameau <quinq@fifth.space>
date: Wed Jun 22 10:26:21 EDT 2016

[cc1] simplify readline()

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -201,17 +201,11 @@
 		peekc = 0;
 		if (c == '\n' || c == '\0')
 			break;
-		if (c != '/')
+		if (c != '/' || (peekc = readchar()) != '*' && peekc != '/')
 			continue;
-		if ((c = readchar()) != '*' && c != '/') {
-			peekc = c;
-			c = '/';
-		} else {
-			if (c == '/')
-				c = '\n';
-			comment(c);
-			c = ' ';
-		}
+		comment((peekc == '/') ? '\n' : peekc);
+		peekc = 0;
+		c = ' ';
 	}
 
 	if (bp == lim)