From: erg Date: Thu, 8 Dec 2005 21:22:16 +0000 (+0000) Subject: Modify sample programs to use agsafeset(). X-Git-Tag: LAST_LIBGRAPH~32^2~6926 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=438900f34a9e8c8cc64040345606418a7f2b1f09;p=graphviz Modify sample programs to use agsafeset(). --- diff --git a/dot.demo/demo.c b/dot.demo/demo.c index 652c5e3e7..8b31aafb7 100644 --- a/dot.demo/demo.c +++ b/dot.demo/demo.c @@ -37,9 +37,7 @@ int main(int argc, char **argv) e = agedge(g, n, m); /* Set an attribute - in this case one that affects the visible rendering */ - if (!(a = agfindattr(g->proto->n, "color"))) - a = agnodeattr(g, "color", ""); - agxset(n, a->index, "red"); + agsafeset(n, "color", "red", ""); /* Compute a layout using layout engine from command line args */ gvLayoutJobs(gvc, g); diff --git a/dot.demo/example.c b/dot.demo/example.c index f3bf184ad..11a711f2b 100644 --- a/dot.demo/example.c +++ b/dot.demo/example.c @@ -26,9 +26,7 @@ int main(int argc, char **argv) e = agedge(g, n, m); /* Set an attribute - in this case one that affects the visible rendering */ - if (!(a = agfindattr(g->proto->n, "color"))) - a = agnodeattr(g, "color", ""); - agxset(n, a->index, "red"); + agsafeset(n, "color", "red", ""); #ifdef NO_LAYOUT_OR_RENDERING /* Just write the graph without layout */