]> granicus.if.org Git - graphviz/commitdiff
gxl2gv: move common agxset call outside conditional in setEdgeAttr
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 6 Jul 2021 00:03:13 +0000 (17:03 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 11 Jul 2021 23:04:25 +0000 (16:04 -0700)
Every path through the conditional block in this code ends in the same agxset
call. We can simplify this (and upcoming changes) by moving the common call
outside the block. Related to #517.

cmd/tools/gxl2gv.c

index 9a13c791add453d15930abf5c783842eefc4a748..1c421c6f590e4814331534f0199cb7a93fce909c 100644 (file)
@@ -338,7 +338,6 @@ setEdgeAttr(Agedge_t * ep, char *name, char *value, userdata_t * ud)
        ap = agattr(root, AGEDGE, attrname, 0);
        if (!ap)
            ap = agattr(root, AGEDGE, attrname, defval);
-       agxset(ep, ap, value);
     } else if (strcmp(name, "tailport") == 0) {
        if (ud->edgeinverted)
            attrname = "headport";
@@ -347,13 +346,13 @@ setEdgeAttr(Agedge_t * ep, char *name, char *value, userdata_t * ud)
        ap = agattr(root, AGEDGE, attrname, 0);
        if (!ap)
            ap = agattr(root, AGEDGE, attrname, defval);
-       agxset(ep, ap, value);
     } else {
        ap = agattr(root, AGEDGE, name, 0);
        if (!ap)
            ap = agattr(root, AGEDGE, name, defval);
-       agxset(ep, ap, value);
     }
+
+    agxset(ep, ap, value);
 }
 
 /* setGlobalEdgeAttr: