scc

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

commit 6d01242876fda6bd9861414b477196e6f25bc8d8
parent 9e29fc687fadb6d0ef18e986825c1b788ddd7284
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue,  8 Dec 2015 19:02:56 +0100

Simplify escape()

Why assign and return instead of returning directly?.
This patch also fixes an error in case '\'', where
escape() was returning '\\' instead of '\''.

Diffstat:
Mcc1/lex.c | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/cc1/lex.c b/cc1/lex.c @@ -395,19 +395,19 @@ number(void) static char escape(void) { - int c, base; + int n, base; switch (*++input->p) { - case '\\': c = '\\'; return c; - case 'a': c = '\a'; return c; - case 'f': c = '\f'; return c; - case 'n': c = '\n'; return c; - case 'r': c = '\r'; return c; - case 't': c = '\t'; return c; - case 'v': c = '\v'; return c; - case '\'': c = '\\'; return c; - case '"': c = '"'; return c; - case '?': c = '?'; return c; + case 'a': return '\a'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + case '"': return '"'; + case '\'': return '\''; + case '\\': return '\\'; + case '\?': return '\?'; case 'u': /* * FIXME: universal constants are not correctly handled