From: north Date: Tue, 18 Mar 2008 12:24:56 +0000 (+0000) Subject: Fixed bug in irrelevant_subgraph where anonymous subgraphs X-Git-Tag: LAST_LIBGRAPH~32^2~4493 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d9afc60bc859a22497b8c1ffbb27b91e5bd8f37;p=graphviz Fixed bug in irrelevant_subgraph where anonymous subgraphs were sometimes not being written though they had nondefault attributes. --- diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c index b18c0c5cb..68fa388b2 100644 --- a/lib/cgraph/write.c +++ b/lib/cgraph/write.c @@ -275,20 +275,10 @@ static void write_trl(Agraph_t * g, iochan_t * ofile) ioput(g, ofile, "}\n"); } -static int localsize(Dict_t * d) -{ - int rv; - Dict_t *view; - view = dtview(d, NIL(Dict_t *)); - rv = dtsize(d); - dtview(d, view); - return rv; -} - static int irrelevant_subgraph(Agraph_t * g) { int i, n; - Agattr_t *sdata, *pdata; + Agattr_t *sdata, *pdata, *rdata; Agdatadict_t *dd; char *name; @@ -297,14 +287,15 @@ static int irrelevant_subgraph(Agraph_t * g) if (name && name[0] != LOCALNAMEPREFIX) return FALSE; if ((sdata = agattrrec(g)) && (pdata = agattrrec(agparent(g)))) { - n = dtsize(sdata->dict); + rdata = agattrrec(agroot(g)); + n = dtsize(rdata->dict); for (i = 0; i < n; i++) if (sdata->str[i] && pdata->str[i] && strcmp(sdata->str[i], pdata->str[i])) return FALSE; } dd = agdatadict(g); - if ((localsize(dd->dict.n) > 0) || (localsize(dd->dict.e) > 0)) + if ((dtsize(dd->dict.n) > 0) || (dtsize(dd->dict.e) > 0)) return FALSE; return TRUE; }