]> granicus.if.org Git - graphviz/commitdiff
parenthesize conditional blocks and clang-format prior code changes truenorth-issue-2184
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 13 Mar 2022 17:31:22 +0000 (10:31 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 17 Mar 2022 04:14:45 +0000 (21:14 -0700)
lib/cgraph/attr.c

index 1290c48356f09143b0cfecdf5897ab625b9258d5..dea9dfe7cf1bec617a443d1bb0479d09279ac3ee 100644 (file)
@@ -246,31 +246,34 @@ static void addattr(Agraph_t * g, Agobj_t * obj, Agsym_t * sym)
     attr->str[sym->id] = agstrdup(g, sym->defval);
 }
 
-static Agsym_t *getattr(Agraph_t * g, int kind, char *name)
-{
-    Agsym_t *rv = 0;
-    Dict_t *dict;
-    dict = agdictof(g, kind);
-    if (dict)
-       rv = agdictsym(dict, name);     /* viewpath up to root */
-    return rv;
-}
-
-static void unviewsubgraphsattr(Agraph_t *parent, char *name)
-{
-    Agraph_t *subg;
-    Agsym_t *psym, *lsym;
-    Dict_t *ldict;
-
-    psym = getattr(parent, AGRAPH, name);
-    if (!psym) return; // supposedly can't happen, see setattr()
-    for (subg = agfstsubg(parent); subg; subg = agnxtsubg(subg)) {
-       ldict = agdatadict(subg, TRUE)->dict.g;
-        lsym = aglocaldictsym(ldict, name);
-        if (lsym) continue;
-        lsym = agnewsym(agroot(subg), name, agxget(subg,psym), psym->id, AGRAPH);
-        dtinsert(ldict, lsym);
+static Agsym_t *getattr(Agraph_t *g, int kind, char *name) {
+  Agsym_t *rv = 0;
+  Dict_t *dict;
+  dict = agdictof(g, kind);
+  if (dict) {
+    rv = agdictsym(dict, name); // viewpath up to root
+  }
+  return rv;
+}
+
+static void unviewsubgraphsattr(Agraph_t *parent, char *name) {
+  Agraph_t *subg;
+  Agsym_t *psym, *lsym;
+  Dict_t *ldict;
+
+  psym = getattr(parent, AGRAPH, name);
+  if (!psym) {
+    return; // supposedly can't happen, see setattr()
+  }
+  for (subg = agfstsubg(parent); subg; subg = agnxtsubg(subg)) {
+    ldict = agdatadict(subg, TRUE)->dict.g;
+    lsym = aglocaldictsym(ldict, name);
+    if (lsym) {
+      continue;
     }
+    lsym = agnewsym(agroot(subg), name, agxget(subg, psym), psym->id, AGRAPH);
+    dtinsert(ldict, lsym);
+  }
 }
 
 static Agsym_t *setattr(Agraph_t * g, int kind, char *name, const char *value) {
@@ -288,7 +291,9 @@ static Agsym_t *setattr(Agraph_t * g, int kind, char *name, const char *value) {
     if (lsym) {                        /* update old local definition */
        if (g != root && streq(name, "layout"))
            agerr(AGWARN, "layout attribute is invalid except on the root graph\n");
-        if (kind == AGRAPH) unviewsubgraphsattr(g,name);
+        if (kind == AGRAPH) {
+           unviewsubgraphsattr(g,name);
+        }
        agstrfree(g, lsym->defval);
        lsym->defval = agstrdup(g, value);
        rv = lsym;