]> granicus.if.org Git - graphviz/commitdiff
circogen find_longest_path: remove shadowing of 'path' global
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 28 Dec 2022 21:58:48 +0000 (13:58 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 1 Jan 2023 00:31:40 +0000 (16:31 -0800)
lib/circogen/blockpath.c

index ecbc4854cee08bcdb5ad0561ed155a35cb050e13..f9a01ce3536a9e829bb83ea009e0848dd8a82e75 100644 (file)
@@ -295,17 +295,16 @@ static nodelist_t *find_longest_path(Agraph_t * tree)
     Agnode_t *n;
     Agedge_t *e;
     Agnode_t *common = 0;
-    nodelist_t *path;
     nodelist_t *endPath;
     int maxlength = 0;
     int length;
 
     if (agnnodes(tree) == 1) {
-       path = mkNodelist();
+       nodelist_t *beginPath = mkNodelist();
        n = agfstnode(tree);
-       appendNodelist(path, NULL, n);
+       appendNodelist(beginPath, NULL, n);
        SET_ONPATH(n);
-       return path;
+       return beginPath;
     }
 
     for (n = agfstnode(tree); n; n = agnxtnode(tree, n)) {
@@ -326,12 +325,12 @@ static nodelist_t *find_longest_path(Agraph_t * tree)
        }
     }
 
-    path = mkNodelist();
+    nodelist_t *beginPath = mkNodelist();
     for (n = LEAFONE(common); n != common; n = TPARENT(n)) {
-       appendNodelist(path, NULL, n);
+       appendNodelist(beginPath, NULL, n);
        SET_ONPATH(n);
     }
-    appendNodelist(path, NULL, common);
+    appendNodelist(beginPath, NULL, common);
     SET_ONPATH(common);
 
     if (DISTTWO(common)) {     /* 2nd path might be empty */
@@ -340,10 +339,10 @@ static nodelist_t *find_longest_path(Agraph_t * tree)
            appendNodelist(endPath, NULL, n);
            SET_ONPATH(n);
        }
-       reverseAppend(path, endPath);
+       reverseAppend(beginPath, endPath);
     }
 
-    return path;
+    return beginPath;
 }
 
 /* dfs: