From: Matthew Fernandez Date: Sat, 6 Feb 2021 23:07:07 +0000 (-0800) Subject: remove unnecessary cast of dtfirst() return value X-Git-Tag: 2.47.0~88^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ef3a1cd7f09a9502e41071210f230f414dd275e;p=graphviz remove unnecessary cast of dtfirst() return value These pointers implicitly coerce. --- diff --git a/cmd/tools/gv2gxl.c b/cmd/tools/gv2gxl.c index 5e528d7b1..75d4be1b2 100644 --- a/cmd/tools/gv2gxl.c +++ b/cmd/tools/gv2gxl.c @@ -412,7 +412,7 @@ writeDict(Agraph_t * g, FILE * gxlFile, char *name, Dict_t * dict, Agsym_t *sym, *psym; view = dtview(dict, NULL); - for (sym = (Agsym_t *) dtfirst(dict); sym; + for (sym = dtfirst(dict); sym; sym = (Agsym_t *) dtnext(dict, sym)) { if (!isGxlGrammar(sym->name)) { if (EMPTY(sym->defval)) { /* try to skip empty str (default) */ @@ -619,7 +619,7 @@ writeNondefaultAttr(void *obj, FILE * gxlFile, Dict_t * defdict) } data = (Agattr_t *) agattrrec(obj); if (data) { - for (sym = (Agsym_t *) dtfirst(defdict); sym; + for (sym = dtfirst(defdict); sym; sym = (Agsym_t *) dtnext(defdict, sym)) { if (!isGxlGrammar(sym->name)) { if ((AGTYPE(obj) == AGINEDGE) diff --git a/lib/cgraph/attr.c b/lib/cgraph/attr.c index 601124807..181e230ba 100644 --- a/lib/cgraph/attr.c +++ b/lib/cgraph/attr.c @@ -94,7 +94,7 @@ static void agcopydict(Dict_t * src, Dict_t * dest, Agraph_t * g, int kind) Agsym_t *sym, *newsym; assert(dtsize(dest) == 0); - for (sym = (Agsym_t *) dtfirst(src); sym; + for (sym = dtfirst(src); sym; sym = (Agsym_t *) dtnext(src, sym)) { newsym = agnewsym(g, sym->name, sym->defval, sym->id, kind); newsym->print = sym->print; @@ -197,7 +197,7 @@ static Agrec_t *agmakeattrs(Agraph_t * context, void *obj) sz = MINATTR; rec->str = agalloc(agraphof(obj), (size_t) sz * sizeof(char *)); /* doesn't call agxset() so no obj-modified callbacks occur */ - for (sym = (Agsym_t *) dtfirst(datadict); sym; + for (sym = dtfirst(datadict); sym; sym = (Agsym_t *) dtnext(datadict, sym)) rec->str[sym->id] = agstrdup(agraphof(obj), sym->defval); } else { @@ -350,7 +350,7 @@ Agsym_t *agnxtattr(Agraph_t * g, int kind, Agsym_t * attr) if (attr) rv = (Agsym_t *) dtnext(d, attr); else - rv = (Agsym_t *) dtfirst(d); + rv = dtfirst(d); } else rv = 0; return rv; diff --git a/lib/cgraph/edge.c b/lib/cgraph/edge.c index aa73c553a..eb23be3d9 100644 --- a/lib/cgraph/edge.c +++ b/lib/cgraph/edge.c @@ -30,7 +30,7 @@ Agedge_t *agfstout(Agraph_t * g, Agnode_t * n) sn = agsubrep(g, n); if (sn) { dtrestore(g->e_seq, sn->out_seq); - e = (Agedge_t *) dtfirst(g->e_seq); + e = dtfirst(g->e_seq); sn->out_seq = dtextract(g->e_seq); } return e; @@ -61,7 +61,7 @@ Agedge_t *agfstin(Agraph_t * g, Agnode_t * n) sn = agsubrep(g, n); if (sn) { dtrestore(g->e_seq, sn->in_seq); - e = (Agedge_t *) dtfirst(g->e_seq); + e = dtfirst(g->e_seq); sn->in_seq = dtextract(g->e_seq); } return e; diff --git a/lib/cgraph/node.c b/lib/cgraph/node.c index eb76ee7d2..ca92749b8 100644 --- a/lib/cgraph/node.c +++ b/lib/cgraph/node.c @@ -38,7 +38,7 @@ static Agnode_t *agfindnode_by_name(Agraph_t * g, char *name) Agnode_t *agfstnode(Agraph_t * g) { Agsubnode_t *sn; - sn = (Agsubnode_t *) dtfirst(g->n_seq); + sn = dtfirst(g->n_seq); return sn ? sn->node : NULL; } diff --git a/lib/cgraph/pend.c b/lib/cgraph/pend.c index 1f4cc2fae..b9c0ad67b 100644 --- a/lib/cgraph/pend.c +++ b/lib/cgraph/pend.c @@ -241,7 +241,7 @@ static void cb(Dict_t * dict, int callback_kind) Agcbstack_t *stack; if (dict) - while ((pcb = (pending_cb_t *) dtfirst(dict))) { + while ((pcb = dtfirst(dict))) { g = pcb->g; stack = g->clos->cb; switch (callback_kind) { diff --git a/lib/cgraph/subg.c b/lib/cgraph/subg.c index 5a2218596..e09c8fc04 100644 --- a/lib/cgraph/subg.c +++ b/lib/cgraph/subg.c @@ -71,7 +71,7 @@ Agraph_t *agsubg(Agraph_t * g, char *name, int cflag) Agraph_t *agfstsubg(Agraph_t * g) { - return (Agraph_t *) dtfirst(g->g_dict); + return dtfirst(g->g_dict); } Agraph_t *agnxtsubg(Agraph_t * subg) diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c index b6a2ffc98..32ed0ffdb 100644 --- a/lib/cgraph/write.c +++ b/lib/cgraph/write.c @@ -242,7 +242,7 @@ static int write_dict(Agraph_t * g, iochan_t * ofile, char *name, view = dtview(dict, NULL); else view = 0; - for (sym = (Agsym_t *) dtfirst(dict); sym; + for (sym = dtfirst(dict); sym; sym = (Agsym_t *) dtnext(dict, sym)) { if (EMPTY(sym->defval) && !sym->print) { /* try to skip empty str (default) */ if (view == NULL) @@ -408,7 +408,7 @@ static int not_default_attrs(Agraph_t * g, Agnode_t * n) NOTUSED(g); if ((data = agattrrec(n))) { - for (sym = (Agsym_t *) dtfirst(data->dict); sym; + for (sym = dtfirst(data->dict); sym; sym = (Agsym_t *) dtnext(data->dict, sym)) { if (data->str[sym->id] != sym->defval) return TRUE; @@ -474,7 +474,7 @@ static int write_nondefault_attrs(void *obj, iochan_t * ofile, data = agattrrec(obj); g = agraphof(obj); if (data) - for (sym = (Agsym_t *) dtfirst(defdict); sym; + for (sym = dtfirst(defdict); sym; sym = (Agsym_t *) dtnext(defdict, sym)) { if ((AGTYPE(obj) == AGINEDGE) || (AGTYPE(obj) == AGOUTEDGE)) { if (Tailport && (sym->id == Tailport->id)) diff --git a/lib/circogen/blockpath.c b/lib/circogen/blockpath.c index 138da797c..24f93523b 100644 --- a/lib/circogen/blockpath.c +++ b/lib/circogen/blockpath.c @@ -423,7 +423,7 @@ static int count_all_crossings(nodelist_t * list, Agraph_t * subg) edgelistitem *eitem; Agedge_t *ep; - for (eitem = (edgelistitem *) dtfirst(openEdgeList); eitem; + for (eitem = dtfirst(openEdgeList); eitem; eitem = (edgelistitem *) dtnext(openEdgeList, eitem)) { ep = eitem->edge; diff --git a/lib/circogen/deglist.c b/lib/circogen/deglist.c index a7a843340..7b1878fed 100644 --- a/lib/circogen/deglist.c +++ b/lib/circogen/deglist.c @@ -130,7 +130,7 @@ Agnode_t *firstDeglist(deglist_t * list) degitem *ip; Agnode_t *np; - ip = (degitem *) dtfirst(list); + ip = dtfirst(list); if (ip) { np = ip->np; ip->np = ND_next(np); @@ -147,7 +147,7 @@ void printDeglist(deglist_t * dl) degitem *ip; node_t *np; fprintf(stderr, " dl:\n"); - for (ip = (degitem *) dtfirst(dl); ip; ip = (degitem *) dtnext(dl, ip)) { + for (ip = dtfirst(dl); ip; ip = (degitem *) dtnext(dl, ip)) { np = ip->np; if (np) fprintf(stderr, " (%d)", ip->deg); diff --git a/lib/circogen/nodeset.c b/lib/circogen/nodeset.c index 5b01678c6..5aeef35b4 100644 --- a/lib/circogen/nodeset.c +++ b/lib/circogen/nodeset.c @@ -111,7 +111,7 @@ int sizeNodeset(nodeset_t * ns) void printNodeset(nodeset_t * ns) { nsitem_t *ip; - for (ip = (nsitem_t *) dtfirst(ns); ip; + for (ip = dtfirst(ns); ip; ip = (nsitem_t *) dtnext(ns, ip)) { fprintf(stderr, "%s", agnameof(ip->np)); } diff --git a/lib/common/htmlparse.y b/lib/common/htmlparse.y index fcd752c15..6b24794fa 100644 --- a/lib/common/htmlparse.y +++ b/lib/common/htmlparse.y @@ -245,7 +245,7 @@ mkText(void) if (cnt) { int i = 0; hft->spans = N_NEW(cnt,htextspan_t); - for(fl=(fspan *)dtfirst(ispan); fl; fl=(fspan *)dtnext(ispan,fl)) { + for(fl=dtfirst(ispan); fl; fl=(fspan *)dtnext(ispan,fl)) { hft->spans[i] = fl->lp; i++; } diff --git a/lib/expr/excc.c b/lib/expr/excc.c index 0a179dfc2..7ba7a8d3c 100644 --- a/lib/expr/excc.c +++ b/lib/expr/excc.c @@ -732,7 +732,7 @@ exdump(Expr_t* expr, Exnode_t* node, Sfio_t* sp) if (node) gen(cc, node); else - for (sym = (Exid_t*)dtfirst(expr->symbols); sym; sym = (Exid_t*)dtnext(expr->symbols, sym)) + for (sym = dtfirst(expr->symbols); sym; sym = (Exid_t*)dtnext(expr->symbols, sym)) if (sym->lex == PROCEDURE && sym->value) { sfprintf(sp, "%s:\n", sym->name); diff --git a/lib/expr/exeval.c b/lib/expr/exeval.c index d713508f4..fb782a8f3 100644 --- a/lib/expr/exeval.c +++ b/lib/expr/exeval.c @@ -1136,7 +1136,7 @@ eval(Expr_t* ex, Exnode_t* expr, void* env) if (expr->data.generate.array->op == DYNAMIC) { n = expr->data.generate.index->type == STRING; - for (assoc = (Exassoc_t*)dtfirst((Dt_t*)expr->data.generate.array->data.variable.symbol->local.pointer); assoc; assoc = (Exassoc_t*)dtnext((Dt_t*)expr->data.generate.array->data.variable.symbol->local.pointer, assoc)) + for (assoc = dtfirst((Dt_t*)expr->data.generate.array->data.variable.symbol->local.pointer); assoc; assoc = (Exassoc_t*)dtnext((Dt_t*)expr->data.generate.array->data.variable.symbol->local.pointer, assoc)) { v.integer++; if (n) diff --git a/lib/expr/exgram.h b/lib/expr/exgram.h index 37ea76b98..8e7f1d5cb 100644 --- a/lib/expr/exgram.h +++ b/lib/expr/exgram.h @@ -1025,7 +1025,7 @@ excomp(Expr_t* p, const char* name, int line, const char* sp, Sfio_t* fp) p->eof = eof; if (expr.statics) { - for (v = (Exid_t*)dtfirst(p->symbols); v; v = (Exid_t*)dtnext(p->symbols, v)) + for (v = dtfirst(p->symbols); v; v = (Exid_t*)dtnext(p->symbols, v)) if (v->isstatic) { dtdelete(p->symbols, v); diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index 6fdf98f0e..a3abb2ede 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -542,7 +542,7 @@ dumpChanG (channel* cp, int v) if (dtsize(adj) == 0) continue; putSeg (stderr, cp->seg_list[k]); fputs (" ->\n", stderr); - for (ip = (intitem*)dtfirst(adj); ip; ip = (intitem*)dtnext(adj, ip)) { + for (ip = dtfirst(adj); ip; ip = (intitem*)dtnext(adj, ip)) { fputs (" ", stderr); putSeg (stderr, cp->seg_list[ip->id]); fputs ("\n", stderr);