]> granicus.if.org Git - graphviz/commitdiff
remove unnecessary casts on arguments to free()
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 22 Oct 2020 00:04:53 +0000 (17:04 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 29 Oct 2020 00:13:12 +0000 (17:13 -0700)
These implicitly coerce to void* so no cast is needed.

lib/cdt/dtopen.c
lib/neatogen/legal.c
lib/sfio/sfmode.c
lib/sfio/sfnew.c
lib/sfio/sfsetbuf.c
tclpkg/tclpathplan/find_ints.c
tclpkg/tclpathplan/tclpathplan.c

index 03d4aa620b66429b152dbc02ecd3862e8cdda5e1..4f6ac9d895d1773c208bdb3a145f293c204671c3 100644 (file)
@@ -43,7 +43,7 @@ Dt_t* dtopen(Dtdisc_t* disc, Dtmethod_t* meth)
                        if(!disc->memoryf)
                                goto err_open;
 
-                       free((void*)dt);
+                       free(dt);
                        if(!(dt = (*disc->memoryf)(0, 0, sizeof(Dt_t), disc)) )
                                return NIL(Dt_t*);
                        dt->searchf = NIL(Dtsearch_f);
@@ -59,7 +59,7 @@ Dt_t* dtopen(Dtdisc_t* disc, Dtmethod_t* meth)
        /* allocate sharable data */
        if(!(data = (Dtdata_t*)(dt->memoryf)(dt,NIL(void*),sizeof(Dtdata_t),disc)) )
        { err_open:
-               free((void*)dt);
+               free(dt);
                return NIL(Dt_t*);
        }
 
index 6f48c73851e11a70e67edac2a0692fdd0f224e7a..0fa3ed56019548f96ef58d5b372721c9058378fa 100644 (file)
@@ -352,7 +352,7 @@ find_ints(vertex vertex_list[],
                    tempa->last->next = tempa->next;
                    tempa->next->last = tempa->last;
                }
-               free((char *) tempa);
+               free(tempa);
                all.number--;
                templ->active = 0;
                break;          /* end of case 1        */
index 23ff857f478f0ae253838616541d20ff3d7f1559..0cc883ee14365f011a361a2a366c1edcaab5963c 100644 (file)
@@ -112,7 +112,7 @@ int _sfsetpool(Sfio_t * f)
            memcpy((void *) array, (void *) p->sf,
                   p->n_sf * sizeof(Sfio_t *));
            if (p->sf != p->array)
-               free((void *) p->sf);
+               free(p->sf);
 
            p->sf = array;
            p->s_sf = n;
@@ -253,7 +253,7 @@ static int _sfpmode(Sfio_t * f, int type)
     if (type == SF_WRITE) {    /* save unread data */
        p->ndata = f->endb - f->next;
        if (p->ndata > p->size) {
-           free((char *) p->rdata);
+           free(p->rdata);
            if ((p->rdata = malloc(p->ndata)))
                p->size = p->ndata;
            else {
index 05171fa2a2cf56d257ae08c7f2b4667a177c075d..b982ccb2bc15cbb3f9a57ec5340736de3d9f4676 100644 (file)
@@ -55,7 +55,7 @@ Sfio_t *sfnew(Sfio_t * oldf, void * buf, size_t size, int file,
            if (f->data
                && ((flags & SF_STRING) || size != (size_t) SF_UNBOUND)) {
                if (sflags & SF_MALLOC)
-                   free((void *) f->data);
+                   free(f->data);
                f->data = NIL(uchar *);
            }
            if (!f->data)
index a2db25021ec687b495507e855d1cf71361397f16..5445c571ade43058cf9c73cedd5180f127def9be 100644 (file)
@@ -269,7 +269,7 @@ void *sfsetbuf(Sfio_t * f, void * buf, size_t size)
     f->flags = (unsigned short)((f->flags & ~SF_MALLOC) | sf_malloc);
 
     if (obuf && obuf != f->data && osize > 0 && (oflags & SF_MALLOC)) {
-       free((void *) obuf);
+       free(obuf);
        obuf = NIL(uchar *);
     }
 
index 1296c952475afdfefd18f90071b8597985942e10..87ac2005919412f13f75397223760d3e2a5b6f99 100644 (file)
@@ -93,7 +93,7 @@ void find_ints(struct vertex vertex_list[],
                    tempa->last->next = tempa->next;
                    tempa->next->last = tempa->last;
                }
-               free((char *) tempa);
+               free(tempa);
                all.number--;
                templ->active = NIL;
                break;          /* end of case 1        */
index 9a8fb7f2e402a7c7c47b164fb993688c03ea3bcd..e2ab78bd0ec6287462123b39a1eb8260a4f3ad6e 100644 (file)
@@ -501,7 +501,7 @@ vgpanecmd(ClientData clientData, Tcl_Interp * interp, int argc,
            Pobsclose(vgp->vc);
        free(vgp->poly);        /* ### */
        Tcl_DeleteCommand(interp, argv[0]);
-       free((char *) tclhandleFree(vgpaneTable, argv[0]));
+       free(tclhandleFree(vgpaneTable, argv[0]));
        return TCL_OK;
 
     } else if ((c == 'f') && (strncmp(argv[1], "find", length) == 0)) {