]> git.sur5r.net Git - cc65/commitdiff
cc65: remove un-needed logic from octal parsing 358/head
authorAlan Cox <alan@linux.intel.com>
Sun, 20 Nov 2016 18:02:45 +0000 (18:02 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 20 Nov 2016 18:02:45 +0000 (18:02 +0000)
We no longer need the extra error handling logic for octal parsing so simplify
it as requested by Greg King.

Signed-off-by: Alan Cox <etchedpixels@gmail.com>
src/cc65/scanner.c

index d867c985779b36e85d8cded8b4287394e75f8448..c9009bc2f37aee88c167084abf5b0782f9e324d7 100644 (file)
@@ -337,20 +337,14 @@ static int ParseChar (void)
             case '6':
             case '7':
                 /* Octal constant */
-                HadError = 0;
                 Count = 1;
                 C = HexVal (CurC);
                 while (IsODigit (NextC) && Count++ < 3) {
-                    if ((C << 3) >= 256) {
-                        if (!HadError) {
-                            Error ("Octal character constant out of range");
-                            HadError = 1;
-                        }
-                    } else {
-                        C = (C << 3) | HexVal (NextC);
-                    }
+                    C = (C << 3) | HexVal (NextC);
                     NextChar ();
                 }
+                if (C >= 256)
+                    Error ("Octal character constant out of range");
                 break;
             default:
                 Error ("Illegal character constant");