From: Emden R. Gansner Date: Wed, 23 Apr 2014 22:03:46 +0000 (-0400) Subject: Cleanup debug code X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~220 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f1521751687992f0948e36b343766c62d2d5bb5e;p=graphviz Cleanup debug code --- diff --git a/lib/common/ns.c b/lib/common/ns.c index 941648536..b0c2b445d 100644 --- a/lib/common/ns.c +++ b/lib/common/ns.c @@ -868,30 +868,33 @@ void check_fast_node(node_t * n) assert(nptr != NULL); } +static char* dump_node (node_t* n) +{ + static char buf[50]; + + if (ND_node_type(n)) { + sprintf(buf, "%p", n); + return buf; + } + else + return agnameof(n); +} + static void dump_graph (graph_t* g) { int i; edge_t *e; node_t *n,*w; FILE* fp = fopen ("ns.gv", "w"); - fprintf (fp, "digraph %s {\n", agnameof(g)); + fprintf (fp, "digraph \"%s\" {\n", agnameof(g)); for (n = GD_nlist(g); n; n = ND_next(n)) { - if (streq(agnameof(n),"virtual")) - fprintf (fp, " \"%p\"\n", n); - else - fprintf (fp, " \"%s\"\n", agnameof(n)); + fprintf (fp, " \"%s\"\n", dump_node(n)); } for (n = GD_nlist(g); n; n = ND_next(n)) { for (i = 0; (e = ND_out(n).list[i]); i++) { - if (streq(agnameof(n),"virtual")) - fprintf (fp, " \"%p\"", n); - else - fprintf (fp, " \"%s\"", agnameof(n)); + fprintf (fp, " \"%s\"", dump_node(n)); w = aghead(e); - if (streq(agnameof(w),"virtual")) - fprintf (fp, " -> \"%p\"\n", w); - else - fprintf (fp, " -> \"%s\"\n", agnameof(w)); + fprintf (fp, " -> \"%s\"\n", dump_node(w)); } }