From 403b79b8fd8167579d6747985ba78ee2b50c6c69 Mon Sep 17 00:00:00 2001 From: north Date: Thu, 25 Sep 2008 20:40:18 +0000 Subject: [PATCH] Fixed initialization of attributes from ProtoGraph. --- lib/cgraph/attr.c | 14 ++++++++++++++ lib/cgraph/edge.c | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/cgraph/attr.c b/lib/cgraph/attr.c index 766f7eae0..4045f8124 100644 --- a/lib/cgraph/attr.c +++ b/lib/cgraph/attr.c @@ -90,6 +90,20 @@ static Agdatadict_t *agmakedatadict(Agraph_t * g) dtview(dd->dict.e, parent_dd->dict.e); dtview(dd->dict.g, parent_dd->dict.g); } + else { + if (ProtoGraph && (g != ProtoGraph)) { + /* you can't dtview here for several reasons. the proto + graph could change, and it changes the base index for g*/ + Agsym_t *sym; /* this could be written more functionally */ + sym = 0; /* but it's easy to read this way */ + while ((sym = agnxtattr(ProtoGraph,AGRAPH,sym))) + agattr(g,AGRAPH,sym->name,sym->defval); + while ((sym = agnxtattr(ProtoGraph,AGNODE,sym))) + agattr(g,AGNODE,sym->name,sym->defval); + while ((sym = agnxtattr(ProtoGraph,AGEDGE,sym))) + agattr(g,AGEDGE,sym->name,sym->defval); + } + } return dd; } diff --git a/lib/cgraph/edge.c b/lib/cgraph/edge.c index 9e199079a..756f25eac 100644 --- a/lib/cgraph/edge.c +++ b/lib/cgraph/edge.c @@ -313,9 +313,9 @@ void agdeledgeimage(Agraph_t * g, Agedge_t * e, void *ignored) del(g->e_id, &sn->in_id, in); } #ifdef DEBUG - for (e = agfstin(h); e; e = agnxtin(e)) + for (e = agfstin(g,h); e; e = agnxtin(g,e)) assert(e != in); - for (e = agfstout(t); e; e = agnxtout(e)) + for (e = agfstout(g,t); e; e = agnxtout(g,e)) assert(e != out); #endif } -- 2.40.0