]> granicus.if.org Git - graphviz/commitdiff
graphml2gv: remove unused 'compositeReadState'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 20 Aug 2022 15:54:01 +0000 (08:54 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 24 Aug 2022 02:51:44 +0000 (19:51 -0700)
It has never been possible to set this member to true.

cmd/tools/graphml2gv.c

index 7c538a1830d2041b18e72cff26a8053feb6f2e85..bb770ebe897a76f72a1f8a2349ade35c753bb27a 100644 (file)
@@ -101,7 +101,6 @@ typedef struct {
     int listen;
     int closedElementType;
     int globalAttrType;
-    int compositeReadState;
     int edgeinverted;
     Dt_t *nameMap;
 } userdata_t;
@@ -149,7 +148,6 @@ static userdata_t *genUserdata(char* dfltname)
     user->elements = (gv_stack_t){0};
     user->closedElementType = TAG_NONE;
     user->globalAttrType = TAG_NONE;
-    user->compositeReadState = FALSE;
     user->edgeinverted = FALSE;
     user->gname = dfltname;
     user->nameMap = dtopen(&nameDisc, Dtoset);
@@ -540,20 +538,10 @@ static void endElementHandler(void *userData, const char *name)
     } else if (strcmp(name, "attr") == 0) {
        char *name;
        char *value;
-       char *dynbuf = 0;
 
        ud->closedElementType = TAG_NONE;
-       if (ud->compositeReadState) {
-           size_t len = sizeof(GRAPHML_COMP) + agxblen(&ud->xml_attr_name);
-           name = dynbuf = gv_calloc(len, sizeof(char));
-           (void)snprintf(name, len, "%s%s", GRAPHML_COMP, agxbuse(&ud->xml_attr_name));
-           value = agxbuse(&ud->composite_buffer);
-           agxbclear(&ud->xml_attr_value);
-           ud->compositeReadState = FALSE;
-       } else {
-           name = agxbuse(&ud->xml_attr_name);
-           value = agxbuse(&ud->xml_attr_value);
-       }
+       name = agxbuse(&ud->xml_attr_name);
+       value = agxbuse(&ud->xml_attr_value);
 
        switch (ud->globalAttrType) {
        case TAG_NONE:
@@ -569,7 +557,6 @@ static void endElementHandler(void *userData, const char *name)
            setGraphAttr(G, name, value, ud);
            break;
        }
-       free(dynbuf);
        ud->globalAttrType = TAG_NONE;
     } 
 }
@@ -581,11 +568,6 @@ static void characterDataHandler(void *userData, const char *s, int length)
     if (!ud->listen)
        return;
 
-    if (ud->compositeReadState) {
-       agxbput_n(&ud->composite_buffer, s, length);
-       return;
-    }
-
     agxbput_n(&ud->xml_attr_value, s, length);
 }