diff options
author | Adam Jackson <ajax@redhat.com> | 2009-01-22 02:11:16 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-01-22 02:11:16 -0500 |
commit | 132b464d734b077038e19b21e46d3a6258f4b998 (patch) | |
tree | 4fe179cf69d6013a32aaa8e17a28b3fc905e6274 | |
parent | 0fb4390526bb829ab17ff4635d41a3012f63c1b2 (diff) |
Remove a bunch of useless casts.
We've had void * for twenty years now people let's try to act like we
know how it works.
72 files changed, 343 insertions, 376 deletions
diff --git a/Xext/mbuf.c b/Xext/mbuf.c index 336ef194f..09399b65e 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -203,7 +203,7 @@ MultibufferExtensionInit() for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; - if (!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) + if (!(pMultibufferScreen = xalloc (sizeof (MultibufferScreenRec)))) { for (j = 0; j < i; j++) xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey)); @@ -348,8 +348,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint) xRectangle clearRect; DestroyImageBuffers(pWin); - pMultibuffers = (MultibuffersPtr) xalloc (sizeof (MultibuffersRec) + - nbuf * sizeof (MultibufferRec)); + pMultibuffers = xalloc (sizeof (MultibuffersRec) + nbuf * sizeof (MultibufferRec)); if (!pMultibuffers) return BadAlloc; pMultibuffers->pWindow = pWin; @@ -504,8 +503,8 @@ ProcDisplayImageBuffers (client) return Success; minDelay = stuff->minDelay; ids = (XID *) &stuff[1]; - ppMultibuffers = (MultibuffersPtr *) xalloc(nbuf * sizeof (MultibuffersPtr)); - pMultibuffer = (MultibufferPtr *) xalloc(nbuf * sizeof (MultibufferPtr)); + ppMultibuffers = xalloc(nbuf * sizeof (MultibuffersPtr)); + pMultibuffer = xalloc(nbuf * sizeof (MultibufferPtr)); if (!ppMultibuffers || !pMultibuffer) { if (ppMultibuffers) xfree(ppMultibuffers); @@ -645,7 +644,7 @@ ProcGetMBufferAttributes (client) pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); if (!pMultibuffers) return BadAccess; - ids = (XID *) xalloc (pMultibuffers->numMultibuffer * sizeof (XID)); + ids = xalloc (pMultibuffers->numMultibuffer * sizeof (XID)); if (!ids) return BadAlloc; for (i = 0; i < pMultibuffers->numMultibuffer; i++) @@ -782,8 +781,7 @@ ProcGetBufferInfo (client) pDepth = &pScreen->allowedDepths[i]; nInfo += pDepth->numVids; } - pInfo = (xMbufBufferInfo *) - xalloc (nInfo * sizeof (xMbufBufferInfo)); + pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo)); if (!pInfo) return BadAlloc; @@ -1264,8 +1262,8 @@ DisplayImageBuffers (ids, nbuf) MultibuffersPtr *pMultibuffers; int i, j; - pMultibuffer = (MultibufferPtr *) xalloc (nbuf * sizeof *pMultibuffer + - nbuf * sizeof *pMultibuffers); + pMultibuffer = xalloc (nbuf * sizeof *pMultibuffer + + nbuf * sizeof *pMultibuffers); if (!pMultibuffer) return BadAlloc; pMultibuffers = (MultibuffersPtr *) (pMultibuffer + nbuf); @@ -1390,7 +1388,7 @@ MultibufferExpose (pMultibuffer, pRegion) numRects = REGION_NUM_RECTS(pRegion); pBox = REGION_RECTS(pRegion); - pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent)); + pEvent = xalloc(numRects * sizeof(xEvent)); if (pEvent) { pe = pEvent; @@ -1744,7 +1742,7 @@ EventSelectForMultibuffer (pMultibuffer, client, mask) } if (!other) { /* new client that never selected events on this buffer before */ - other = (OtherClients *) xalloc (sizeof (OtherClients)); + other = xalloc (sizeof (OtherClients)); if (!other) return BadAlloc; other->mask = mask; diff --git a/Xext/mbufbf.c b/Xext/mbufbf.c index 877ccaabd..7d9d60a4f 100644 --- a/Xext/mbufbf.c +++ b/Xext/mbufbf.c @@ -221,7 +221,7 @@ bufMultibufferInit(pScreen, pMBScreen) pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs; pMBScreen->ResetProc = bufResetProc; /* Create devPrivate part */ - pMBPriv = (mbufBufferPrivPtr) xalloc(sizeof *pMBPriv); + pMBPriv = xalloc(sizeof *pMBPriv); if (!pMBPriv) return (FALSE); @@ -611,8 +611,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum) if (!pGC) return; - prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) * - sizeof(xRectangle)); + prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle)); if (!prect) { FreeScratchGC(pGC); diff --git a/Xext/mbufpx.c b/Xext/mbufpx.c index 01811d9a2..8421ba9eb 100644 --- a/Xext/mbufpx.c +++ b/Xext/mbufpx.c @@ -90,7 +90,7 @@ pixMultibufferInit(pScreen, pMBScreen) nInfo += pDepth->numVids; } - pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo)); + pInfo = xalloc (nInfo * sizeof (xMbufBufferInfo)); if (!pInfo) return FALSE; @@ -114,7 +114,7 @@ pixMultibufferInit(pScreen, pMBScreen) * Setup the devPrivate to mbufScreenRec */ - pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv)); + pMBPriv = xalloc(sizeof(* pMBPriv)); if (!pMBPriv) { xfree(pInfo); @@ -261,7 +261,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion) int nrects = REGION_NUM_RECTS(pRegion); BoxPtr pbox = REGION_RECTS(pRegion); - pRects = (xRectangle *)xalloc(nrects * sizeof(xRectangle)); + pRects = xalloc(nrects * sizeof(xRectangle)); if (pRects) { int i; diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 0f9096fe5..72a207ab8 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -116,7 +116,7 @@ int PanoramiXCreateWindow(ClientPtr client) } } - if(!(newWin = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + if(!(newWin = xalloc(sizeof(PanoramiXRes)))) return BadAlloc; newWin->type = XRT_WINDOW; @@ -644,7 +644,7 @@ int PanoramiXCreatePixmap(ClientPtr client) client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; - if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + if(!(newPix = xalloc(sizeof(PanoramiXRes)))) return BadAlloc; newPix->type = XRT_PIXMAP; @@ -744,7 +744,7 @@ int PanoramiXCreateGC(ClientPtr client) } } - if(!(newGC = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + if(!(newGC = xalloc(sizeof(PanoramiXRes)))) return BadAlloc; newGC->type = XRT_GC; @@ -1256,7 +1256,7 @@ int PanoramiXPolyPoint(ClientPtr client) isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; if (npoint > 0) { - origPts = (xPoint *) xalloc(npoint * sizeof(xPoint)); + origPts = xalloc(npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); FOR_NSCREENS_FORWARD(j){ @@ -1314,7 +1314,7 @@ int PanoramiXPolyLine(ClientPtr client) isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; if (npoint > 0){ - origPts = (xPoint *) xalloc(npoint * sizeof(xPoint)); + origPts = xalloc(npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); FOR_NSCREENS_FORWARD(j){ @@ -1375,7 +1375,7 @@ int PanoramiXPolySegment(ClientPtr client) if(nsegs & 4) return BadLength; nsegs >>= 3; if (nsegs > 0) { - origSegs = (xSegment *) xalloc(nsegs * sizeof(xSegment)); + origSegs = xalloc(nsegs * sizeof(xSegment)); memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment)); FOR_NSCREENS_FORWARD(j){ @@ -1437,7 +1437,7 @@ int PanoramiXPolyRectangle(ClientPtr client) if(nrects & 4) return BadLength; nrects >>= 3; if (nrects > 0){ - origRecs = (xRectangle *) xalloc(nrects * sizeof(xRectangle)); + origRecs = xalloc(nrects * sizeof(xRectangle)); memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle)); FOR_NSCREENS_FORWARD(j){ @@ -1497,7 +1497,7 @@ int PanoramiXPolyArc(ClientPtr client) if(narcs % sizeof(xArc)) return BadLength; narcs /= sizeof(xArc); if (narcs > 0){ - origArcs = (xArc *) xalloc(narcs * sizeof(xArc)); + origArcs = xalloc(narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc)); FOR_NSCREENS_FORWARD(j){ @@ -1553,7 +1553,7 @@ int PanoramiXFillPoly(ClientPtr client) count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; if (count > 0){ - locPts = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec)); + locPts = xalloc(count * sizeof(DDXPointRec)); memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec)); FOR_NSCREENS_FORWARD(j){ @@ -1614,7 +1614,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client) if(things & 4) return BadLength; things >>= 3; if (things > 0){ - origRects = (xRectangle *) xalloc(things * sizeof(xRectangle)); + origRects = xalloc(things * sizeof(xRectangle)); memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle)); FOR_NSCREENS_FORWARD(j){ @@ -1673,7 +1673,7 @@ int PanoramiXPolyFillArc(ClientPtr client) IF_RETURN((narcs % sizeof(xArc)), BadLength); narcs /= sizeof(xArc); if (narcs > 0) { - origArcs = (xArc *) xalloc(narcs * sizeof(xArc)); + origArcs = xalloc(narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc)); FOR_NSCREENS_FORWARD(j){ @@ -2071,7 +2071,7 @@ int PanoramiXCreateColormap(ClientPtr client) client, stuff->window, XRT_WINDOW, DixReadAccess))) return BadWindow; - if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + if(!(newCmap = xalloc(sizeof(PanoramiXRes)))) return BadAlloc; newCmap->type = XRT_COLORMAP; @@ -2140,7 +2140,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client) DixReadAccess | DixWriteAccess))) return BadColor; - if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + if(!(newCmap = xalloc(sizeof(PanoramiXRes)))) return BadAlloc; newCmap->type = XRT_COLORMAP; diff --git a/Xext/saver.c b/Xext/saver.c index dd8ebe890..3aaec3405 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -235,7 +235,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex; dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v); #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL) -#define New(t) ((t *) xalloc (sizeof (t))) +#define New(t) (xalloc (sizeof (t))) /**************** * ScreenSaverExtensionInit @@ -639,8 +639,7 @@ CreateSaverWindow (ScreenPtr pScreen) wantMap = wColormap (pWin); if (wantMap == None) return TRUE; - installedMaps = (Colormap *) xalloc (pScreen->maxInstalledCmaps * - sizeof (Colormap)); + installedMaps = xalloc (pScreen->maxInstalledCmaps * sizeof (Colormap)); numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps) (pScreen, installedMaps); for (i = 0; i < numInstalled; i++) @@ -977,7 +976,7 @@ ScreenSaverSetAttributes (ClientPtr client) goto bail; } /* over allocate for override redirect */ - values = (unsigned long *) xalloc ((len + 1) * sizeof (unsigned long)); + values = xalloc ((len + 1) * sizeof (unsigned long)); if (!values) { ret = BadAlloc; @@ -1379,7 +1378,7 @@ ProcScreenSaverSuspend (ClientPtr client) * to the record, so the screensaver will be reenabled and the record freed * if the client disconnects without reenabling it first. */ - this = (ScreenSaverSuspensionPtr) xalloc (sizeof (ScreenSaverSuspensionRec)); + this = xalloc (sizeof (ScreenSaverSuspensionRec)); if (!this) return BadAlloc; diff --git a/Xext/security.c b/Xext/security.c index e37906366..fc4691b0e 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -407,7 +407,7 @@ SecurityEventSelectForAuthorization( } } - pEventClient = (OtherClients *) xalloc(sizeof(OtherClients)); + pEventClient = xalloc(sizeof(OtherClients)); if (!pEventClient) return BadAlloc; pEventClient->mask = mask; @@ -539,7 +539,7 @@ ProcSecurityGenerateAuthorization( /* associate additional information with this auth ID */ - pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec)); + pAuth = xalloc(sizeof(SecurityAuthorizationRec)); if (!pAuth) { err = BadAlloc; diff --git a/Xext/shape.c b/Xext/shape.c index d8d564390..8827a0274 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -804,8 +804,7 @@ ProcShapeSelectInput (ClientPtr client) } /* build the entry */ - pNewShapeEvent = (ShapeEventPtr) - xalloc (sizeof (ShapeEventRec)); + pNewShapeEvent = xalloc (sizeof (ShapeEventRec)); if (!pNewShapeEvent) return BadAlloc; pNewShapeEvent->next = 0; @@ -827,7 +826,7 @@ ProcShapeSelectInput (ClientPtr client) */ if (!pHead) { - pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr)); + pHead = xalloc (sizeof (ShapeEventPtr)); if (!pHead || !AddResource (pWin->drawable.id, EventType, (pointer)pHead)) { @@ -1014,7 +1013,7 @@ ProcShapeGetRectangles (ClientPtr client) } if (!region) { nrects = 1; - rects = (xRectangle *) xalloc (sizeof (xRectangle)); + rects = xalloc (sizeof (xRectangle)); if (!rects) return BadAlloc; switch (stuff->kind) { @@ -1041,7 +1040,7 @@ ProcShapeGetRectangles (ClientPtr client) BoxPtr box; nrects = REGION_NUM_RECTS(region); box = REGION_RECTS(region); - rects = (xRectangle *) xalloc (nrects * sizeof (xRectangle)); + rects = xalloc (nrects * sizeof (xRectangle)); if (!rects && nrects) return BadAlloc; for (i = 0; i < nrects; i++, box++) { diff --git a/Xext/shm.c b/Xext/shm.c index ce566b601..7b63484a5 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -198,7 +198,7 @@ static Bool CheckForShmSyscall(void) if (shmid != -1) { /* Successful allocation - clean up */ - shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL); + shmctl(shmid, IPC_RMID, NULL); } else { @@ -265,7 +265,7 @@ ShmResetProc(ExtensionEntry *extEntry) for (i = 0; i < MAXSCREENS; i++) { - shmFuncs[i] = (ShmFuncsPtr)NULL; + shmFuncs[i] = NULL; } } @@ -422,7 +422,7 @@ ProcShmAttach(ClientPtr client) } else { - shmdesc = (ShmDescPtr) xalloc(sizeof(ShmDescRec)); + shmdesc = xalloc(sizeof(ShmDescRec)); if (!shmdesc) return BadAlloc; shmdesc->addr = shmat(stuff->shmid, 0, @@ -727,7 +727,7 @@ CreatePmap: VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); - if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) + if(!(newPix = xalloc(sizeof(PanoramiXRes)))) return BadAlloc; newPix->type = XRT_PIXMAP; diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c index 4d2a333d0..2616a5e5b 100644 --- a/Xext/sleepuntil.c +++ b/Xext/sleepuntil.c @@ -93,7 +93,7 @@ ClientSleepUntil (ClientPtr client, SertafiedGeneration = serverGeneration; BlockHandlerRegistered = FALSE; } - pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec)); + pRequest = xalloc (sizeof (SertafiedRec)); if (!pRequest) return FALSE; pRequest->pClient = client; diff --git a/Xext/sync.c b/Xext/sync.c index d529bec49..9236fab87 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -883,7 +883,7 @@ SyncCreateSystemCounter( } } - pCounter = SyncCreateCounter((ClientPtr)NULL, FakeClientID(0), initial); + pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial); if (pCounter) { diff --git a/Xext/xace.c b/Xext/xace.c index 86d70fe74..6eaba6dbc 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -284,7 +284,7 @@ XaceCensorImage( /* convert region to list-of-rectangles for PolyFillRect */ - pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle)); + pRects = xalloc(nRects * sizeof(xRectangle)); if (!pRects) { failed = TRUE; diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index dabbdd6e0..60189666e 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -125,7 +125,7 @@ CheckForShmSyscall(void) if (shmid != -1) { /* Successful allocation - clean up */ - shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL); + shmctl(shmid, IPC_RMID, NULL); } else { @@ -229,7 +229,7 @@ shmalloc( if (size < 3500) return (ShmDescPtr) NULL; - pDesc = (ShmDescRec *) xalloc(sizeof(ShmDescRec)); + pDesc = xalloc(sizeof(ShmDescRec)); if (!pDesc) return (ShmDescPtr) NULL; @@ -473,8 +473,7 @@ ProcXF86BigfontQueryFont( shmid = pDesc->shmid; } else { #endif - pCI = (xCharInfo *) - xalloc(nCharInfos * sizeof(xCharInfo)); + pCI = xalloc(nCharInfos * sizeof(xCharInfo)); if (!pCI) return BadAlloc; #ifdef HAS_SHM @@ -536,8 +535,7 @@ ProcXF86BigfontQueryFont( if (hashModulus > nCharInfos+1) hashModulus = nCharInfos+1; - tmp = (CARD16*) - xalloc((4*nCharInfos+1) * sizeof(CARD16)); + tmp = xalloc((4*nCharInfos+1) * sizeof(CARD16)); if (!tmp) { if (!pDesc) xfree(pCI); return BadAlloc; @@ -621,8 +619,7 @@ ProcXF86BigfontQueryFont( ? nUniqCharInfos * sizeof(xCharInfo) + (nCharInfos+1)/2 * 2 * sizeof(CARD16) : 0); - xXF86BigfontQueryFontReply* reply = - (xXF86BigfontQueryFontReply *) xalloc(rlength); + xXF86BigfontQueryFontReply* reply = xalloc(rlength); char* p; if (!reply) { if (nCharInfos > 0) { diff --git a/Xext/xvmain.c b/Xext/xvmain.c index 6184e4e77..477194684 100644 --- a/Xext/xvmain.c +++ b/Xext/xvmain.c @@ -273,7 +273,7 @@ XvScreenInit(ScreenPtr pScreen) /* ALLOCATE SCREEN PRIVATE RECORD */ - pxvs = (XvScreenPtr) xalloc (sizeof (XvScreenRec)); + pxvs = xalloc (sizeof (XvScreenRec)); if (!pxvs) { ErrorF("XvScreenInit: Unable to allocate screen private structure\n"); @@ -367,11 +367,10 @@ XvDestroyPixmap(PixmapPtr pPix) { XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted); - (void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp, - pp->pDraw); + (void)(* pp->pAdaptor->ddStopVideo)(NULL, pp, pp->pDraw); - pp->pDraw = (DrawablePtr)NULL; - pp->client = (ClientPtr)NULL; + pp->pDraw = NULL; + pp->client = NULL; pp->time = currentTime; } pp++; @@ -419,11 +418,10 @@ XvDestroyWindow(WindowPtr pWin) { XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted); - (void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp, - pp->pDraw); + (void)(* pp->pAdaptor->ddStopVideo)(NULL, pp, pp->pDraw); - pp->pDraw = (DrawablePtr)NULL; - pp->client = (ClientPtr)NULL; + pp->pDraw = NULL; + pp->client = NULL; pp->time = currentTime; } pp++; @@ -455,8 +453,8 @@ XvdiVideoStopped(XvPortPtr pPort, int reason) XvdiSendVideoNotify(pPort, pPort->pDraw, reason); - pPort->pDraw = (DrawablePtr)NULL; - pPort->client = (ClientPtr)NULL; + pPort->pDraw = NULL; + pPort->client = NULL; pPort->time = currentTime; return Success; @@ -472,7 +470,7 @@ XvdiDestroyPort(pointer pPort, XID id) static int XvdiDestroyGrab(pointer pGrab, XID id) { - ((XvGrabPtr)pGrab)->client = (ClientPtr)NULL; + ((XvGrabPtr)pGrab)->client = NULL; return Success; } @@ -481,7 +479,7 @@ XvdiDestroyVideoNotify(pointer pn, XID id) { /* JUST CLEAR OUT THE client POINTER FIELD */ - ((XvVideoNotifyPtr)pn)->client = (ClientPtr)NULL; + ((XvVideoNotifyPtr)pn)->client = NULL; return Success; } @@ -490,7 +488,7 @@ XvdiDestroyPortNotify(pointer pn, XID id) { /* JUST CLEAR OUT THE client POINTER FIELD */ - ((XvPortNotifyPtr)pn)->client = (ClientPtr)NULL; + ((XvPortNotifyPtr)pn)->client = NULL; return Success; } @@ -852,7 +850,7 @@ XvdiGrabPort( if ((pPort->pDraw) && (client != pPort->client)) { - XvdiStopVideo((ClientPtr)NULL, pPort, pPort->pDraw); + XvdiStopVideo(NULL, pPort, pPort->pDraw); } pPort->grab.client = client; @@ -891,7 +889,7 @@ XvdiUngrabPort( /* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */ FreeResource(pPort->grab.id, XvRTGrab); - pPort->grab.client = (ClientPtr)NULL; + pPort->grab.client = NULL; pPort->time = currentTime; @@ -921,9 +919,9 @@ XvdiSelectVideoNotify( if (!pn) { - if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec)))) + if (!(tpn = xalloc(sizeof(XvVideoNotifyRec)))) return BadAlloc; - tpn->next = (XvVideoNotifyPtr)NULL; + tpn->next = NULL; if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) { xfree(tpn); @@ -934,13 +932,13 @@ XvdiSelectVideoNotify( { /* LOOK TO SEE IF ENTRY ALREADY EXISTS */ - fpn = (XvVideoNotifyPtr)NULL; + fpn = NULL; tpn = pn; while (tpn) { if (tpn->client == client) { - if (!onoff) tpn->client = (ClientPtr)NULL; + if (!onoff) tpn->client = NULL; return Success; } if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */ @@ -959,7 +957,7 @@ XvdiSelectVideoNotify( } else { - if (!(tpn = (XvVideoNotifyPtr)xalloc(sizeof(XvVideoNotifyRec)))) + if (!(tpn = xalloc(sizeof(XvVideoNotifyRec)))) return BadAlloc; tpn->next = pn->next; pn->next = tpn; @@ -969,7 +967,7 @@ XvdiSelectVideoNotify( /* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */ /* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */ - tpn->client = (ClientPtr)NULL; + tpn->client = NULL; tpn->id = FakeClientID(client->index); AddResource(tpn->id, XvRTVideoNotify, tpn); @@ -988,7 +986,7 @@ XvdiSelectPortNotify( /* SEE IF CLIENT IS ALREADY IN LIST */ - tpn = (XvPortNotifyPtr)NULL; + tpn = NULL; pn = pPort->pNotify; while (pn) { @@ -1005,7 +1003,7 @@ XvdiSelectPortNotify( if (!onoff) { - pn->client = (ClientPtr)NULL; + pn->client = NULL; FreeResource(pn->id, XvRTPortNotify); } @@ -1017,7 +1015,7 @@ XvdiSelectPortNotify( if (!tpn) { - if (!(tpn = (XvPortNotifyPtr)xalloc(sizeof(XvPortNotifyRec)))) + if (!(tpn = xalloc(sizeof(XvPortNotifyRec)))) return BadAlloc; tpn->next = pPort->pNotify; pPort->pNotify = tpn; @@ -1060,7 +1058,7 @@ XvdiStopVideo( status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pDraw); - pPort->pDraw = (DrawablePtr)NULL; + pPort->pDraw = NULL; pPort->client = (ClientPtr)client; pPort->time = currentTime; @@ -1084,7 +1082,7 @@ XvdiPreemptVideo( status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pPort->pDraw); - pPort->pDraw = (DrawablePtr)NULL; + pPort->pDraw = NULL; pPort->client = (ClientPtr)client; pPort->time = currentTime; diff --git a/Xext/xvmc.c b/Xext/xvmc.c index 091e5a1a0..9166cf892 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -710,7 +710,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt) XvMCScreenKey = &XvMCScreenKeyIndex; - if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec)))) + if(!(pScreenPriv = xalloc(sizeof(XvMCScreenRec)))) return BadAlloc; dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv); diff --git a/dix/atom.c b/dix/atom.c index 8ed6872da..ab9ee800a 100644 --- a/dix/atom.c +++ b/dix/atom.c @@ -109,7 +109,7 @@ MakeAtom(char *string, unsigned len, Bool makeit) { NodePtr nd; - nd = (NodePtr) xalloc(sizeof(NodeRec)); + nd = xalloc(sizeof(NodeRec)); if (!nd) return BAD_RESOURCE; if (lastAtom < XA_LAST_PREDEFINED) @@ -118,7 +118,7 @@ MakeAtom(char *string, unsigned len, Bool makeit) } else { - nd->string = (char *) xalloc(len + 1); + nd->string = xalloc(len + 1); if (!nd->string) { xfree(nd); return BAD_RESOURCE; @@ -201,7 +201,7 @@ InitAtoms(void) { FreeAllAtoms(); tableLength = InitialTableSize; - nodeTable = (NodePtr *)xalloc(InitialTableSize*sizeof(NodePtr)); + nodeTable = xalloc(InitialTableSize*sizeof(NodePtr)); if (!nodeTable) AtomError(); nodeTable[None] = (NodePtr)NULL; diff --git a/dix/colormap.c b/dix/colormap.c index 23b755f92..6a5eb74a1 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -274,7 +274,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, if ((class | DynamicClass) == DirectColor) sizebytes *= 3; sizebytes += sizeof(ColormapRec); - pmap = (ColormapPtr) xalloc(sizebytes); + pmap = xalloc(sizebytes); if (!pmap) return (BadAlloc); #if defined(_XSERVER64) @@ -310,7 +310,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--) pent->refcnt = AllocPrivate; pmap->freeRed = 0; - ppix = (Pixel *)xalloc(size * sizeof(Pixel)); + ppix = xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap); @@ -356,7 +356,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--) pent->refcnt = AllocPrivate; pmap->freeGreen = 0; - ppix = (Pixel *) xalloc(size * sizeof(Pixel)); + ppix = xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap->clientPixelsRed[client]); @@ -372,7 +372,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--) pent->refcnt = AllocPrivate; pmap->freeBlue = 0; - ppix = (Pixel *) xalloc(size * sizeof(Pixel)); + ppix = xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap->clientPixelsGreen[client]); @@ -743,7 +743,7 @@ UpdateColors (ColormapPtr pmap) pVisual = pmap->pVisual; size = pVisual->ColormapEntries; - defs = (xColorItem *)xalloc(size * sizeof(xColorItem)); + defs = xalloc(size * sizeof(xColorItem)); if (!defs) return; n = 0; @@ -962,7 +962,7 @@ AllocColor (ColormapPtr pmap, { colorResource *pcr; - pcr = (colorResource *) xalloc(sizeof(colorResource)); + pcr = xalloc(sizeof(colorResource)); if (!pcr) { (void)FreeColors(pmap, client, 1, pPix, (Pixel)0); @@ -1578,7 +1578,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes, oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { - pcr = (colorResource *) xalloc(sizeof(colorResource)); + pcr = xalloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } @@ -1653,7 +1653,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors, oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { - pcr = (colorResource *) xalloc(sizeof(colorResource)); + pcr = xalloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } @@ -1745,9 +1745,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont for(p = pixels; p < pixels + c; p++) *p = 0; - ppixRed = (Pixel *)xalloc(npixR * sizeof(Pixel)); - ppixGreen = (Pixel *)xalloc(npixG * sizeof(Pixel)); - ppixBlue = (Pixel *)xalloc(npixB * sizeof(Pixel)); + ppixRed = xalloc(npixR * sizeof(Pixel)); + ppixGreen = xalloc(npixG * sizeof(Pixel)); + ppixBlue = xalloc(npixB * sizeof(Pixel)); if (!ppixRed || !ppixGreen || !ppixBlue) { if (ppixBlue) xfree(ppixBlue); @@ -1852,7 +1852,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, npix = c << r; if ((r >= 32) || (npix > pmap->freeRed) || (npix < c)) return(BadAlloc); - if(!(ppixTemp = (Pixel *)xalloc(npix * sizeof(Pixel)))) + if(!(ppixTemp = xalloc(npix * sizeof(Pixel)))) return(BadAlloc); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); @@ -2082,14 +2082,13 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, npixClientNew = c << (r + g + b); npixShared = (c << r) + (c << g) + (c << b); - psharedList = (SHAREDCOLOR **)xalloc(npixShared * - sizeof(SHAREDCOLOR *)); + psharedList = xalloc(npixShared * sizeof(SHAREDCOLOR *)); if (!psharedList) return FALSE; ppshared = psharedList; for (z = npixShared; --z >= 0; ) { - if (!(ppshared[z] = (SHAREDCOLOR *)xalloc(sizeof(SHAREDCOLOR)))) + if (!(ppshared[z] = xalloc(sizeof(SHAREDCOLOR)))) { for (z++ ; z < npixShared; z++) xfree(ppshared[z]); @@ -2672,8 +2671,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin) Colormap *pmaps; int imap, nummaps, found; - pmaps = (Colormap *) xalloc( - pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); + pmaps = xalloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap)); if(!pmaps) return(FALSE); nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) diff --git a/dix/cursor.c b/dix/cursor.c index b91c194e6..d1248c444 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -345,7 +345,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, unsigned char *mskptr; n = BitmapBytePad(cm.width)*(long)cm.height; - mskptr = mskbits = (unsigned char *)xalloc(n); + mskptr = mskbits = xalloc(n); if (!mskptr) return BadAlloc; while (--n >= 0) @@ -405,7 +405,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, else { bits->refcnt = 1; - pShare = (GlyphSharePtr)xalloc(sizeof(GlyphShare)); + pShare = xalloc(sizeof(GlyphShare)); if (!pShare) { FreeCursorBits(bits); diff --git a/dix/devices.c b/dix/devices.c index f3c271711..65782290c 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1170,7 +1170,7 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, case PtrAccelPredictable: { DeviceVelocityPtr s; - s = (DeviceVelocityPtr)xalloc(sizeof(DeviceVelocityRec)); + s = xalloc(sizeof(DeviceVelocityRec)); if(!s) return FALSE; InitVelocityData(s); @@ -1202,7 +1202,7 @@ InitAbsoluteClassDeviceStruct(DeviceIntPtr dev) { AbsoluteClassPtr abs; - abs = (AbsoluteClassPtr)xalloc(sizeof(AbsoluteClassRec)); + abs = xalloc(sizeof(AbsoluteClassRec)); if (!abs) return FALSE; @@ -1233,7 +1233,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev) { FocusClassPtr focc; - focc = (FocusClassPtr)xalloc(sizeof(FocusClassRec)); + focc = xalloc(sizeof(FocusClassRec)); if (!focc) return FALSE; focc->win = PointerRootWin; @@ -1251,7 +1251,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) { PtrFeedbackPtr feedc; - feedc = (PtrFeedbackPtr)xalloc(sizeof(PtrFeedbackClassRec)); + feedc = xalloc(sizeof(PtrFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; @@ -1289,17 +1289,15 @@ InitStringFeedbackClassDeviceStruct ( int i; StringFeedbackPtr feedc; - feedc = (StringFeedbackPtr)xalloc(sizeof(StringFeedbackClassRec)); + feedc = xalloc(sizeof(StringFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl.num_symbols_supported = num_symbols_supported; feedc->ctrl.num_symbols_displayed = 0; feedc->ctrl.max_symbols = max_symbols; - feedc->ctrl.symbols_supported = (KeySym *) - xalloc (sizeof (KeySym) * num_symbols_supported); - feedc->ctrl.symbols_displayed = (KeySym *) - xalloc (sizeof (KeySym) * max_symbols); + feedc->ctrl.symbols_supported = xalloc (sizeof (KeySym) * num_symbols_supported); + feedc->ctrl.symbols_displayed = xalloc (sizeof (KeySym) * max_symbols); if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) { if (feedc->ctrl.symbols_supported) @@ -1327,7 +1325,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc, { BellFeedbackPtr feedc; - feedc = (BellFeedbackPtr)xalloc(sizeof(BellFeedbackClassRec)); + feedc = xalloc(sizeof(BellFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; @@ -1346,7 +1344,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc) { LedFeedbackPtr feedc; - feedc = (LedFeedbackPtr)xalloc(sizeof(LedFeedbackClassRec)); + feedc = xalloc(sizeof(LedFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; @@ -1365,7 +1363,7 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr { IntegerFeedbackPtr feedc; - feedc = (IntegerFeedbackPtr)xalloc(sizeof(IntegerFeedbackClassRec)); + feedc = xalloc(sizeof(IntegerFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; diff --git a/dix/dispatch.c b/dix/dispatch.c index 09fd3afc6..5cde80b2d 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -347,7 +347,7 @@ Dispatch(void) nextFreeClientID = 1; nClients = 0; - clientReady = (int *) xalloc(sizeof(int) * MaxClients); + clientReady = xalloc(sizeof(int) * MaxClients); if (!clientReady) return; @@ -848,7 +848,7 @@ ProcQueryTree(ClientPtr client) { int curChild = 0; - childIDs = (Window *) xalloc(numChildren * sizeof(Window)); + childIDs = xalloc(numChildren * sizeof(Window)); if (!childIDs) return BadAlloc; for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) @@ -1142,7 +1142,7 @@ ProcQueryFont(ClientPtr client) rlength = sizeof(xQueryFontReply) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + nprotoxcistructs * sizeof(xCharInfo); - reply = (xQueryFontReply *)xalloc(rlength); + reply = xalloc(rlength); if(!reply) { return(BadAlloc); @@ -1970,7 +1970,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, xgi.length = length; if (im_return) { - pBuf = (char *)xalloc(sz_xGetImageReply + length); + pBuf = xalloc(sz_xGetImageReply + length); if (!pBuf) return (BadAlloc); if (widthBytesLine == 0) @@ -2008,7 +2008,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, length += widthBytesLine; } } - if(!(pBuf = (char *) xalloc(length))) + if(!(pBuf = xalloc(length))) return (BadAlloc); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); } @@ -2380,8 +2380,7 @@ ProcListInstalledColormaps(ClientPtr client) if (rc != Success) goto out; - preply = (xListInstalledColormapsReply *) - xalloc(sizeof(xListInstalledColormapsReply) + + preply = xalloc(sizeof(xListInstalledColormapsReply) + pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!preply) @@ -2525,7 +2524,7 @@ ProcAllocColorCells (ClientPtr client) } nmasks = stuff->planes; length = ((long)npixels + (long)nmasks) * sizeof(Pixel); - ppixels = (Pixel *)xalloc(length); + ppixels = xalloc(length); if(!ppixels) return(BadAlloc); pmasks = ppixels + npixels; @@ -2594,7 +2593,7 @@ ProcAllocColorPlanes(ClientPtr client) acpr.sequenceNumber = client->sequence; acpr.nPixels = npixels; length = (long)npixels * sizeof(Pixel); - ppixels = (Pixel *)xalloc(length); + ppixels = xalloc(length); if(!ppixels) return(BadAlloc); if( (rc = AllocColorPlanes(client->index, pcmp, npixels, @@ -2747,7 +2746,7 @@ ProcQueryColors(ClientPtr client) xQueryColorsReply qcr; count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2; - prgbs = (xrgb *)xalloc(count * sizeof(xrgb)); + prgbs = xalloc(count * sizeof(xrgb)); if(!prgbs && count) return(BadAlloc); if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) @@ -3504,7 +3503,7 @@ ClientPtr NextAvailableClient(pointer ospriv) i = nextFreeClientID; if (i == MAXCLIENTS) return (ClientPtr)NULL; - clients[i] = client = (ClientPtr)xalloc(sizeof(ClientRec)); + clients[i] = client = xalloc(sizeof(ClientRec)); if (!client) return (ClientPtr)NULL; InitClient(client, i, ospriv); diff --git a/dix/dixfonts.c b/dix/dixfonts.c index b0fbed232..9f596e867 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -397,7 +397,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna #ifdef FONTDEBUG char *f; - f = (char *)xalloc(lenfname + 1); + f = xalloc(lenfname + 1); memmove(f, pfontname, lenfname); f[lenfname] = '\0'; ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f); @@ -434,10 +434,10 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna return Success; } } - c = (OFclosurePtr) xalloc(sizeof(OFclosureRec)); + c = xalloc(sizeof(OFclosureRec)); if (!c) return BadAlloc; - c->fontname = (char *) xalloc(lenfname); + c->fontname = xalloc(lenfname); c->origFontName = pfontname; c->origFontNameLen = lenfname; if (!c->fontname) { @@ -448,8 +448,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna * copy the current FPE list, so that if it gets changed by another client * while we're blocking, the request still appears atomic */ - c->fpe_list = (FontPathElementPtr *) - xalloc(sizeof(FontPathElementPtr) * num_fpes); + c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { xfree(c->fontname); xfree(c); @@ -683,7 +682,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) } if (err == FontNameAlias) { if (resolved) xfree(resolved); - resolved = (char *) xalloc(resolvedlen + 1); + resolved = xalloc(resolvedlen + 1); if (resolved) memmove(resolved, tmpname, resolvedlen + 1); } @@ -738,7 +737,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) c->haveSaved = TRUE; if (c->savedName) xfree(c->savedName); - c->savedName = (char *)xalloc(namelen + 1); + c->savedName = xalloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); c->savedNameLen = namelen; @@ -799,7 +798,7 @@ finish: reply.nFonts = nnames; reply.sequenceNumber = client->sequence; - bufptr = bufferStart = (char *) xalloc(reply.length << 2); + bufptr = bufferStart = xalloc(reply.length << 2); if (!bufptr && reply.length) { SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); @@ -859,10 +858,9 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, if (i != Success) return i; - if (!(c = (LFclosurePtr) xalloc(sizeof *c))) + if (!(c = xalloc(sizeof *c))) return BadAlloc; - c->fpe_list = (FontPathElementPtr *) - xalloc(sizeof(FontPathElementPtr) * num_fpes); + c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { xfree(c); return BadAlloc; @@ -1001,7 +999,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) c->savedNumFonts = numFonts; if (c->savedName) xfree(c->savedName); - c->savedName = (char *)xalloc(namelen + 1); + c->savedName = xalloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); aliascount = 20; @@ -1135,10 +1133,9 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern, if (i != Success) return i; - if (!(c = (LFWIclosurePtr) xalloc(sizeof *c))) + if (!(c = xalloc(sizeof *c))) goto badAlloc; - c->fpe_list = (FontPathElementPtr *) - xalloc(sizeof(FontPathElementPtr) * num_fpes); + c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { xfree(c); @@ -1325,7 +1322,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) /* Step 1 */ /* Allocate a malloc'd closure structure to replace the local one we were passed */ - new_closure = (PTclosurePtr) xalloc(sizeof(PTclosureRec)); + new_closure = xalloc(sizeof(PTclosureRec)); if (!new_closure) { err = BadAlloc; @@ -1335,7 +1332,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) c = new_closure; len = c->endReq - c->pElt; - c->data = (unsigned char *)xalloc(len); + c->data = xalloc(len); if (!c->data) { xfree(c); @@ -1517,7 +1514,7 @@ doImageText(ClientPtr client, ITclosurePtr c) in doPolyText, but much simpler because the request structure is much simpler. */ - new_closure = (ITclosurePtr) xalloc(sizeof(ITclosureRec)); + new_closure = xalloc(sizeof(ITclosureRec)); if (!new_closure) { err = BadAlloc; @@ -1526,7 +1523,7 @@ doImageText(ClientPtr client, ITclosurePtr c) *new_closure = *c; c = new_closure; - data = (unsigned char *)xalloc(c->nChars * c->itemSize); + data = xalloc(c->nChars * c->itemSize); if (!data) { xfree(c); @@ -1663,7 +1660,7 @@ FreeFontPath(FontPathElementPtr *list, int n, Bool force) } FreeFPE(list[i]); } - xfree((char *) list); + xfree(list); } static FontPathElementPtr @@ -1690,8 +1687,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) unsigned char *cp = paths; FontPathElementPtr fpe = NULL, *fplist; - fplist = (FontPathElementPtr *) - xalloc(sizeof(FontPathElementPtr) * npaths); + fplist = xalloc(sizeof(FontPathElementPtr) * npaths); if (!fplist) { *bad = 0; return BadAlloc; @@ -1732,13 +1728,13 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) /* if error or can't do it, act like it's a new one */ if (!fpe) { - fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec)); + fpe = xalloc(sizeof(FontPathElementRec)); if (!fpe) { err = BadAlloc; goto bail; } - fpe->name = (char *) xalloc(len + 1); + fpe->name = xalloc(len + 1); if (!fpe->name) { xfree(fpe); @@ -1826,7 +1822,7 @@ SetDefaultFontPath(char *path) /* get enough for string, plus values -- use up commas */ len = strlen(path) + 1; - nump = cp = newpath = (unsigned char *) xalloc(len); + nump = cp = newpath = xalloc(len); if (!newpath) return BadAlloc; pp = (unsigned char *) path; diff --git a/dix/dixutils.c b/dix/dixutils.c index 19ed5bf8e..a382be63f 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -567,7 +567,7 @@ QueueWorkProc ( { WorkQueuePtr q; - q = (WorkQueuePtr) xalloc (sizeof *q); + q = xalloc (sizeof *q); if (!q) return FALSE; q->function = function; @@ -601,7 +601,7 @@ ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure) { SleepQueuePtr q; - q = (SleepQueuePtr) xalloc (sizeof *q); + q = xalloc (sizeof *q); if (!q) return FALSE; @@ -681,7 +681,7 @@ _AddCallback( { CallbackPtr cbr; - cbr = (CallbackPtr) xalloc(sizeof(CallbackRec)); + cbr = xalloc(sizeof(CallbackRec)); if (!cbr) return FALSE; cbr->proc = callback; @@ -824,7 +824,7 @@ CreateCallbackList(CallbackListPtr *pcbl) int i; if (!pcbl) return FALSE; - cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec)); + cbl = xalloc(sizeof(CallbackListRec)); if (!cbl) return FALSE; cbl->inCallback = 0; cbl->deleted = FALSE; diff --git a/dix/events.c b/dix/events.c index 839c45697..17e7142d0 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1131,7 +1131,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) if (xE->u.u.type == GenericEvent) /* count is 1 for GenericEvents */ eventlen += ((xGenericEvent*)xE)->length * 4; - qe = (QdEventPtr)xalloc(sizeof(QdEventRec) + eventlen); + qe = xalloc(sizeof(QdEventRec) + eventlen); if (!qe) return; qe->next = (QdEventPtr)NULL; @@ -3824,7 +3824,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) check = 0; if (!pWin->optional && !MakeWindowOptional (pWin)) return BadAlloc; - others = (OtherClients *) xalloc(sizeof(OtherClients)); + others = xalloc(sizeof(OtherClients)); if (!others) return BadAlloc; others->mask = mask; diff --git a/dix/extension.c b/dix/extension.c index b408da944..330fd28b7 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -86,10 +86,10 @@ AddExtension(char *name, int NumEvents, int NumErrors, (unsigned)(lastError + NumErrors > LAST_ERROR)) return((ExtensionEntry *) NULL); - ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry)); + ext = xalloc(sizeof(ExtensionEntry)); if (!ext) - return((ExtensionEntry *) NULL); - ext->name = (char *)xalloc(strlen(name) + 1); + return(NULL); + ext->name = xalloc(strlen(name) + 1); ext->num_aliases = 0; ext->aliases = (char **)NULL; ext->devPrivates = NULL; @@ -156,7 +156,7 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext) if (!aliases) return FALSE; ext->aliases = aliases; - name = (char *)xalloc(strlen(alias) + 1); + name = xalloc(strlen(alias) + 1); if (!name) return FALSE; strcpy(name, alias); @@ -323,7 +323,7 @@ ProcListExtensions(ClientPtr client) total_length += strlen(extensions[i]->aliases[j]) + 1; } reply.length = (total_length + 3) >> 2; - buffer = bufptr = (char *)xalloc(total_length); + buffer = bufptr = xalloc(total_length); if (!buffer) return(BadAlloc); for (i=0; i<NumExtensions; i++) @@ -470,7 +470,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr { unsigned char *dash; - dash = (unsigned char *)xalloc(2 * sizeof(unsigned char)); + dash = xalloc(2 * sizeof(unsigned char)); if (dash) { if (pGC->dash != DefaultDash) @@ -579,7 +579,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus, { GCPtr pGC; - pGC = (GCPtr)xalloc(sizeof(GC)); + pGC = xalloc(sizeof(GC)); if (!pGC) { *pStatus = BadAlloc; @@ -829,8 +829,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask) unsigned char *dash; unsigned int i; - dash = (unsigned char *)xalloc(pgcSrc->numInDashList * - sizeof(unsigned char)); + dash = xalloc(pgcSrc->numInDashList * sizeof(unsigned char)); if (dash) { if (pgcDst->dash != DefaultDash) @@ -909,7 +908,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth) { GCPtr pGC; - pGC = (GCPtr)xalloc(sizeof(GC)); + pGC = xalloc(sizeof(GC)); if (!pGC) return (GCPtr)NULL; @@ -1069,9 +1068,9 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) } if (ndash & 1) - p = (unsigned char *)xalloc(2 * ndash * sizeof(unsigned char)); + p = xalloc(2 * ndash * sizeof(unsigned char)); else - p = (unsigned char *)xalloc(ndash * sizeof(unsigned char)); + p = xalloc(ndash * sizeof(unsigned char)); if (!p) return BadAlloc; @@ -1166,7 +1165,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects, if (newct < 0) return(BadMatch); size = nrects * sizeof(xRectangle); - prectsNew = (xRectangle *) xalloc(size); + prectsNew = xalloc(size); if (!prectsNew && size) return BadAlloc; diff --git a/dix/grabs.c b/dix/grabs.c index 8878cb7a3..142fc4a27 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -82,7 +82,7 @@ CreateGrab( { GrabPtr grab; - grab = (GrabPtr)xalloc(sizeof(GrabRec)); + grab = xalloc(sizeof(GrabRec)); if (!grab) return (GrabPtr)NULL; grab->resource = FakeClientID(client); @@ -158,7 +158,7 @@ DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail) Mask *mask; int i; - mask = (Mask *)xalloc(sizeof(Mask) * MasksPerDetailMask); + mask = xalloc(sizeof(Mask) * MasksPerDetailMask); if (mask) { if (pDetailMask) @@ -395,10 +395,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) i++; if (!i) return TRUE; - deletes = (GrabPtr *)xalloc(i * sizeof(GrabPtr)); - adds = (GrabPtr *)xalloc(i * sizeof(GrabPtr)); - updates = (Mask ***)xalloc(i * sizeof(Mask **)); - details = (Mask **)xalloc(i * sizeof(Mask *)); + deletes = xalloc(i * sizeof(GrabPtr)); + adds = xalloc(i * sizeof(GrabPtr)); + updates = xalloc(i * sizeof(Mask **)); + details = xalloc(i * sizeof(Mask *)); if (!deletes || !adds || !updates || !details) { if (details) xfree(details); diff --git a/dix/main.c b/dix/main.c index 069a17b66..3c25e2e21 100644 --- a/dix/main.c +++ b/dix/main.c @@ -285,7 +285,7 @@ int main(int argc, char *argv[], char *envp[]) InitProcVectors(); for (i=1; i<MAXCLIENTS; i++) clients[i] = NullClient; - serverClient = (ClientPtr)xalloc(sizeof(ClientRec)); + serverClient = xalloc(sizeof(ClientRec)); if (!serverClient) FatalError("couldn't create server client"); InitClient(serverClient, 0, (pointer)NULL); @@ -515,7 +515,7 @@ CreateConnectionBlock(void) ((setup.nbytesVendor + 3) & ~3) + (setup.numFormats * sizeof(xPixmapFormat)) + (setup.numRoots * sizeof(xWindowRoot)); - ConnectionInfo = (char *) xalloc(lenofblock); + ConnectionInfo = xalloc(lenofblock); if (!ConnectionInfo) return FALSE; diff --git a/dix/pixmap.c b/dix/pixmap.c index d72a3d038..10ec02a78 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -113,7 +113,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) return NullPixmap; - pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); + pPixmap = xalloc(pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; diff --git a/dix/privates.c b/dix/privates.c index 5eece697a..3a2deb85c 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -312,7 +312,7 @@ dixResetPrivates(void) if (offsets) xfree(offsets); offsetsSize = sizeof(offsetDefaults); - offsets = (int *)xalloc(offsetsSize); + offsets = xalloc(offsetsSize); offsetsSize /= sizeof(int); if (!offsets) return FALSE; diff --git a/dix/property.c b/dix/property.c index 91839c940..5bf4232ed 100644 --- a/dix/property.c +++ b/dix/property.c @@ -136,8 +136,8 @@ ProcRotateProperties(ClientPtr client) return rc; atoms = (Atom *) & stuff[1]; - props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr)); - saved = (PropertyPtr)xalloc(stuff->nAtoms * sizeof(PropertyRec)); + props = xalloc(stuff->nAtoms * sizeof(PropertyPtr)); + saved = xalloc(stuff->nAtoms * sizeof(PropertyRec)); if (!props || !saved) { rc = BadAlloc; goto out; @@ -267,10 +267,10 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, { if (!pWin->optional && !MakeWindowOptional (pWin)) return(BadAlloc); - pProp = (PropertyPtr)xalloc(sizeof(PropertyRec)); + pProp = xalloc(sizeof(PropertyRec)); if (!pProp) return(BadAlloc); - data = (pointer)xalloc(totalSize); + data = xalloc(totalSize); if (!data && len) { xfree(pProp); @@ -339,7 +339,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, } else if (mode == PropModePrepend) { - data = (pointer)xalloc(sizeInBytes * (len + pProp->size)); + data = xalloc(sizeInBytes * (len + pProp->size)); if (!data) return(BadAlloc); memmove(&((char *)data)[totalSize], (char *)pProp->data, @@ -581,7 +581,7 @@ ProcListProperties(ClientPtr client) for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) numProps++; - if (numProps && !(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom)))) + if (numProps && !(pAtoms = xalloc(numProps * sizeof(Atom)))) return BadAlloc; numProps = 0; diff --git a/dix/resource.c b/dix/resource.c index 31ad46ec5..ec1d8cf4c 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -255,8 +255,7 @@ InitClientResources(ClientPtr client) TypeMask = RC_LASTPREDEF - 1; if (DeleteFuncs) xfree(DeleteFuncs); - DeleteFuncs = (DeleteType *)xalloc((lastResourceType + 1) * - sizeof(DeleteType)); + DeleteFuncs = xalloc((lastResourceType + 1) * sizeof(DeleteType)); if (!DeleteFuncs) return FALSE; DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA; @@ -271,7 +270,7 @@ InitClientResources(ClientPtr client) DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; } clientTable[i = client->index].resources = - (ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr)); + xalloc(INITBUCKETS*sizeof(ResourcePtr)); if (!clientTable[i].resources) return FALSE; clientTable[i].buckets = INITBUCKETS; @@ -459,7 +458,7 @@ AddResource(XID id, RESTYPE type, pointer value) (rrec->hashsize < MAXHASHSIZE)) RebuildTable(client); head = &rrec->resources[Hash(client, id)]; - res = (ResourcePtr)xalloc(sizeof(ResourceRec)); + res = xalloc(sizeof(ResourceRec)); if (!res) { (*DeleteFuncs[type & TypeMask])(value, id); @@ -491,10 +490,10 @@ RebuildTable(int client) */ j = 2 * clientTable[client].buckets; - tails = (ResourcePtr **)xalloc(j * sizeof(ResourcePtr *)); + tails = xalloc(j * sizeof(ResourcePtr *)); if (!tails) return; - resources = (ResourcePtr *)xalloc(j * sizeof(ResourcePtr)); + resources = xalloc(j * sizeof(ResourcePtr)); if (!resources) { xfree(tails); diff --git a/dix/swaprep.c b/dix/swaprep.c index 493def57d..9eb67654a 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -99,7 +99,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) CARD32 tmpbuf[1]; /* Allocate as big a buffer as we can... */ - while (!(pbufT = (CARD32 *) xalloc(bufsize))) + while (!(pbufT = xalloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) @@ -131,7 +131,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) } if (pbufT != tmpbuf) - xfree ((char *) pbufT); + xfree (pbufT); } /** @@ -147,7 +147,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) short tmpbuf[2]; /* Allocate as big a buffer as we can... */ - while (!(pbufT = (short *) xalloc(bufsize))) + while (!(pbufT = xalloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) @@ -179,7 +179,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) } if (pbufT != tmpbuf) - xfree ((char *) pbufT); + xfree (pbufT); } @@ -1262,7 +1262,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) { char *pInfoTBase; - pInfoTBase = (char *) xalloc(size); + pInfoTBase = xalloc(size); if (!pInfoTBase) { pClient->noClientException = -1; diff --git a/dix/window.c b/dix/window.c index 92c5eff44..d4c587e3c 100644 --- a/dix/window.c +++ b/dix/window.c @@ -360,7 +360,7 @@ CreateRootWindow(ScreenPtr pScreen) BoxRec box; PixmapFormatRec *format; - pWin = (WindowPtr)xalloc(sizeof(WindowRec)); + pWin = xalloc(sizeof(WindowRec)); if (!pWin) return FALSE; @@ -387,7 +387,7 @@ CreateRootWindow(ScreenPtr pScreen) pWin->parent = NullWindow; SetWindowToDefaults(pWin); - pWin->optional = (WindowOptRec *) xalloc (sizeof (WindowOptRec)); + pWin->optional = xalloc (sizeof (WindowOptRec)); if (!pWin->optional) return FALSE; @@ -647,7 +647,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, return NullWindow; } - pWin = (WindowPtr)xalloc(sizeof(WindowRec)); + pWin = xalloc(sizeof(WindowRec)); if (!pWin) { *error = BadAlloc; @@ -3299,8 +3299,8 @@ TileScreenSaver(int i, int kind) cm.height=16; cm.xhot=8; cm.yhot=8; - srcbits = (unsigned char *)xalloc( BitmapBytePad(32)*16); - mskbits = (unsigned char *)xalloc( BitmapBytePad(32)*16); + srcbits = xalloc( BitmapBytePad(32)*16); + mskbits = xalloc( BitmapBytePad(32)*16); if (!srcbits || !mskbits) { xfree(srcbits); @@ -3460,7 +3460,7 @@ MakeWindowOptional (WindowPtr pWin) if (pWin->optional) return TRUE; - optional = (WindowOptPtr) xalloc (sizeof (WindowOptRec)); + optional = xalloc (sizeof (WindowOptRec)); if (!optional) return FALSE; optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate]; @@ -3476,8 +3476,7 @@ MakeWindowOptional (WindowPtr pWin) optional->inputMasks = NULL; optional->deviceCursors = NULL; - optional->geMasks = - (GenericClientMasksPtr)xalloc(sizeof(GenericClientMasksRec)); + optional->geMasks = xalloc(sizeof(GenericClientMasksRec)); if (!optional->geMasks) { xfree(optional); @@ -3576,7 +3575,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin, if (!pCursor) return Success; - pNewNode = (DevCursNodePtr)xalloc(sizeof(DevCursNodeRec)); + pNewNode = xalloc(sizeof(DevCursNodeRec)); pNewNode->dev = pDev; pNewNode->next = pWin->optional->deviceCursors; pWin->optional->deviceCursors = pNewNode; diff --git a/mi/miarc.c b/mi/miarc.c index bec3391df..12c360c7a 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -880,8 +880,7 @@ miComputeWideEllipse( { if (spdata) xfree(spdata); - spdata = (miArcSpanData *)xalloc(sizeof(miArcSpanData) + - sizeof(miArcSpan) * (k + 2)); + spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2)); lruent->spdata = spdata; if (!spdata) { @@ -925,7 +924,7 @@ miFillWideEllipse( yorgu = parc->height + pGC->lineWidth; n = (sizeof(int) * 2) * yorgu; - widths = (int *)xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu); + widths = xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu); if (!widths) return; points = (DDXPointPtr)((char *)widths + n); @@ -1361,7 +1360,7 @@ miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft, arc.height = width; arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x); arc.angle2 = a; - pArcPts = (SppPointPtr) xalloc (3 * sizeof (SppPointRec)); + pArcPts = xalloc (3 * sizeof (SppPointRec)); if (!pArcPts) return; pArcPts[0].x = otherCorner.x; @@ -1783,7 +1782,7 @@ addArc ( arc = (miArcDataPtr) xrealloc (*arcsp, newsize * sizeof (**arcsp)); if (!arc) - return (miArcDataPtr)NULL; + return NULL; *sizep = newsize; *arcsp = arc; } @@ -1895,14 +1894,14 @@ miComputeArcs ( isDoubleDash = (pGC->lineStyle == LineDoubleDash); dashOffset = pGC->dashOffset; - data = (struct arcData *) xalloc (narcs * sizeof (struct arcData)); + data = xalloc (narcs * sizeof (struct arcData)); if (!data) - return (miPolyArcPtr)NULL; - arcs = (miPolyArcPtr) xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1)); + return NULL; + arcs = xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1)); if (!arcs) { xfree(data); - return (miPolyArcPtr)NULL; + return NULL; } for (i = 0; i < narcs; i++) { a0 = todeg (parcs[i].angle1); @@ -2255,7 +2254,7 @@ miComputeArcs ( arcfail: miFreeArcs(arcs, pGC); xfree(data); - return (miPolyArcPtr)NULL; + return NULL; } static double @@ -3111,7 +3110,7 @@ realAllocSpan (void) struct finalSpan *span; int i; - newChunk = (struct finalSpanChunk *) xalloc (sizeof (struct finalSpanChunk)); + newChunk = xalloc (sizeof (struct finalSpanChunk)); if (!newChunk) return (struct finalSpan *) NULL; newChunk->next = chunks; @@ -3158,8 +3157,8 @@ fillSpans ( if (nspans == 0) return; - xSpan = xSpans = (DDXPointPtr) xalloc (nspans * sizeof (DDXPointRec)); - xWidth = xWidths = (int *) xalloc (nspans * sizeof (int)); + xSpan = xSpans = xalloc (nspans * sizeof (DDXPointRec)); + xWidth = xWidths = xalloc (nspans * sizeof (int)); if (xSpans && xWidths) { i = 0; @@ -3216,10 +3215,9 @@ realFindSpan (int y) else change = SPAN_REALLOC; newSize = finalSize + change; - newSpans = (struct finalSpan **) xalloc - (newSize * sizeof (struct finalSpan *)); + newSpans = xalloc(newSize * sizeof (struct finalSpan *)); if (!newSpans) - return (struct finalSpan **)NULL; + return NULL; newMiny = finalMiny; newMaxy = finalMaxy; if (y < finalMiny) diff --git a/mi/mibank.c b/mi/mibank.c index 3946a4b6d..9e4d63162 100644 --- a/mi/mibank.c +++ b/mi/mibank.c @@ -171,8 +171,7 @@ typedef struct _miBankQueue (*pScreenPriv->BankInfo.SetDestinationBank)(pScreen, (_no)) - \ (pScreenPriv->BankInfo.BankSize * (_no))) -#define xalloc_ARRAY(atype, ntype) \ - (atype *)xalloc((ntype) * sizeof(atype)) +#define xalloc_ARRAY(atype, ntype) xalloc((ntype) * sizeof(atype)) static int miBankScreenKeyIndex; static DevPrivateKey miBankScreenKey = &miBankScreenKeyIndex; @@ -955,7 +954,7 @@ miBankCopy( paddedWidth = PixmapBytePad(maxWidth, pScreenPriv->pScreenPixmap->drawable.depth); - pImage = (char *)xalloc(paddedWidth * maxHeight); + pImage = xalloc(paddedWidth * maxHeight); pGC->fExpose = FALSE; @@ -1750,7 +1749,7 @@ miBankGetImage( paddedWidth = PixmapBytePad(w, pScreenPriv->pScreenPixmap->drawable.depth); - pBankImage = (char *)xalloc(paddedWidth * h); + pBankImage = xalloc(paddedWidth * h); if (pBankImage) { @@ -1811,7 +1810,7 @@ miBankGetSpans( paddedWidth = PixmapBytePad(pScreenPriv->pScreenPixmap->drawable.width, pScreenPriv->pScreenPixmap->drawable.depth); - pBankImage = (char *)xalloc(paddedWidth); + pBankImage = xalloc(paddedWidth); if (pBankImage) { diff --git a/mi/mibitblt.c b/mi/mibitblt.c index a36e1aacb..cc8b11d9c 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -104,7 +104,7 @@ miCopyArea(DrawablePtr pSrcDrawable, /* If the destination isn't realized, this is easy */ if (pDstDrawable->type == DRAWABLE_WINDOW && !((WindowPtr)pDstDrawable)->realized) - return (RegionPtr)NULL; + return NULL; /* clip the source */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) @@ -143,14 +143,11 @@ miCopyArea(DrawablePtr pSrcDrawable, dsty += pDstDrawable->y; } - pptFirst = ppt = (DDXPointPtr) - xalloc(heightSrc * sizeof(DDXPointRec)); - pwidthFirst = pwidth = (unsigned int *) - xalloc(heightSrc * sizeof(unsigned int)); + pptFirst = ppt = xalloc(heightSrc * sizeof(DDXPointRec)); + pwidthFirst = pwidth = xalloc(heightSrc * sizeof(unsigned int)); numRects = REGION_NUM_RECTS(prgnSrcClip); boxes = REGION_RECTS(prgnSrcClip); - ordering = (unsigned int *) - xalloc(numRects * sizeof(unsigned int)); + ordering = xalloc(numRects * sizeof(unsigned int)); if(!pptFirst || !pwidthFirst || !ordering) { if (ordering) @@ -159,7 +156,7 @@ miCopyArea(DrawablePtr pSrcDrawable, xfree(pwidthFirst); if (pptFirst) xfree(pptFirst); - return (RegionPtr)NULL; + return NULL; } /* If not the same drawable then order of move doesn't matter. @@ -238,8 +235,7 @@ miCopyArea(DrawablePtr pSrcDrawable, ppt++->y = y++; *pwidth++ = width; } - pbits = (unsigned int *)xalloc(height * PixmapBytePad(width, - pSrcDrawable->depth)); + pbits = xalloc(height * PixmapBytePad(width, pSrcDrawable->depth)); if (pbits) { (*pSrcDrawable->pScreen->GetSpans)(pSrcDrawable, width, pptFirst, @@ -319,7 +315,7 @@ miGetPlane( if(!result) result = xcalloc(h, widthInBytes); if (!result) - return (MiBits *)NULL; + return NULL; bitsPerPixel = pDraw->bitsPerPixel; pOut = (OUT_TYPE *) result; if(bitsPerPixel == 1) @@ -433,8 +429,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc, dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv); ValidateGC((DrawablePtr)pPixmap, pGCT); miClearDrawable((DrawablePtr)pPixmap, pGCT); - ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec)); - pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int)); + ppt = pptFirst = xalloc(h * sizeof(DDXPointRec)); + pwidth = pwidthFirst = xalloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { if (pwidthFirst) xfree(pwidthFirst); @@ -651,7 +647,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h, int i, linelength, width, srcx, srcy; DDXPointRec pt = {0, 0}; XID gcv[2]; - PixmapPtr pPixmap = (PixmapPtr)NULL; + PixmapPtr pPixmap = NULL; GCPtr pGC = NULL; depth = pDraw->depth; @@ -802,8 +798,8 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth, break; case ZPixmap: - ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec)); - pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int)); + ppt = pptFirst = xalloc(h * sizeof(DDXPointRec)); + pwidth = pwidthFirst = xalloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { if (pwidthFirst) diff --git a/mi/micmap.c b/mi/micmap.c index 342756b6a..6318d6745 100644 --- a/mi/micmap.c +++ b/mi/micmap.c @@ -398,7 +398,7 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB, miVisualsPtr new, *prev, v; int count; - new = (miVisualsPtr) xalloc (sizeof *new); + new = xalloc (sizeof *new); if (!new) return FALSE; if (!redMask || !greenMask || !blueMask) @@ -539,9 +539,9 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, ndepth++; nvisual += visuals->count; } - depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec)); - visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec)); - preferredCVCs = (int *)xalloc(ndepth * sizeof(int)); + depth = xalloc (ndepth * sizeof (DepthRec)); + visual = xalloc (nvisual * sizeof (VisualRec)); + preferredCVCs = xalloc(ndepth * sizeof(int)); if (!depth || !visual || !preferredCVCs) { xfree (depth); @@ -565,7 +565,7 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, vid = NULL; if (nvtype) { - vid = (VisualID *) xalloc (nvtype * sizeof (VisualID)); + vid = xalloc (nvtype * sizeof (VisualID)); if (!vid) { xfree(preferredCVCs); return FALSE; diff --git a/mi/midispcur.c b/mi/midispcur.c index e73b5003b..7b3ce292e 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -140,7 +140,7 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) { miDCScreenPtr pScreenPriv; - pScreenPriv = (miDCScreenPtr) xalloc (sizeof (miDCScreenRec)); + pScreenPriv = xalloc (sizeof (miDCScreenRec)); if (!pScreenPriv) return FALSE; @@ -229,9 +229,9 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor) GCPtr pGC; XID gcvals[3]; - pPriv = (miDCCursorPtr) xalloc (sizeof (miDCCursorRec)); + pPriv = xalloc (sizeof (miDCCursorRec)); if (!pPriv) - return (miDCCursorPtr)NULL; + return NULL; #ifdef ARGB_CURSOR if (pCursor->bits->argb) { @@ -243,7 +243,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor) if (!pFormat) { xfree ((pointer) pPriv); - return (miDCCursorPtr)NULL; + return NULL; } pPriv->sourceBits = 0; @@ -254,14 +254,14 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor) if (!pPixmap) { xfree ((pointer) pPriv); - return (miDCCursorPtr)NULL; + return NULL; } pGC = GetScratchGC (32, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); xfree ((pointer) pPriv); - return (miDCCursorPtr)NULL; + return NULL; } ValidateGC (&pPixmap->drawable, pGC); (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32, @@ -275,7 +275,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor) if (!pPriv->pPicture) { xfree ((pointer) pPriv); - return (miDCCursorPtr)NULL; + return NULL; } dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv); return pPriv; @@ -286,14 +286,14 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor) if (!pPriv->sourceBits) { xfree ((pointer) pPriv); - return (miDCCursorPtr)NULL; + return NULL; } pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!pPriv->maskBits) { (*pScreen->DestroyPixmap) (pPriv->sourceBits); xfree ((pointer) pPriv); - return (miDCCursorPtr)NULL; + return NULL; } dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv); @@ -303,7 +303,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor) if (!pGC) { (void) miDCUnrealizeCursor (pScreen, pCursor); - return (miDCCursorPtr)NULL; + return NULL; } ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); diff --git a/mi/miexpose.c b/mi/miexpose.c index 04bf555ae..d56d18758 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -207,7 +207,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, box.y2 = pSrcDrawable->height; prgnSrcClip = &rgnSrcRec; REGION_INIT(pscr, prgnSrcClip, &box, 1); - pSrcWin = (WindowPtr)NULL; + pSrcWin = NULL; } if (pDstDrawable == pSrcDrawable) @@ -354,7 +354,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable, numRects = REGION_NUM_RECTS(pRgn); pBox = REGION_RECTS(pRgn); - if(!(pEvent = (xEvent *)xalloc(numRects * sizeof(xEvent)))) + if(!(pEvent = xalloc(numRects * sizeof(xEvent)))) return; pe = pEvent; @@ -397,7 +397,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy) pBox = REGION_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn); - if(!(pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent)))) + if(!(pEvent = xalloc(numRects * sizeof(xEvent)))) return; for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) @@ -600,8 +600,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; } - prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) * - sizeof(xRectangle)); + prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle)); if (!prect) return; diff --git a/mi/mifillarc.c b/mi/mifillarc.c index 33a6e353a..c22baf54c 100644 --- a/mi/mifillarc.c +++ b/mi/mifillarc.c @@ -546,10 +546,10 @@ miFillEllipseI( int *widths; int *wids; - points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height); + points = xalloc(sizeof(DDXPointRec) * arc->height); if (!points) return; - widths = (int *)xalloc(sizeof(int) * arc->height); + widths = xalloc(sizeof(int) * arc->height); if (!widths) { xfree(points); @@ -589,10 +589,10 @@ miFillEllipseD( int *widths; int *wids; - points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height); + points = xalloc(sizeof(DDXPointRec) * arc->height); if (!points) return; - widths = (int *)xalloc(sizeof(int) * arc->height); + widths = xalloc(sizeof(int) * arc->height); if (!widths) { xfree(points); @@ -661,10 +661,10 @@ miFillArcSliceI( slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; - points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw); + points = xalloc(sizeof(DDXPointRec) * slw); if (!points) return; - widths = (int *)xalloc(sizeof(int) * slw); + widths = xalloc(sizeof(int) * slw); if (!widths) { xfree(points); @@ -725,10 +725,10 @@ miFillArcSliceD( slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; - points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw); + points = xalloc(sizeof(DDXPointRec) * slw); if (!points) return; - widths = (int *)xalloc(sizeof(int) * slw); + widths = xalloc(sizeof(int) * slw); if (!widths) { xfree(points); diff --git a/mi/mifillrct.c b/mi/mifillrct.c index a2967da0a..6e9979099 100644 --- a/mi/mifillrct.c +++ b/mi/mifillrct.c @@ -107,8 +107,8 @@ miPolyFillRect( maxheight = max(maxheight, prect->height); } - pptFirst = (DDXPointPtr) xalloc(maxheight * sizeof(DDXPointRec)); - pwFirst = (int *) xalloc(maxheight * sizeof(int)); + pptFirst = xalloc(maxheight * sizeof(DDXPointRec)); + pwFirst = xalloc(maxheight * sizeof(int)); if(!pptFirst || !pwFirst) { if (pwFirst) xfree(pwFirst); diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c index 4a3acfd2b..383502f64 100644 --- a/mi/mifpolycon.c +++ b/mi/mifpolycon.c @@ -116,9 +116,9 @@ miFillSppPoly( y = ymax - ymin + 1; if ((count < 3) || (y <= 0)) return; - ptsOut = FirstPoint = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * y); - width = FirstWidth = (int *) xalloc(sizeof(int) * y); - Marked = (int *) xalloc(sizeof(int) * count); + ptsOut = FirstPoint = xalloc(sizeof(DDXPointRec) * y); + width = FirstWidth = xalloc(sizeof(int) * y); + Marked = xalloc(sizeof(int) * count); if(!ptsOut || !width || !Marked) { diff --git a/mi/miglblt.c b/mi/miglblt.c index 404d78540..bc715aee9 100644 --- a/mi/miglblt.c +++ b/mi/miglblt.c @@ -141,7 +141,7 @@ miPolyGlyphBlt( DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0); nbyLine = BitmapBytePad(width); - pbits = (unsigned char *)xalloc(height*nbyLine); + pbits = xalloc(height*nbyLine); if (!pbits) { (*pDrawable->pScreen->DestroyPixmap)(pPixmap); diff --git a/mi/mioverlay.c b/mi/mioverlay.c index f238cd3f2..e0aa88017 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -900,7 +900,7 @@ miOverlayHandleExposures(WindowPtr pWin) REGION_UNINIT(pScreen, &val->after.borderExposed); REGION_UNINIT(pScreen, &val->after.exposed); xfree(val); - pChild->valdata = (ValidatePtr)NULL; + pChild->valdata = NULL; if (pChild->firstChild) { pChild = pChild->firstChild; diff --git a/mi/mipointer.c b/mi/mipointer.c index 567790c49..d5202810a 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -88,7 +88,7 @@ miPointerInitialize (ScreenPtr pScreen, { miPointerScreenPtr pScreenPriv; - pScreenPriv = (miPointerScreenPtr) xalloc (sizeof (miPointerScreenRec)); + pScreenPriv = xalloc (sizeof (miPointerScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->spriteFuncs = spriteFuncs; diff --git a/mi/mipolycon.c b/mi/mipolycon.c index 6e3889621..79384881d 100644 --- a/mi/mipolycon.c +++ b/mi/mipolycon.c @@ -105,8 +105,8 @@ miFillConvexPoly( dy = ymax - ymin + 1; if ((count < 3) || (dy < 0)) return(TRUE); - ptsOut = FirstPoint = (DDXPointPtr )xalloc(sizeof(DDXPointRec)*dy); - width = FirstWidth = (int *)xalloc(sizeof(int) * dy); + ptsOut = FirstPoint = xalloc(sizeof(DDXPointRec)*dy); + width = FirstWidth = xalloc(sizeof(int) * dy); if(!FirstPoint || !FirstWidth) { if (FirstWidth) xfree(FirstWidth); diff --git a/mi/mipolygen.c b/mi/mipolygen.c index 04bc2c67f..4744583c3 100644 --- a/mi/mipolygen.c +++ b/mi/mipolygen.c @@ -92,8 +92,7 @@ miFillGeneralPoly( if (count < 3) return(TRUE); - if(!(pETEs = (EdgeTableEntry *) - xalloc(sizeof(EdgeTableEntry) * count))) + if(!(pETEs = xalloc(sizeof(EdgeTableEntry) * count))) return(FALSE); ptsOut = FirstPoint; width = FirstWidth; diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c index 12324b686..5d6243ab0 100644 --- a/mi/mipolypnt.c +++ b/mi/mipolypnt.c @@ -107,7 +107,7 @@ miPolyPoint( DoChangeGC(pGC, GCFillStyle, &fsNew, 0); ValidateGC(pDrawable, pGC); } - if(!(pwidthInit = (int *)xalloc(npt * sizeof(int)))) + if(!(pwidthInit = xalloc(npt * sizeof(int)))) return; pwidth = pwidthInit; for(i = 0; i < npt; i++) diff --git a/mi/mipolyrect.c b/mi/mipolyrect.c index f1ec4858a..033c7a7c8 100644 --- a/mi/mipolyrect.c +++ b/mi/mipolyrect.c @@ -90,7 +90,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects) offset2 = pGC->lineWidth; offset1 = offset2 >> 1; offset3 = offset2 - offset1; - tmp = (xRectangle *) xalloc(ntmp * sizeof (xRectangle)); + tmp = xalloc(ntmp * sizeof (xRectangle)); if (!tmp) return; t = tmp; diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c index ed41a7d1a..15561b73d 100644 --- a/mi/mipolyutil.c +++ b/mi/mipolyutil.c @@ -99,19 +99,18 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, { if (*iSLLBlock > SLLSPERBLOCK-1) { - tmpSLLBlock = - (ScanLineListBlock *)xalloc(sizeof(ScanLineListBlock)); + tmpSLLBlock = xalloc(sizeof(ScanLineListBlock)); if (!tmpSLLBlock) return FALSE; (*SLLBlock)->next = tmpSLLBlock; - tmpSLLBlock->next = (ScanLineListBlock *)NULL; + tmpSLLBlock->next = NULL; *SLLBlock = tmpSLLBlock; *iSLLBlock = 0; } pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL->next = pPrevSLL->next; - pSLL->edgelist = (EdgeTableEntry *)NULL; + pSLL->edgelist = NULL; pPrevSLL->next = pSLL; } pSLL->scanline = scanline; @@ -119,7 +118,7 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, /* * now insert the edge in the right bucket */ - prev = (EdgeTableEntry *)NULL; + prev = NULL; start = pSLL->edgelist; while (start && (start->bres.minor < ETE->bres.minor)) { @@ -175,18 +174,18 @@ miCreateETandAET(int count, DDXPointPtr pts, EdgeTable *ET, EdgeTableEntry *AET, /* * initialize the Active Edge Table */ - AET->next = (EdgeTableEntry *)NULL; - AET->back = (EdgeTableEntry *)NULL; - AET->nextWETE = (EdgeTableEntry *)NULL; + AET->next = NULL; + AET->back = NULL; + AET->nextWETE = NULL; AET->bres.minor = MININT; /* * initialize the Edge Table. */ - ET->scanlines.next = (ScanLineList *)NULL; + ET->scanlines.next = NULL; ET->ymax = MININT; ET->ymin = MAXINT; - pSLLBlock->next = (ScanLineListBlock *)NULL; + pSLLBlock->next = NULL; PrevPt = &pts[count-1]; @@ -305,7 +304,7 @@ micomputeWAET(EdgeTableEntry *AET) int inside = 1; int isInside = 0; - AET->nextWETE = (EdgeTableEntry *)NULL; + AET->nextWETE = NULL; pWETE = AET; AET = AET->next; while (AET) @@ -324,7 +323,7 @@ micomputeWAET(EdgeTableEntry *AET) } AET = AET->next; } - pWETE->nextWETE = (EdgeTableEntry *)NULL; + pWETE->nextWETE = NULL; } /* diff --git a/mi/mipushpxl.c b/mi/mipushpxl.c index 4b9789047..3844519d8 100644 --- a/mi/mipushpxl.c +++ b/mi/mipushpxl.c @@ -123,7 +123,7 @@ miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, LONG2CHARSDIFFORDER((MiBits)(-1) >> 1); #endif - pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx)); + pwLineStart = xalloc(BitmapBytePad(dx)); if (!pwLineStart) return; ipt = 0; diff --git a/mi/miregion.c b/mi/miregion.c index d9c6fb252..c48befc6f 100644 --- a/mi/miregion.c +++ b/mi/miregion.c @@ -171,7 +171,7 @@ Equipment Corporation. ((r1)->y1 <= (r2)->y1) && \ ((r1)->y2 >= (r2)->y2) ) -#define xallocData(n) (RegDataPtr)xalloc(REGION_SZOF(n)) +#define xallocData(n) xalloc(REGION_SZOF(n)) #define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data) #define RECTALLOC_BAIL(pReg,n,bail) \ @@ -654,7 +654,7 @@ miRegionOp( assert(r1 != r1End); assert(r2 != r2End); - oldData = (RegDataPtr)NULL; + oldData = NULL; if (((newReg == reg1) && (newSize > 1)) || ((newReg == reg2) && (numRects > 1))) { @@ -808,7 +808,7 @@ miRegionOp( { newReg->extents = *REGION_BOXPTR(newReg); xfreeData(newReg); - newReg->data = (RegDataPtr)NULL; + newReg->data = NULL; } else { @@ -1039,7 +1039,7 @@ miRegionAppend(RegionPtr dstrgn, RegionPtr rgn) if (!rgn->data && (dstrgn->data == &miEmptyData)) { dstrgn->extents = rgn->extents; - dstrgn->data = (RegDataPtr)NULL; + dstrgn->data = NULL; return TRUE; } @@ -1343,7 +1343,7 @@ miRegionValidate(RegionPtr badreg, Bool *pOverlap) rit->prevBand = 0; rit->curBand = 0; rit->reg.extents = *box; - rit->reg.data = (RegDataPtr)NULL; + rit->reg.data = NULL; if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */ goto bail; NextRect: ; @@ -1362,7 +1362,7 @@ NextRect: ; if (reg->data->numRects == 1) /* keep unions happy below */ { xfreeData(reg); - reg->data = (RegDataPtr)NULL; + reg->data = NULL; } } @@ -1428,7 +1428,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype) pRgn->extents.y1 = y1; pRgn->extents.x2 = x2; pRgn->extents.y2 = y2; - pRgn->data = (RegDataPtr)NULL; + pRgn->data = NULL; } return pRgn; } diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 157a17fa3..93a6c4bda 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -180,7 +180,7 @@ miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits) * to the screen, until CreateScreenResources can put them in the * screen pixmap. */ - pScrInitParms = (miScreenInitParmsPtr)xalloc(sizeof(miScreenInitParmsRec)); + pScrInitParms = xalloc(sizeof(miScreenInitParmsRec)); if (!pScrInitParms) return FALSE; pScrInitParms->pbits = pbits; diff --git a/mi/mispans.c b/mi/mispans.c index 33882a9e1..5504341c4 100644 --- a/mi/mispans.c +++ b/mi/mispans.c @@ -405,8 +405,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup) ylength = spanGroup->ymax - ymin + 1; /* Allocate Spans for y buckets */ - yspans = (Spans *) xalloc(ylength * sizeof(Spans)); - ysizes = (int *) xalloc(ylength * sizeof (int)); + yspans = xalloc(ylength * sizeof(Spans)); + ysizes = xalloc(ylength * sizeof (int)); if (!yspans || !ysizes) { @@ -479,8 +479,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup) } /* for i thorough Spans */ /* Now sort by x and uniquify each bucket into the final array */ - points = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec)); - widths = (int *) xalloc(count * sizeof(int)); + points = xalloc(count * sizeof(DDXPointRec)); + widths = xalloc(count * sizeof(int)); if (!points || !widths) { int i; diff --git a/mi/misprite.c b/mi/misprite.c index 467fd8f3e..f4b281a46 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -226,7 +226,7 @@ miSpriteInitialize (ScreenPtr pScreen, if (!DamageSetup (pScreen)) return FALSE; - pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec)); + pScreenPriv = xalloc (sizeof (miSpriteScreenRec)); if (!pScreenPriv) return FALSE; diff --git a/mi/mivaltree.c b/mi/mivaltree.c index 2585422bc..cfcdab756 100644 --- a/mi/mivaltree.c +++ b/mi/mivaltree.c @@ -769,7 +769,7 @@ miValidateTree ( if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pWin, 0, 0); REGION_EMPTY( pScreen, &pWin->borderClip); - pWin->valdata = (ValidatePtr)NULL; + pWin->valdata = NULL; } } } diff --git a/mi/miwideline.c b/mi/miwideline.c index 5c16d3ccc..210a6251e 100644 --- a/mi/miwideline.c +++ b/mi/miwideline.c @@ -95,10 +95,10 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, if (!spanData) { - pptInit = (DDXPointPtr) xalloc (overall_height * sizeof(*ppt)); + pptInit = xalloc (overall_height * sizeof(*ppt)); if (!pptInit) return; - pwidthInit = (int *) xalloc (overall_height * sizeof(*pwidth)); + pwidthInit = xalloc (overall_height * sizeof(*pwidth)); if (!pwidthInit) { xfree (pptInit); @@ -116,10 +116,10 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, } else { - spanRec.points = (DDXPointPtr) xalloc (overall_height * sizeof (*ppt)); + spanRec.points = xalloc (overall_height * sizeof (*ppt)); if (!spanRec.points) return; - spanRec.widths = (int *) xalloc (overall_height * sizeof (int)); + spanRec.widths = xalloc (overall_height * sizeof (int)); if (!spanRec.widths) { xfree (spanRec.points); @@ -221,10 +221,10 @@ miFillRectPolyHelper ( } else { - spanRec.points = (DDXPointPtr) xalloc (h * sizeof (*ppt)); + spanRec.points = xalloc (h * sizeof (*ppt)); if (!spanRec.points) return; - spanRec.widths = (int *) xalloc (h * sizeof (int)); + spanRec.widths = xalloc (h * sizeof (int)); if (!spanRec.widths) { xfree (spanRec.points); @@ -1045,10 +1045,10 @@ miLineArc ( } if (!spanData) { - points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * pGC->lineWidth); + points = xalloc(sizeof(DDXPointRec) * pGC->lineWidth); if (!points) return; - widths = (int *)xalloc(sizeof(int) * pGC->lineWidth); + widths = xalloc(sizeof(int) * pGC->lineWidth); if (!widths) { xfree(points); @@ -1064,10 +1064,10 @@ miLineArc ( } else { - points = (DDXPointPtr) xalloc (pGC->lineWidth * sizeof (DDXPointRec)); + points = xalloc (pGC->lineWidth * sizeof (DDXPointRec)); if (!points) return; - widths = (int *) xalloc (pGC->lineWidth * sizeof (int)); + widths = xalloc (pGC->lineWidth * sizeof (int)); if (!widths) { xfree (points); diff --git a/mi/miwindow.c b/mi/miwindow.c index e2af77d48..31c028482 100644 --- a/mi/miwindow.c +++ b/mi/miwindow.c @@ -245,7 +245,7 @@ miHandleValidateExposures(WindowPtr pWin) (*WindowExposures)(pChild, &val->after.exposed, NullRegion); REGION_UNINIT(pScreen, &val->after.exposed); xfree(val); - pChild->valdata = (ValidatePtr)NULL; + pChild->valdata = NULL; if (pChild->firstChild) { pChild = pChild->firstChild; @@ -305,10 +305,10 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind) { if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows) - (pWin, windowToValidate, (WindowPtr *)NULL); + (pWin, windowToValidate, NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows) - (pWin, pLayerWin, (WindowPtr *)NULL); + (pWin, pLayerWin, NULL); if (anyMarked) @@ -500,10 +500,10 @@ miSlideAndSizeWindow(WindowPtr pWin, if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, - (WindowPtr *)NULL); + NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin, - (WindowPtr *)NULL); + NULL); if (pWin->valdata) { @@ -729,7 +729,7 @@ miSetShape(WindowPtr pWin) if (WasViewable) { anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, - (WindowPtr *)NULL); + NULL); if (anyMarked) diff --git a/mi/mizerarc.c b/mi/mizerarc.c index 83a269d46..9c8df3415 100644 --- a/mi/mizerarc.c +++ b/mi/mizerarc.c @@ -737,7 +737,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs) dospans = (pGC->fillStyle != FillSolid); if (dospans) { - widths = (int *)xalloc(sizeof(int) * numPts); + widths = xalloc(sizeof(int) * numPts); if (!widths) return; maxw = 0; @@ -754,7 +754,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs) (unsigned char *) pGC->dash, (int)pGC->numInDashList, &dinfo.dashOffsetInit); } - points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * numPts); + points = xalloc(sizeof(DDXPointRec) * numPts); if (!points) { if (dospans) diff --git a/mi/mizerline.c b/mi/mizerline.c index d9ecd89fa..46e2e2adc 100644 --- a/mi/mizerline.c +++ b/mi/mizerline.c @@ -155,8 +155,8 @@ miZeroLine( width = xright - xleft + 1; height = ybottom - ytop + 1; list_len = (height >= width) ? height : width; - pspanInit = (DDXPointPtr)xalloc(list_len * sizeof(DDXPointRec)); - pwidthInit = (int *)xalloc(list_len * sizeof(int)); + pspanInit = xalloc(list_len * sizeof(DDXPointRec)); + pwidthInit = xalloc(list_len * sizeof(int)); if (!pspanInit || !pwidthInit) return; diff --git a/miext/cw/cw.c b/miext/cw/cw.c index 56066fe9c..74000ffa0 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -484,7 +484,7 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec))) return; - pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec)); + pScreenPriv = xalloc(sizeof(cwScreenRec)); if (!pScreenPriv) return; diff --git a/miext/damage/damage.c b/miext/damage/damage.c index 9e0533fa5..ade67359a 100644 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -1514,7 +1514,7 @@ damageText (DrawablePtr pDrawable, imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); - charinfo = (CharInfoPtr *) xalloc(count * sizeof(CharInfoPtr)); + charinfo = xalloc(count * sizeof(CharInfoPtr)); if (!charinfo) return x; @@ -1873,7 +1873,7 @@ DamageSetup (ScreenPtr pScreen) if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec))) return FALSE; - pScrPriv = (DamageScrPrivPtr) xalloc (sizeof (DamageScrPrivRec)); + pScrPriv = xalloc (sizeof (DamageScrPrivRec)); if (!pScrPriv) return FALSE; diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c index 47cd6790b..0ee4919e1 100644 --- a/miext/rootless/rootlessValTree.c +++ b/miext/rootless/rootlessValTree.c @@ -624,7 +624,7 @@ RootlessMiValidateTree (WindowPtr pRoot, /* Parent to validate */ if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pWin, 0, 0); REGION_EMPTY( pScreen, &pWin->borderClip); - pWin->valdata = (ValidatePtr)NULL; + pWin->valdata = NULL; } } } diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c index 21f1de2d5..5eea16bdf 100644 --- a/miext/shadow/shadow.c +++ b/miext/shadow/shadow.c @@ -139,7 +139,7 @@ shadowSetup(ScreenPtr pScreen) if (!DamageSetup(pScreen)) return FALSE; - pBuf = (shadowBufPtr) xalloc(sizeof(shadowBufRec)); + pBuf = xalloc(sizeof(shadowBufRec)); if (!pBuf) return FALSE; #ifdef BACKWARDS_COMPATIBILITY diff --git a/os/WaitFor.c b/os/WaitFor.c index 1633b4993..9a204c7a7 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -430,7 +430,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis, if (!timer) { - timer = (OsTimerPtr)xalloc(sizeof(struct _OsTimerRec)); + timer = xalloc(sizeof(struct _OsTimerRec)); if (!timer) return NULL; } diff --git a/os/access.c b/os/access.c index 5d688a71e..34478768b 100644 --- a/os/access.c +++ b/os/access.c @@ -216,7 +216,7 @@ typedef struct _host { int requested; } HOST; -#define MakeHost(h,l) (h)=(HOST *) xalloc(sizeof *(h)+(l));\ +#define MakeHost(h,l) (h)=xalloc(sizeof *(h)+(l));\ if (h) { \ (h)->addr=(unsigned char *) ((h) + 1);\ (h)->requested = FALSE; \ @@ -1109,12 +1109,12 @@ Bool LocalClient(ClientPtr client) &alen, (pointer *)&addr); if (family == -1) { - xfree ((char *) from); + xfree (from); return FALSE; } if (family == FamilyLocal) { - xfree ((char *) from); + xfree (from); return TRUE; } for (host = selfhosts; host; host = host->next) @@ -1122,7 +1122,7 @@ Bool LocalClient(ClientPtr client) if (addrEqual (family, addr, alen, host)) return TRUE; } - xfree ((char *) from); + xfree (from); } return FALSE; } @@ -1462,7 +1462,7 @@ GetHosts ( } if (n) { - *data = ptr = (pointer) xalloc (n); + *data = ptr = xalloc (n); if (!ptr) { return(BadAlloc); @@ -1721,7 +1721,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, } } - s = (struct siType *) xalloc(sizeof(struct siType)); + s = xalloc(sizeof(struct siType)); if (s == NULL) return BadAlloc; diff --git a/os/connection.c b/os/connection.c index aa25938d9..14c91b541 100644 --- a/os/connection.c +++ b/os/connection.c @@ -227,7 +227,7 @@ void SetConnectionTranslation(int conn, int client) } node = &((*node)->next); } - *node = (struct _ct_node*)xalloc(sizeof(struct _ct_node)); + *node = xalloc(sizeof(struct _ct_node)); (*node)->next = NULL; (*node)->key = conn; (*node)->value = client; @@ -407,7 +407,7 @@ CreateWellKnownSockets(void) } else { - ListenTransFds = (int *) xalloc (ListenTransCount * sizeof (int)); + ListenTransFds = xalloc (ListenTransCount * sizeof (int)); for (i = 0; i < ListenTransCount; i++) { @@ -689,7 +689,7 @@ ClientAuthorized(ClientPtr client, proto_n, auth_proto, auth_id); } - xfree ((char *) from); + xfree (from); } if (auth_id == (XID) ~0L) { @@ -711,7 +711,7 @@ ClientAuthorized(ClientPtr client, AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); - xfree ((char *) from); + xfree (from); } } priv->auth_id = auth_id; @@ -747,7 +747,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time) #endif ) return NullClient; - oc = (OsCommPtr)xalloc(sizeof(OsCommRec)); + oc = xalloc(sizeof(OsCommRec)); if (!oc) return NullClient; oc->trans_conn = trans_conn; @@ -1011,14 +1011,14 @@ AllocateInputBuffer(void) { ConnectionInputPtr oci; - oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput)); + oci = xalloc(sizeof(ConnectionInput)); if (!oci) - return (ConnectionInputPtr)NULL; - oci->buffer = (char *)xalloc(BUFSIZE); + return NULL; + oci->buffer = xalloc(BUFSIZE); if (!oci->buffer) { xfree(oci); - return (ConnectionInputPtr)NULL; + return NULL; } oci->size = BUFSIZE; oci->bufptr = oci->buffer; @@ -1032,14 +1032,14 @@ AllocateOutputBuffer(void) { ConnectionOutputPtr oco; - oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput)); + oco = xalloc(sizeof(ConnectionOutput)); if (!oco) - return (ConnectionOutputPtr)NULL; - oco->buf = (unsigned char *) xcalloc(1, BUFSIZE); + return NULL; + oco->buf = xcalloc(1, BUFSIZE); if (!oco->buf) { xfree(oco); - return (ConnectionOutputPtr)NULL; + return NULL; } oco->size = BUFSIZE; oco->count = 0; diff --git a/os/mitauth.c b/os/mitauth.c index db66c44fb..a7968cbd7 100644 --- a/os/mitauth.c +++ b/os/mitauth.c @@ -55,10 +55,10 @@ MitAddCookie ( { struct auth *new; - new = (struct auth *) xalloc (sizeof (struct auth)); + new = xalloc (sizeof (struct auth)); if (!new) return 0; - new->data = (char *) xalloc ((unsigned) data_length); + new->data = xalloc ((unsigned) data_length); if (!new->data) { xfree(new); return 0; diff --git a/os/rpcauth.c b/os/rpcauth.c index 1a27c5882..5ddbe210b 100644 --- a/os/rpcauth.c +++ b/os/rpcauth.c @@ -66,7 +66,7 @@ authdes_ezdecode(char *inmsg, int len) XDR xdr; SVCXPRT xprt; - temp_inmsg = (char *) xalloc(len); + temp_inmsg = xalloc(len); memmove(temp_inmsg, inmsg, len); memset((char *)&msg, 0, sizeof(msg)); @@ -79,7 +79,7 @@ authdes_ezdecode(char *inmsg, int len) why = AUTH_FAILED; xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE); - if ((r.rq_clntcred = (caddr_t) xalloc(MAX_AUTH_BYTES)) == NULL) + if ((r.rq_clntcred = xalloc(MAX_AUTH_BYTES)) == NULL) goto bad1; r.rq_xprt = &xprt; diff --git a/os/utils.c b/os/utils.c index 0ed89dd15..56095b128 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1404,7 +1404,7 @@ Popen(char *command, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) + if ((cur = xalloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { @@ -1490,7 +1490,7 @@ Fopen(char *file, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) + if ((cur = xalloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { diff --git a/os/xdmauth.c b/os/xdmauth.c index 8cbcd581f..e19e4f93d 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -259,7 +259,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, *reason = "Bad XDM authorization key length"; return NULL; } - client = (XdmClientAuthPtr) xalloc (sizeof (XdmClientAuthRec)); + client = xalloc (sizeof (XdmClientAuthRec)); if (!client) return NULL; XdmClientAuthDecode (plain, client); @@ -363,7 +363,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id) /* the first octet of the key must be zero */ if (key_bits[0] != '\0') return 0; - new = (XdmAuthorizationPtr) xalloc (sizeof (XdmAuthorizationRec)); + new = xalloc (sizeof (XdmAuthorizationRec)); if (!new) return 0; new->next = xdmAuth; @@ -385,7 +385,7 @@ XdmCheckCookie (unsigned short cookie_length, char *cookie, /* Auth packets must be a multiple of 8 bytes long */ if (cookie_length & 7) return (XID) -1; - plain = (unsigned char *) xalloc (cookie_length); + plain = xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { @@ -430,7 +430,7 @@ XdmToID (unsigned short cookie_length, char *cookie) XdmClientAuthPtr client; unsigned char *plain; - plain = (unsigned char *) xalloc (cookie_length); + plain = xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { diff --git a/os/xdmcp.c b/os/xdmcp.c index d819dd964..cf9558679 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -391,8 +391,7 @@ XdmcpRegisterAuthentication ( AuthenticationNames.length + 1) && XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas, AuthenticationDatas.length + 1) && - (newFuncs = (AuthenticationFuncsPtr) xalloc ( - (AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) + (newFuncs = xalloc ((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) { XdmcpDisposeARRAY8 (&AuthenticationName); XdmcpDisposeARRAY8 (&AuthenticationData); @@ -491,7 +490,7 @@ XdmcpRegisterConnection ( return; } } - newAddress = (CARD8 *) xalloc (addrlen * sizeof (CARD8)); + newAddress = xalloc (addrlen * sizeof (CARD8)); if (!newAddress) return; if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1)) @@ -532,7 +531,7 @@ XdmcpRegisterAuthorization (char *name, int namelen) ARRAY8 authName; int i; - authName.data = (CARD8 *) xalloc (namelen * sizeof (CARD8)); + authName.data = xalloc (namelen * sizeof (CARD8)); if (!authName.data) return; if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1)) |