]> granicus.if.org Git - graphviz/commitdiff
remove some unnecessary casts
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 22 Nov 2020 05:33:45 +0000 (21:33 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 23 Jan 2021 19:24:27 +0000 (11:24 -0800)
These pointers implicitly coerce.

lib/cgraph/rec.c
lib/fdpgen/clusteredges.c
lib/fdpgen/comp.c
lib/fdpgen/grid.c
lib/fdpgen/layout.c

index d57e75ae01445f90081420ad952fe825dcc952f6..0a51db4f557a815f2531de100af2dee1de75c6b0 100644 (file)
@@ -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;
 }
 
 
index db31a6c9d8828bb79e66ac81f89b2fb51b506d29..67d490d11adf50a03d93b4cedd38fb1591b4d37d 100644 (file)
@@ -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:
index 591a5f988735d46daa3110bbacc2dbe6954891c5..2cb23cddbd41ae04d74f1bed899cc92424a348ac 100644 (file)
@@ -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);
     }
index ae01bc8cb0943f858c4154e9e50078060e1263db..06612f8e3687f035c4ddf87556b178cb22bacbfa 100644 (file)
@@ -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);
index c82126f3558d9e888367802082d8c8eb6fb3205b..cdf494acb4dbe3ca8a8159b49fd4b46c5e1e3555 100644 (file)
@@ -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);