shithub: scc

Download patch

ref: ad9c3eeed6939fd545333482bf951991ab3e1b25
parent: fd8c907050d89f2c6bbcd0d792ae5a0fc8a72b0d
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Mar 10 18:28:35 EDT 2014

style it is important

--- a/lex.c
+++ b/lex.c
@@ -90,7 +90,7 @@
 		ungetc(ch, yyin);
 	}
 
-	for (bp = yytext; bp < yytext + IDENTSIZ; *bp++ = ch) {
+	for (bp = yytext; bp < &yytext[IDENTSIZ]; *bp++ = ch) {
 		ch = getc(yyin);
 		switch (base) {
 		case 8:
@@ -108,7 +108,7 @@
 		}
 	}
 
-end:	if (bp == yytext + IDENTSIZ)
+end:	if (bp == &yytext[IDENTSIZ])
 		error("identifier too long %s", yytext);
 	*bp = '\0';
 	ungetc(ch, yyin);
@@ -174,11 +174,11 @@
 {
 	register char ch, *bp;
 
-	for (bp = yytext; bp < yytext + IDENTSIZ; *bp++ = ch) {
+	for (bp = yytext; bp < &yytext[IDENTSIZ]; *bp++ = ch) {
 		if (!isalnum(ch = getc(yyin)) && ch != '_')
 			break;
 	}
-	if (bp == yytext + IDENTSIZ)
+	if (bp == &yytext[IDENTSIZ])
 		error("identifier too long %s", yytext);
 	*bp = '\0';
 	ungetc(ch, yyin);