From 7181160b2c32b1bb804792990783fa25c1122bae Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 17 Oct 2022 17:57:19 -0700 Subject: Remove unnecessary casts of return values from malloc() Not needed in C89 and later Signed-off-by: Alan Coopersmith --- src/XrrConfig.c | 2 +- src/XrrCrtc.c | 4 ++-- src/XrrOutput.c | 2 +- src/XrrProperty.c | 2 +- src/XrrProvider.c | 4 ++-- src/XrrProviderProperty.c | 2 +- src/XrrScreen.c | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/XrrConfig.c b/src/XrrConfig.c index 48b7987..af4b94f 100644 --- a/src/XrrConfig.c +++ b/src/XrrConfig.c @@ -283,7 +283,7 @@ static XRRScreenConfiguration *_XRRGetScreenInfo (Display *dpy, (rep.nSizes * sizeof (XRRScreenSize) + rep.nrateEnts * sizeof (int)); - scp = (struct _XRRScreenConfiguration *) Xmalloc(rbytes); + scp = Xmalloc(rbytes); } else { nbytes = 0; nbytesRead = 0; diff --git a/src/XrrCrtc.c b/src/XrrCrtc.c index 2da7ed2..76024b1 100644 --- a/src/XrrCrtc.c +++ b/src/XrrCrtc.c @@ -75,7 +75,7 @@ XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc) rep.nOutput * sizeof (RROutput) + rep.nPossibleOutput * sizeof (RROutput)); - xci = (XRRCrtcInfo *) Xmalloc(rbytes); + xci = Xmalloc(rbytes); } else { @@ -530,7 +530,7 @@ XRRGetPanning (Display *dpy, XRRScreenResources *resources, RRCrtc crtc) return NULL; } - if (! (xp = (XRRPanning *) Xmalloc(sizeof(XRRPanning))) ) { + if (! (xp = Xmalloc(sizeof(XRRPanning))) ) { _XEatData (dpy, sizeof(XRRPanning)); UnlockDisplay (dpy); SyncHandle (); diff --git a/src/XrrOutput.c b/src/XrrOutput.c index 30f3d40..7d04322 100644 --- a/src/XrrOutput.c +++ b/src/XrrOutput.c @@ -90,7 +90,7 @@ XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output) rep.nClones * sizeof (RROutput) + rep.nameLength + 1); /* '\0' terminate name */ - xoi = (XRROutputInfo *) Xmalloc(rbytes); + xoi = Xmalloc(rbytes); if (xoi == NULL) { _XEatDataWords (dpy, rep.length - (OutputInfoExtra >> 2)); UnlockDisplay (dpy); diff --git a/src/XrrProperty.c b/src/XrrProperty.c index 0a4471a..bc7da90 100644 --- a/src/XrrProperty.c +++ b/src/XrrProperty.c @@ -60,7 +60,7 @@ XRRListOutputProperties (Display *dpy, RROutput output, int *nprop) size_t rbytes = rep.nAtoms * sizeof (Atom); size_t nbytes = rep.nAtoms << 2; - props = (Atom *) Xmalloc (rbytes); + props = Xmalloc (rbytes); if (props == NULL) { _XEatDataWords (dpy, rep.length); UnlockDisplay (dpy); diff --git a/src/XrrProvider.c b/src/XrrProvider.c index 1c7c43b..a514b3f 100644 --- a/src/XrrProvider.c +++ b/src/XrrProvider.c @@ -67,7 +67,7 @@ XRRGetProviderResources(Display *dpy, Window window) rbytes = (sizeof(XRRProviderResources) + rep.nProviders * sizeof(RRProvider)); - xrpr = (XRRProviderResources *) Xmalloc(rbytes); + xrpr = Xmalloc(rbytes); } else { nbytes = 0; nbytesRead = 0; @@ -150,7 +150,7 @@ XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provi rep.nAssociatedProviders * (sizeof(RRProvider) + sizeof(unsigned int))+ rep.nameLength + 1); - xpi = (XRRProviderInfo *)Xmalloc(rbytes); + xpi = Xmalloc(rbytes); if (xpi == NULL) { _XEatDataWords (dpy, rep.length); UnlockDisplay (dpy); diff --git a/src/XrrProviderProperty.c b/src/XrrProviderProperty.c index 6d0d186..2629f44 100644 --- a/src/XrrProviderProperty.c +++ b/src/XrrProviderProperty.c @@ -60,7 +60,7 @@ XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop) size_t rbytes = rep.nAtoms * sizeof (Atom); size_t nbytes = rep.nAtoms << 2; - props = (Atom *) Xmalloc (rbytes); + props = Xmalloc (rbytes); if (props == NULL) { _XEatDataWords (dpy, rep.length); UnlockDisplay (dpy); diff --git a/src/XrrScreen.c b/src/XrrScreen.c index 3773c88..d425cc4 100644 --- a/src/XrrScreen.c +++ b/src/XrrScreen.c @@ -127,8 +127,8 @@ doGetScreenResources (Display *dpy, Window window, int poll) rep.nModes * sizeof (XRRModeInfo) + rep.nbytesNames + rep.nModes); /* '\0' terminate names */ - xrsr = (XRRScreenResources *) Xmalloc(rbytes); - wire_names = (char *) Xmalloc (rep.nbytesNames); + xrsr = Xmalloc(rbytes); + wire_names = Xmalloc (rep.nbytesNames); } else { nbytes = 0; nbytesRead = 0; -- cgit v1.2.1