]> granicus.if.org Git - graphviz/commitdiff
common: abbreviate a prefix check
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 3 Nov 2022 01:56:08 +0000 (18:56 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 4 Nov 2022 01:14:25 +0000 (18:14 -0700)
lib/common/arrows.c

index 28688ec9c3f81f573965496d78fdb7cdab425016..6e90cdea7c3dcc1bd5ad76d84fa71ad61cb56244 100644 (file)
@@ -10,6 +10,7 @@
 
 
 #include <assert.h>
+#include <cgraph/startswith.h>
 #include <common/geomprocs.h>
 #include <common/render.h>
 #include <math.h>
@@ -151,7 +152,7 @@ static char *arrow_match_name_frag(char *name, const arrowname_t *arrownames,
     for (const arrowname_t *arrowname = arrownames; arrowname->name;
          arrowname++) {
        namelen = strlen(arrowname->name);
-       if (strncmp(name, arrowname->name, namelen) == 0) {
+       if (startswith(name, arrowname->name)) {
            *flag |= arrowname->type;
            rest += namelen;
            break;