]> granicus.if.org Git - graphviz/commitdiff
ast onematch: fuse comparison against 'xdigi' and 't'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 24 Jul 2022 17:49:39 +0000 (10:49 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 30 Jul 2022 00:02:14 +0000 (17:02 -0700)
Freed of the limitations of hash function in the previous commit, we can express
this as a single comparison.

lib/ast/strmatch.c

index c61182c495d44fe03e9befa379b3511faad8a4d8..5f440e7970b5a6dfdebff7d816c1da82839b190a 100644 (file)
@@ -424,8 +424,8 @@ onematch(Match_t * mp, int g, char *s, char *p, char *e, char *r,
                            } else if (x == 5 && strncmp(oldp, "upper", 5) == 0) {
                                if (icase ? islower(sc) : isupper(sc))
                                    ok = 1;
-                           } else if (x == 6 && strncmp(oldp, "xdigi", 5) == 0) {
-                               if (oldp[5] == 't' && isxdigit(sc))
+                           } else if (x == 6 && strncmp(oldp, "xdigit", 6) == 0) {
+                               if (isxdigit(sc))
                                    ok = 1;
                            }
                        }