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 /dix | |
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.
Diffstat (limited to 'dix')
-rw-r--r-- | dix/atom.c | 6 | ||||
-rw-r--r-- | dix/colormap.c | 32 | ||||
-rw-r--r-- | dix/cursor.c | 4 | ||||
-rw-r--r-- | dix/devices.c | 22 | ||||
-rw-r--r-- | dix/dispatch.c | 21 | ||||
-rw-r--r-- | dix/dixfonts.c | 46 | ||||
-rw-r--r-- | dix/dixutils.c | 8 | ||||
-rw-r--r-- | dix/events.c | 4 | ||||
-rw-r--r-- | dix/extension.c | 10 | ||||
-rw-r--r-- | dix/gc.c | 15 | ||||
-rw-r--r-- | dix/grabs.c | 12 | ||||
-rw-r--r-- | dix/main.c | 4 | ||||
-rw-r--r-- | dix/pixmap.c | 2 | ||||
-rw-r--r-- | dix/privates.c | 2 | ||||
-rw-r--r-- | dix/property.c | 12 | ||||
-rw-r--r-- | dix/resource.c | 11 | ||||
-rw-r--r-- | dix/swaprep.c | 10 | ||||
-rw-r--r-- | dix/window.c | 17 |
18 files changed, 113 insertions, 125 deletions
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; |