]> granicus.if.org Git - graphviz/commitdiff
simplify endElementHandler with agxbprint
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Sep 2020 16:38:33 +0000 (09:38 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 17 Sep 2020 04:08:22 +0000 (21:08 -0700)
cmd/tools/gxl2gv.c

index 6bc82c59073ed2826c3845c7c1f3d9784134cf61..1cc11feccd32114183fee97078526794b49cff03 100644 (file)
@@ -636,19 +636,13 @@ static void endElementHandler(void *userData, const char *name)
               || strcmp(name, "int") == 0 || strcmp(name, "float") == 0) {
        ud->listen = FALSE;
        if (ud->compositeReadState) {
-           agxbputc(&ud->composite_buffer, '<');
-           agxbputc(&ud->composite_buffer, '/');
-           agxbput(&ud->composite_buffer, (char *) name);
-           agxbputc(&ud->composite_buffer, '>');
+           agxbprint(&ud->composite_buffer, "</%s>", name);
        }
     } else if (strcmp(name, "seq") == 0
               || strcmp(name, "set") == 0
               || strcmp(name, "bag") == 0
               || strcmp(name, "tup") == 0 || strcmp(name, "enum") == 0) {
-       agxbputc(&ud->composite_buffer, '<');
-       agxbputc(&ud->composite_buffer, '/');
-       agxbput(&ud->composite_buffer, (char *) name);
-       agxbputc(&ud->composite_buffer, '>');
+       agxbprint(&ud->composite_buffer, "</%s>", name);
     }
 }