]> granicus.if.org Git - graphviz/commitdiff
ccomps: abbreviate an open coded 'gv_strndup'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 18 Mar 2022 15:21:23 +0000 (08:21 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 24 Mar 2022 15:36:53 +0000 (08:36 -0700)
cmd/tools/ccomps.c

index d3ad78fbaa11128f4098ef66a91c7bfface49291..21d973d18a126ada04d17091e597ddc3b1492e3e 100644 (file)
@@ -113,9 +113,7 @@ static void split(void) {
     if (sfx) {
        suffix = sfx + 1;
        size_t size = (size_t)(sfx - outfile);
-       path = gv_alloc(size + 1);
-       strncpy(path, outfile, size);
-       *(path + size) = '\0';
+       path = gv_strndup(outfile, size);
     } else {
        path = outfile;
     }