scc

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

commit ad9c3eeed6939fd545333482bf951991ab3e1b25
parent fd8c907050d89f2c6bbcd0d792ae5a0fc8a72b0d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 10 Mar 2014 22:28:35 +0100

style it is important

Diffstat:
Mlex.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lex.c b/lex.c @@ -90,7 +90,7 @@ number(void) 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 @@ number(void) } } -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 @@ iden(void) { 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);