]> granicus.if.org Git - graphviz/commitdiff
simplify gvplugin_list with agxbprint
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Sep 2020 17:22:49 +0000 (10:22 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 17 Sep 2020 04:08:23 +0000 (21:08 -0700)
lib/gvc/gvplugin.c

index 0fc60408ff00a780be366bcfc2b32ed9aec46085..5d03f05ac7ddf55ecf0d1d14a8c92e24c47d40cc 100644 (file)
@@ -377,10 +377,7 @@ char *gvplugin_list(GVC_t * gvc, api_t api, const char *str)
             /* list only the matching type, or all types if s is an empty string */
             if (!s[0] || strcasecmp(s, q) == 0) {
                 /* list each member of the matching type as "type:path" */
-                agxbputc(&xb, ' ');
-                agxbput(&xb, pnext->typestr);
-                agxbputc(&xb, ':');
-                agxbput(&xb, pnext->package->name);
+                agxbprint(&xb, " %s:%s", pnext->typestr, pnext->package->name);
                 new = FALSE;
             }
             free(q);
@@ -397,8 +394,7 @@ char *gvplugin_list(GVC_t * gvc, api_t api, const char *str)
                 *p++ = '\0';
             if (!typestr_last || strcasecmp(typestr_last, q) != 0) {
                 /* list it as "type"  i.e. w/o ":path" */
-                agxbputc(&xb, ' ');
-                agxbput(&xb, q);
+                agxbprint(&xb, " %s", q);
                 new = FALSE;
             }
             if (!typestr_last)