]> granicus.if.org Git - graphviz/commitdiff
Modify sample programs to use agsafeset().
authorerg <devnull@localhost>
Thu, 8 Dec 2005 21:22:16 +0000 (21:22 +0000)
committererg <devnull@localhost>
Thu, 8 Dec 2005 21:22:16 +0000 (21:22 +0000)
dot.demo/demo.c
dot.demo/example.c

index 652c5e3e767894a6e8976945dd36bc4d45f27fe9..8b31aafb7ff1526e2a3f7109595276f6118e7877 100644 (file)
@@ -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);
index f3bf184ad856ce2180044c6c625ec50df679946f..11a711f2b753165ffaba9b0cbc4bc50deaaafa82 100644 (file)
@@ -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 */