From 02338186d943d38e22e435b44ce89bdb2d3a279d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 21 Nov 2020 21:33:45 -0800 Subject: [PATCH] remove some unnecessary casts These pointers implicitly coerce. --- lib/cgraph/rec.c | 6 +++--- lib/fdpgen/clusteredges.c | 2 +- lib/fdpgen/comp.c | 6 +++--- lib/fdpgen/grid.c | 2 +- lib/fdpgen/layout.c | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/cgraph/rec.c b/lib/cgraph/rec.c index d57e75ae0..0a51db4f5 100644 --- a/lib/cgraph/rec.c +++ b/lib/cgraph/rec.c @@ -91,17 +91,17 @@ void *agbindrec(void *arg_obj, char *recname, unsigned int recsize, Agobj_t *obj; Agrec_t *rec; - obj = (Agobj_t *) arg_obj; + obj = arg_obj; g = agraphof(obj); rec = aggetrec(obj, recname, FALSE); if ((rec == NIL(Agrec_t *)) && (recsize > 0)) { - rec = (Agrec_t *) agalloc(g, recsize); + rec = agalloc(g, recsize); rec->name = agstrdup(g, recname); objputrec(g, obj, rec); } if (mtf) aggetrec(arg_obj, recname, TRUE); - return (void *) rec; + return rec; } diff --git a/lib/fdpgen/clusteredges.c b/lib/fdpgen/clusteredges.c index db31a6c9d..67d490d11 100644 --- a/lib/fdpgen/clusteredges.c +++ b/lib/fdpgen/clusteredges.c @@ -185,7 +185,7 @@ raiseLevel(objlist * l, int maxlvl, void *ex, int minlvl, graph_t ** gp, ex = g; g = GPARENT(g); } - *gp = (graph_t *) ex; + *gp = ex; } /* objectList: diff --git a/lib/fdpgen/comp.c b/lib/fdpgen/comp.c index 591a5f988..2cb23cddb 100644 --- a/lib/fdpgen/comp.c +++ b/lib/fdpgen/comp.c @@ -78,7 +78,7 @@ graph_t **findCComp(graph_t * g, int *cnt, int *pinned) sprintf(name, "cc%s_%d", agnameof(g), c_cnt++ + C_cnt); subg = agsubg(g, name,1); agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); - GD_alg(subg) = (void *) NEW(gdata); + GD_alg(subg) = NEW(gdata); PORTS(subg) = pp; NPORTS(subg) = NPORTS(g); for (; pp->n; pp++) { @@ -99,7 +99,7 @@ graph_t **findCComp(graph_t * g, int *cnt, int *pinned) sprintf(name, "cc%s_%d", agnameof(g), c_cnt++ + C_cnt); subg = agsubg(g, name,1); agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); - GD_alg(subg) = (void *) NEW(gdata); + GD_alg(subg) = NEW(gdata); } pinflag = 1; dfs(g, n, subg, marks); @@ -114,7 +114,7 @@ graph_t **findCComp(graph_t * g, int *cnt, int *pinned) sprintf(name, "cc%s+%d", agnameof(g), c_cnt++ + C_cnt); subg = agsubg(g, name,1); agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data - GD_alg(subg) = (void *) NEW(gdata); + GD_alg(subg) = NEW(gdata); dfs(g, n, subg, marks); nodeInduce(subg); } diff --git a/lib/fdpgen/grid.c b/lib/fdpgen/grid.c index ae01bc8cb..06612f8e3 100644 --- a/lib/fdpgen/grid.c +++ b/lib/fdpgen/grid.c @@ -114,7 +114,7 @@ static Grid *_grid; /* hack because can't attach info. to Dt_t */ */ static void *newCell(Dt_t * d, void *obj, Dtdisc_t * disc) { - cell *cellp = (cell *) obj; + cell *cellp = obj; cell *newp; NOTUSED(disc); diff --git a/lib/fdpgen/layout.c b/lib/fdpgen/layout.c index c82126f35..cdf494acb 100644 --- a/lib/fdpgen/layout.c +++ b/lib/fdpgen/layout.c @@ -187,7 +187,7 @@ static node_t *mkDeriveNode(graph_t * dg, char *name) dn = agnode(dg, name,1); agbindrec(dn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data - ND_alg(dn) = (void *) NEW(dndata); /* free in freeDeriveNode */ + ND_alg(dn) = NEW(dndata); /* free in freeDeriveNode */ ND_pos(dn) = N_GNEW(GD_ndim(dg), double); /* fprintf (stderr, "Creating %s\n", dn->name); */ return dn; @@ -433,7 +433,7 @@ static graph_t *deriveGraph(graph_t * g, layout_info * infop) dg = agopen("derived", Agstrictdirected,NIL(Agdisc_t *)); agbindrec(dg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); - GD_alg(dg) = (void *) NEW(gdata); /* freed in freeDeriveGraph */ + GD_alg(dg) = NEW(gdata); /* freed in freeDeriveGraph */ #ifdef DEBUG GORIG(dg) = g; #endif @@ -581,8 +581,8 @@ static graph_t *deriveGraph(graph_t * g, layout_info * infop) */ static int ecmp(const void *v1, const void *v2) { - const erec *e1 = (const erec *) v1; - const erec *e2 = (const erec *) v2; + const erec *e1 = v1; + const erec *e2 = v2; if (e1->alpha > e2->alpha) return 1; else if (e1->alpha < e2->alpha) @@ -1029,7 +1029,7 @@ mkClusters (graph_t * g, clist_t* pclist, graph_t* parent) { if (!strncmp(agnameof(subg), "cluster", 7)) { agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); - GD_alg(subg) = (void *) NEW(gdata); /* freed in cleanup_subgs */ + GD_alg(subg) = NEW(gdata); /* freed in cleanup_subgs */ GD_ndim(subg) = GD_ndim(parent); LEVEL(subg) = LEVEL(parent) + 1; GPARENT(subg) = parent; @@ -1050,7 +1050,7 @@ mkClusters (graph_t * g, clist_t* pclist, graph_t* parent) static void fdp_init_graph(Agraph_t * g) { setEdgeType (g, ET_LINE); - GD_alg(g) = (void *) NEW(gdata); /* freed in cleanup_graph */ + GD_alg(g) = NEW(gdata); /* freed in cleanup_graph */ GD_ndim(g) = late_int(g, agattr(g,AGRAPH, "dim", NULL), 2, 2); Ndim = GD_ndim(g) = MIN(GD_ndim(g), MAXDIM); -- 2.40.0