]> granicus.if.org Git - graphviz/commitdiff
gc cntCluster: use 'startswith' to abbreviate a 'strncmp'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 1 Oct 2022 02:17:26 +0000 (19:17 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 1 Oct 2022 02:17:45 +0000 (19:17 -0700)
cmd/tools/gc.c

index c3899aa1b495348394e0bc8994cf8806082e4aa5..93ad8a566968c30b028ecbfab76eaeb485a7be0c 100644 (file)
@@ -26,6 +26,7 @@
 #include <cgraph/cghdr.h>
 #include <cgraph/exit.h>
 #include <cgraph/stack.h>
+#include <cgraph/startswith.h>
 
 typedef struct {
     Agrec_t h;
@@ -187,7 +188,7 @@ static void cntCluster(Agraph_t * g, Agobj_t * sg, void *arg)
 
     char *sgname = agnameof(sg);
 
-    if (strncmp(sgname, "cluster", 7) == 0)
+    if (startswith(sgname, "cluster"))
        *(int *) (arg) += 1;
 }