polish tarjan
[ccc.git] / scc.c
diff --git a/scc.c b/scc.c
index bf8a8b4..64e9ad0 100644 (file)
--- a/scc.c
+++ b/scc.c
@@ -131,7 +131,15 @@ struct ast *ast_scc(struct ast *ast)
                list_to_array(edges, &nedges, false);
 
        // Do tarjan's and convert back into the declaration list
-       struct components *cs = scc(nfun, (void **)fundecls, nedges, edgedata);
+       int err;
+       struct components *cs = tarjans(nfun, (void **)fundecls, nedges, edgedata, &err);
+       if (cs == NULL) {
+               if (err == 1)
+                       die("malformed edges in tarjan's????");
+               else
+                       pdie("malloc");
+       }
+
        int i = ffun;
        FOREACHCOMP(c, cs) {
                struct decl *d = safe_malloc(sizeof(struct decl));