[qfcc] Clean up stray dags edges

Killed nodes can leave stray (dangling) edges that cause some confusion
in the dot graphs and may cause problems later on down the track, so
ensure there are no dangling edges.
This commit is contained in:
Bill Currie 2020-04-01 16:06:45 +09:00
parent 199b3e82d9
commit 17bb408b57

View file

@ -1163,6 +1163,19 @@ dag_remove_dead_nodes (dag_t *dag)
}
}
} while (added_root);
// clean up any stray edges that point to removed nodes
for (int i = 0; i < dag->num_nodes; i++) {
node = dag->nodes[i];
for (child_i = set_first (node->edges); child_i;
child_i = set_next (child_i)) {
child = dag->nodes[child_i->element];
if (!set_is_member (dag->roots, child->number)
&& set_is_empty (child->parents)) {
set_remove (node->edges, child->number);
}
}
}
dag_sort_nodes (dag);
}