]> granicus.if.org Git - graphviz/commitdiff
Remove exit() from fdpgen.
authorEmden Gansner <erg@research.att.com>
Wed, 4 Jan 2012 21:02:46 +0000 (16:02 -0500)
committerEmden Gansner <erg@research.att.com>
Wed, 4 Jan 2012 21:02:46 +0000 (16:02 -0500)
lib/fdpgen/layout.c

index bdcd1d40abc34adce1840146240cc1c61dca6bb7..9ca939990eb23fdb0b25e4d44dd0076654d71ae7 100644 (file)
@@ -49,6 +49,9 @@
 #include "pack.h"
 #include "clusteredges.h"
 #include "dbg.h"
+#include <setjmp.h>
+
+static jmp_buf jbuf;
 
 typedef struct {
     graph_t*  rootg;  /* logical root; graph passed in to fdp_layout */
@@ -538,7 +541,7 @@ static graph_t *deriveGraph(graph_t * g, layout_info * infop)
        if (!DNODE(n)) {
            if (PARENT(n) && (PARENT(n) != GPARENT(g))) {
                agerr (AGERR, "node \"%s\" is contained in two non-comparable clusters \"%s\" and \"%s\"\n", agnameof(n), agnameof(g), agnameof(PARENT(n)));
-               exit (1);
+               longjmp (jbuf, 1);
            }
            PARENT(n) = g;
            if (IS_CLUST_NODE(n))
@@ -917,7 +920,8 @@ setClustNodes(graph_t* root)
  * Add edges per components to get better packing, rather than
  * wait until the end.
  */
-/* static */ void layout(graph_t * g, layout_info * infop)
+static 
+void layout(graph_t * g, layout_info * infop)
 {
     point *pts = NULL;
     graph_t *dg;
@@ -1201,6 +1205,9 @@ void fdp_layout(graph_t * g)
     /* Agnode_t* n; */
 
     fdp_init_graph(g);
+    if (setjmp(jbuf)) {
+       return;
+    }
     fdpLayout(g);
 #if 0
     /* free ND_alg field so it can be used in spline routing */