From: north Date: Wed, 14 Nov 2007 21:00:49 +0000 (+0000) Subject: clean up fastgraphs X-Git-Tag: LAST_LIBGRAPH~32^2~5027 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=695ba374a42bc07c3ca932bd67b584ae77b66e0e;p=graphviz clean up fastgraphs --- diff --git a/lib/cgraph/flatten.c b/lib/cgraph/flatten.c index 6e09077f5..3791d6fd3 100644 --- a/lib/cgraph/flatten.c +++ b/lib/cgraph/flatten.c @@ -1,22 +1,22 @@ #include "cghdr.h" -static void agflatten_elist(Dict_t * d, Dtlink_t ** lptr) +static void agflatten_elist(Dict_t * d, Dtlink_t ** lptr, int flag) { dtrestore(d, *lptr); - (void) dtflatten(d); + dtmethod(d, flag? Dtlist : Dtoset); *lptr = dtextract(d); } -void agflatten_edges(Agraph_t * g, Agnode_t * n) +void agflatten_edges(Agraph_t * g, Agnode_t * n, int flag) { Agsubnode_t *sn; Dtlink_t **tmp; sn = agsubrep(g,n); tmp = &(sn->out_seq); /* avoiding - "dereferencing type-punned pointer will break strict-aliasing rules" */ - agflatten_elist(g->e_seq, tmp); + agflatten_elist(g->e_seq, tmp, flag); tmp = &(sn->in_seq); - agflatten_elist(g->e_seq, tmp); + agflatten_elist(g->e_seq, tmp, flag); } void agflatten(Agraph_t * g, int flag) @@ -25,13 +25,16 @@ void agflatten(Agraph_t * g, int flag) if (flag) { if (g->desc.flatlock == FALSE) { - dtflatten(g->n_seq); - g->desc.flatlock = TRUE; + dtmethod(g->n_seq,Dtlist); for (n = agfstnode(g); n; n = agnxtnode(g,n)) - agflatten_edges(g, n); + agflatten_edges(g, n, flag); + g->desc.flatlock = TRUE; } } else { if (g->desc.flatlock) { + dtmethod(g->n_seq,Dtoset); + for (n = agfstnode(g); n; n = agnxtnode(g,n)) + agflatten_edges(g, n, flag); g->desc.flatlock = FALSE; } }