From: Matthew Fernandez Date: Thu, 22 Oct 2020 00:04:53 +0000 (-0700) Subject: remove unnecessary casts on arguments to free() X-Git-Tag: 2.46.0~20^2^2~9^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c898c62b0e89868293569e5085d4e862e78ea42d;p=graphviz remove unnecessary casts on arguments to free() These implicitly coerce to void* so no cast is needed. --- diff --git a/lib/cdt/dtopen.c b/lib/cdt/dtopen.c index 03d4aa620..4f6ac9d89 100644 --- a/lib/cdt/dtopen.c +++ b/lib/cdt/dtopen.c @@ -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*); } diff --git a/lib/neatogen/legal.c b/lib/neatogen/legal.c index 6f48c7385..0fa3ed560 100644 --- a/lib/neatogen/legal.c +++ b/lib/neatogen/legal.c @@ -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 */ diff --git a/lib/sfio/sfmode.c b/lib/sfio/sfmode.c index 23ff857f4..0cc883ee1 100644 --- a/lib/sfio/sfmode.c +++ b/lib/sfio/sfmode.c @@ -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 { diff --git a/lib/sfio/sfnew.c b/lib/sfio/sfnew.c index 05171fa2a..b982ccb2b 100644 --- a/lib/sfio/sfnew.c +++ b/lib/sfio/sfnew.c @@ -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) diff --git a/lib/sfio/sfsetbuf.c b/lib/sfio/sfsetbuf.c index a2db25021..5445c571a 100644 --- a/lib/sfio/sfsetbuf.c +++ b/lib/sfio/sfsetbuf.c @@ -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 *); } diff --git a/tclpkg/tclpathplan/find_ints.c b/tclpkg/tclpathplan/find_ints.c index 1296c9524..87ac20059 100644 --- a/tclpkg/tclpathplan/find_ints.c +++ b/tclpkg/tclpathplan/find_ints.c @@ -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 */ diff --git a/tclpkg/tclpathplan/tclpathplan.c b/tclpkg/tclpathplan/tclpathplan.c index 9a8fb7f2e..e2ab78bd0 100644 --- a/tclpkg/tclpathplan/tclpathplan.c +++ b/tclpkg/tclpathplan/tclpathplan.c @@ -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)) {