commit 6d01242876fda6bd9861414b477196e6f25bc8d8
Author:     Roberto E. Vargas Caballero <k...@shike2.com>
AuthorDate: Tue Dec 8 19:02:56 2015 +0100
Commit:     Roberto E. Vargas Caballero <k...@shike2.com>
CommitDate: Tue Dec 8 19:02:56 2015 +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 '\''.

diff --git a/cc1/lex.c b/cc1/lex.c
index 2bcdb98..32d6246 100644
--- 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

Reply via email to