]> granicus.if.org Git - graphviz/commitdiff
expr extoken_fn: simplify hex parsing loop
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 19 Jul 2022 02:42:42 +0000 (19:42 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 26 Jul 2022 02:01:27 +0000 (19:01 -0700)
lib/expr/extoken.c

index 2764fd3e9271a86725ddc55d3f3a115122c2ec13..ed0ba6d6d2f202380ecc2945342b902c10075760 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include "config.h"
-
+#include <ctype.h>
 #include <expr/exlib.h>
 #include <stddef.h>
 #include <stdio.h>
@@ -548,18 +548,9 @@ extoken_fn(Expr_t* ex)
                        {
                                b = 16;
                                sfputc(ex->tmp, c);
-                               for (;;)
+                               for (c = lex(ex); isxdigit(c); c = lex(ex))
                                {
-                                       switch (c = lex(ex))
-                                       {
-                                       case '0': case '1': case '2': case '3': case '4':
-                                       case '5': case '6': case '7': case '8': case '9':
-                                       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': 
-                                       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': 
-                                               sfputc(ex->tmp, c);
-                                               continue;
-                                       }
-                                       break;
+                                       sfputc(ex->tmp, c);
                                }
                        }
                        else