From 6a8512ec03ae5311241156292ba5d6bee52be7fc Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 21 Oct 2020 17:04:38 -0700 Subject: [PATCH] remove some unnecessary casts of arguments to realloc() These parameters implicitly coerce to void* with no casting required. --- lib/pathplan/route.c | 2 +- lib/pathplan/shortest.c | 8 ++++---- lib/sfio/sfexcept.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pathplan/route.c b/lib/pathplan/route.c index 14ddaccc0..12a32ad64 100644 --- a/lib/pathplan/route.c +++ b/lib/pathplan/route.c @@ -524,7 +524,7 @@ static void growops(int newopn) longjmp(jbuf,1); } } else { - if (!(ops = realloc((void *) ops, POINTSIZE * newopn))) { + if (!(ops = realloc(ops, POINTSIZE * newopn))) { prerror("cannot realloc ops"); longjmp(jbuf,1); } diff --git a/lib/pathplan/shortest.c b/lib/pathplan/shortest.c index 63603b45f..e679972fc 100644 --- a/lib/pathplan/shortest.c +++ b/lib/pathplan/shortest.c @@ -522,11 +522,11 @@ static void growpnls(int newpnln) longjmp(jbuf,1); } } else { - if (!(pnls = realloc((void *) pnls, POINTNLINKSIZE * newpnln))) { + if (!(pnls = realloc(pnls, POINTNLINKSIZE * newpnln))) { prerror("cannot realloc pnls"); longjmp(jbuf,1); } - if (!(pnlps = realloc((void *) pnlps, POINTNLINKPSIZE * newpnln))) { + if (!(pnlps = realloc(pnlps, POINTNLINKPSIZE * newpnln))) { prerror("cannot realloc pnlps"); longjmp(jbuf,1); } @@ -544,7 +544,7 @@ static void growtris(int newtrin) longjmp(jbuf,1); } } else { - if (!(tris = realloc((void *) tris, TRIANGLESIZE * newtrin))) { + if (!(tris = realloc(tris, TRIANGLESIZE * newtrin))) { prerror("cannot realloc tris"); longjmp(jbuf,1); } @@ -563,7 +563,7 @@ static void growdq(int newdqn) longjmp(jbuf,1); } } else { - if (!(dq.pnlps = realloc((void *) dq.pnlps, POINTNLINKPSIZE * newdqn))) { + if (!(dq.pnlps = realloc(dq.pnlps, POINTNLINKPSIZE * newdqn))) { prerror("cannot realloc dq.pnls"); longjmp(jbuf,1); } diff --git a/lib/sfio/sfexcept.c b/lib/sfio/sfexcept.c index cb4a8702b..d3dfc7aac 100644 --- a/lib/sfio/sfexcept.c +++ b/lib/sfio/sfexcept.c @@ -72,7 +72,7 @@ int _sfexcept(Sfio_t * f, int type, ssize_t io, Sfdisc_t * disc) io = SF_GRAIN; size = ((size + io + SF_GRAIN - 1) / SF_GRAIN) * SF_GRAIN; if (f->size > 0) - data = realloc((char *) f->data, size); + data = realloc(f->data, size); else data = malloc(size); if (!data) -- 2.40.0