From: erg Date: Tue, 31 May 2011 15:46:20 +0000 (+0000) Subject: Fix use of extra data. Originally, we used ND_alg but this needs to be X-Git-Tag: LAST_LIBGRAPH~32^2~734 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=621662170891908b28b5ccb9e910e3523f487e2a;p=graphviz Fix use of extra data. Originally, we used ND_alg but this needs to be freed, as some spline routing uses it. But when splines=compound, we also need the PARENT field. So we now use the dot part of Agnodeinfo_t to provide the parent and dnode fields. --- diff --git a/lib/fdpgen/fdp.h b/lib/fdpgen/fdp.h index 22fed91c8..8afceed85 100644 --- a/lib/fdpgen/fdp.h +++ b/lib/fdpgen/fdp.h @@ -53,6 +53,7 @@ typedef struct { #define GORIG(g) (GDATA(g)->orig) #endif +#if 0 /* ndata is attached to nodes in real graphs. * Real nodes also use "builtin" fields: * pos - position information @@ -69,6 +70,23 @@ typedef struct { #define NDATA(n) ((ndata*)(ND_alg(n))) #define DNODE(n) (NDATA(n)->dn) #define PARENT(n) (NDATA(n)->parent) +#endif + +/* + * Real nodes use "builtin" fields: + * ND_pos - position information + * ND_width,ND_height - node dimensions + * ND_pinned + * ND_lw,ND_rw,ND_ht - node dimensions in points + * ND_id + * ND_shape, ND_shape_info + * + * In addition, we use two of the dot fields for parent and derived node. + * Previously, we attached these via ND_alg, but ND_alg may be needed for + * spline routing, and splines=compound also requires the parent field. + */ +#define DNODE(n) (ND_next(n)) +#define PARENT(n) (ND_clust(n)) /* dndata is attached to nodes in derived graphs. * Derived nodes also use "builtin" fields: diff --git a/lib/fdpgen/fdpinit.c b/lib/fdpgen/fdpinit.c index e1cc410ee..cdc3bfd71 100644 --- a/lib/fdpgen/fdpinit.c +++ b/lib/fdpgen/fdpinit.c @@ -98,7 +98,7 @@ void fdp_init_node_edge(graph_t * g) edge_t *e; int nn; int i; - ndata* alg; + /* ndata* alg; */ processClusterEdges(g); @@ -106,12 +106,12 @@ void fdp_init_node_edge(graph_t * g) * add new nodes. */ nn = agnnodes(g); - alg = N_NEW(nn, ndata); + /* alg = N_NEW(nn, ndata); */ GD_neato_nlist(g) = N_NEW(nn + 1, node_t *); for (i = 0, n = agfstnode(g); n; n = agnxtnode(g, n)) { neato_init_node (n); - ND_alg(n) = alg + i; + /* ND_alg(n) = alg + i; */ GD_neato_nlist(g)[i] = n; ND_id(n) = i++; } diff --git a/lib/fdpgen/layout.c b/lib/fdpgen/layout.c index 6c1e5f226..6f2290c47 100644 --- a/lib/fdpgen/layout.c +++ b/lib/fdpgen/layout.c @@ -1187,13 +1187,15 @@ fdpSplines (graph_t * g) void fdp_layout(graph_t * g) { - Agnode_t* n; + /* Agnode_t* n; */ fdp_init_graph(g); fdpLayout(g); +#if 0 /* free ND_alg field so it can be used in spline routing */ if ((n = agfstnode(g))) free(ND_alg(n)); +#endif neato_set_aspect(g); if (EDGE_TYPE(g) != ET_NONE) fdpSplines (g);