scc

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

commit 8945d761a051d5bc4fcfa9fe947a9fb74f9c9641
parent 983e4cd19bb2cae781d84d6e75143f9a76935536
Author: Quentin Rameau <quinq@fifth.space>
Date:   Wed, 22 Jun 2016 14:26:21 +0200

[cc1] simplify readline()

Diffstat:
Mcc1/lex.c | 14++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/cc1/lex.c b/cc1/lex.c @@ -201,17 +201,11 @@ repeat: 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)