[hackers] [scc] [cc1] Improve error handling in string() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 19 Jan 2017 10:00:32 +0100 (CET)

commit 70920c23871f743fcdd012868694af575fc9045b
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 19 09:57:54 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Jan 19 09:57:54 2017 +0100

    [cc1] Improve error handling in string()

diff --git a/cc1/lex.c b/cc1/lex.c
index 82a3ff2..14d36ce 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -515,12 +515,16 @@ string(void)
         *bp++ = '"';
 repeat:
         for (++input->p; (c = *input->p) != '"'; ++input->p) {
- if (c == '\0')
- error("missing terminating '\"' character");
+ if (c == '\0') {
+ errorp("missing terminating '\"' character");
+ break;
+ }
                 if (c == '\\')
                         c = escape();
- if (bp == &yytext[STRINGSIZ+1])
+ if (bp == &yytext[STRINGSIZ+1]) {
+ /* TODO: proper error handling here */
                         error("string too long");
+ }
                 *bp++ = c;
         }
 
Received on Thu Jan 19 2017 - 10:00:32 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 19 2017 - 10:12:39 CET