From 73f12042f4151d60196d80911957d089bb36dee7 Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 23 Oct 2008 20:23:55 +0000 Subject: [PATCH] use agfindnode/agfindedge macros --- lib/common/emit.c | 8 -------- lib/common/htmltable.c | 21 ++++++++------------- lib/common/utils.c | 12 ++---------- 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index 29a166f89..063227dc8 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -2074,11 +2074,7 @@ static void init_job_viewport(GVJ_t * job, graph_t * g) junk = malloc(strlen(str)+1); rv = sscanf(str, "%lf,%lf,%lf,\'%[^\']\'", &X, &Y, &Z, nodename); if (rv == 4) { -#ifndef WITH_CGRAPH n = agfindnode(g->root, nodename); -#else - n = agnode(g->root, nodename, 0); -#endif if (n) { x = ND_coord(n).x; y = ND_coord(n).y; @@ -2087,11 +2083,7 @@ static void init_job_viewport(GVJ_t * job, graph_t * g) else { rv = sscanf(str, "%lf,%lf,%lf,%[^,]%s", &X, &Y, &Z, nodename, junk); if (rv == 4) { -#ifndef WITH_CGRAPH n = agfindnode(g->root, nodename); -#else - n = agnode(g->root, nodename, 0); -#endif if (n) { x = ND_coord(n).x; y = ND_coord(n).y; diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index 272271bbe..c008bf2f4 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -1106,11 +1106,10 @@ static void checkChain(graph_t * g) edge_t *e; t = GD_nlist(g); for (h = ND_next(t); h; h = ND_next(h)) { + if (!agfindedge(g, t, h)) { #ifdef WITH_CGRAPH - if (!agedge(g, t, h, (char *)NULL, FALSE)) { - e = agedge(g, t, h,NULL,1); + e = agedge(g, t, h, NULL, 1); #else - if (!agfindedge(g, t, h)) { e = agedge(g, t, h); #endif ED_minlen(e) = 0; @@ -1190,13 +1189,11 @@ void makeGraphs(htmltbl_t * tbl, graph_t * rowg, graph_t * colg) for (cells = tbl->u.n.cells; *cells; cells++) { int x, y, c, r; cp = *cells; -#ifdef WITH_CGRAPH - t = agnode(colg, nToName(cp->col),0); - h = agnode(colg, nToName(cp->col + cp->cspan),0); - e = agedge(colg, t, h,NULL,1); -#else t = agfindnode(colg, nToName(cp->col)); h = agfindnode(colg, nToName(cp->col + cp->cspan)); +#ifdef WITH_CGRAPH + e = agedge(colg, t, h, NULL, 1); +#else e = agedge(colg, t, h); #endif x = 0; @@ -1211,13 +1208,11 @@ void makeGraphs(htmltbl_t * tbl, graph_t * rowg, graph_t * colg) elist_append(e, ND_out(t)); elist_append(e, ND_in(h)); -#ifdef WITH_CGRAPH - t = agnode(rowg, nToName(cp->row),0); - h = agnode(rowg, nToName(cp->row + cp->rspan),0); - e = agedge(rowg, t, h,NULL,1); -#else t = agfindnode(rowg, nToName(cp->row)); h = agfindnode(rowg, nToName(cp->row + cp->rspan)); +#ifdef WITH_CGRAPH + e = agedge(rowg, t, h, NULL, 1); +#else e = agedge(rowg, t, h); #endif y = 0; diff --git a/lib/common/utils.c b/lib/common/utils.c index 79ecf7c87..366f9ce07 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -299,11 +299,7 @@ edge_t *debug_getedge(graph_t * g, char *s0, char *s1) n0 = agfindnode(g, s0); n1 = agfindnode(g, s1); if (n0 && n1) -#ifdef WITH_CGRAPH - return agedge(g, n0, n1, (char *)NULL, FALSE); -#else return agfindedge(g, n0, n1); -#endif else return NULL; } @@ -1229,21 +1225,17 @@ static node_t *mapN(node_t * n, graph_t * clg) #ifndef WITH_CGRAPH aginsert(clg, n); #else /* WITH_CGRAPH */ - agsubnode(clg, n,1); + agsubnode(clg, n, 1); #endif /* WITH_CGRAPH */ name = strchr(agnameof(n), ':'); assert(name); name++; -#ifndef WITH_CGRAPH if ((nn = agfindnode(g, name))) -#else /* WITH_CGRAPH */ - if ((nn = agnode(g, name,0))) -#endif /* WITH_CGRAPH */ return nn; #ifndef WITH_CGRAPH nn = agnode(g, name); #else /* WITH_CGRAPH */ - nn = agnode(g, name,1); + nn = agnode(g, name, 1); agbindrec(nn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data #endif /* WITH_CGRAPH */ -- 2.40.0