diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-06 01:44:06 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 00:22:37 +0700 |
commit | 3f3ff971ecff9936cebafc813af9193b97bba89c (patch) | |
tree | fdbbad794a42488b7ffe41eed7aba4e498335f55 /dix | |
parent | 96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff) |
Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.
X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/atom.c | 20 | ||||
-rw-r--r-- | dix/colormap.c | 128 | ||||
-rw-r--r-- | dix/cursor.c | 42 | ||||
-rw-r--r-- | dix/devices.c | 104 | ||||
-rw-r--r-- | dix/dispatch.c | 66 | ||||
-rw-r--r-- | dix/dixfonts.c | 148 | ||||
-rw-r--r-- | dix/dixutils.c | 36 | ||||
-rw-r--r-- | dix/eventconvert.c | 8 | ||||
-rw-r--r-- | dix/events.c | 42 | ||||
-rw-r--r-- | dix/extension.c | 30 | ||||
-rw-r--r-- | dix/gc.c | 28 | ||||
-rw-r--r-- | dix/getevents.c | 18 | ||||
-rw-r--r-- | dix/glyphcurs.c | 4 | ||||
-rw-r--r-- | dix/grabs.c | 38 | ||||
-rw-r--r-- | dix/inpututils.c | 2 | ||||
-rw-r--r-- | dix/main.c | 6 | ||||
-rw-r--r-- | dix/pixmap.c | 2 | ||||
-rw-r--r-- | dix/privates.c | 16 | ||||
-rw-r--r-- | dix/property.c | 44 | ||||
-rw-r--r-- | dix/ptrveloc.c | 10 | ||||
-rw-r--r-- | dix/registry.c | 14 | ||||
-rw-r--r-- | dix/resource.c | 30 | ||||
-rw-r--r-- | dix/selection.c | 6 | ||||
-rw-r--r-- | dix/swaprep.c | 12 | ||||
-rw-r--r-- | dix/window.c | 40 |
25 files changed, 447 insertions, 447 deletions
diff --git a/dix/atom.c b/dix/atom.c index f5bf8ad7e..ecfe4b0c7 100644 --- a/dix/atom.c +++ b/dix/atom.c @@ -109,7 +109,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit) { NodePtr nd; - nd = xalloc(sizeof(NodeRec)); + nd = malloc(sizeof(NodeRec)); if (!nd) return BAD_RESOURCE; if (lastAtom < XA_LAST_PREDEFINED) @@ -118,9 +118,9 @@ MakeAtom(const char *string, unsigned len, Bool makeit) } else { - char *newstring = xalloc(len + 1); + char *newstring = malloc(len + 1); if (!newstring) { - xfree(nd); + free(nd); return BAD_RESOURCE; } strncpy(newstring, string, (int)len); @@ -130,12 +130,12 @@ MakeAtom(const char *string, unsigned len, Bool makeit) if ((lastAtom + 1) >= tableLength) { NodePtr *table; - table = (NodePtr *) xrealloc(nodeTable, + table = (NodePtr *) realloc(nodeTable, tableLength * (2 * sizeof(NodePtr))); if (!table) { if (nd->string != string) - xfree(nd->string); - xfree(nd); + free(nd->string); + free(nd); return BAD_RESOURCE; } tableLength <<= 1; @@ -181,8 +181,8 @@ FreeAtom(NodePtr patom) if(patom->right) FreeAtom(patom->right); if (patom->a > XA_LAST_PREDEFINED) - xfree(patom->string); - xfree(patom); + free(patom->string); + free(patom); } void @@ -192,7 +192,7 @@ FreeAllAtoms(void) return; FreeAtom(atomRoot); atomRoot = (NodePtr)NULL; - xfree(nodeTable); + free(nodeTable); nodeTable = (NodePtr *)NULL; lastAtom = None; } @@ -202,7 +202,7 @@ InitAtoms(void) { FreeAllAtoms(); tableLength = InitialTableSize; - nodeTable = xalloc(InitialTableSize*sizeof(NodePtr)); + nodeTable = malloc(InitialTableSize*sizeof(NodePtr)); if (!nodeTable) AtomError(); nodeTable[None] = (NodePtr)NULL; diff --git a/dix/colormap.c b/dix/colormap.c index bf9794125..9a4ff2845 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 = xalloc(sizebytes); + pmap = malloc(sizebytes); if (!pmap) return (BadAlloc); #if defined(_XSERVER64) @@ -310,10 +310,10 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--) pent->refcnt = AllocPrivate; pmap->freeRed = 0; - ppix = xalloc(size * sizeof(Pixel)); + ppix = malloc(size * sizeof(Pixel)); if (!ppix) { - xfree(pmap); + free(pmap); return (BadAlloc); } pmap->clientPixelsRed[client] = ppix; @@ -356,11 +356,11 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--) pent->refcnt = AllocPrivate; pmap->freeGreen = 0; - ppix = xalloc(size * sizeof(Pixel)); + ppix = malloc(size * sizeof(Pixel)); if (!ppix) { - xfree(pmap->clientPixelsRed[client]); - xfree(pmap); + free(pmap->clientPixelsRed[client]); + free(pmap); return(BadAlloc); } pmap->clientPixelsGreen[client] = ppix; @@ -372,12 +372,12 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--) pent->refcnt = AllocPrivate; pmap->freeBlue = 0; - ppix = xalloc(size * sizeof(Pixel)); + ppix = malloc(size * sizeof(Pixel)); if (!ppix) { - xfree(pmap->clientPixelsGreen[client]); - xfree(pmap->clientPixelsRed[client]); - xfree(pmap); + free(pmap->clientPixelsGreen[client]); + free(pmap->clientPixelsRed[client]); + free(pmap); return(BadAlloc); } pmap->clientPixelsBlue[client] = ppix; @@ -439,7 +439,7 @@ FreeColormap (pointer value, XID mid) if(pmap->clientPixelsRed) { for(i = 0; i < MAXCLIENTS; i++) - xfree(pmap->clientPixelsRed[i]); + free(pmap->clientPixelsRed[i]); } if ((pmap->class == PseudoColor) || (pmap->class == GrayScale)) @@ -451,11 +451,11 @@ FreeColormap (pointer value, XID mid) if(pent->fShared) { if (--pent->co.shco.red->refcnt == 0) - xfree(pent->co.shco.red); + free(pent->co.shco.red); if (--pent->co.shco.green->refcnt == 0) - xfree(pent->co.shco.green); + free(pent->co.shco.green); if (--pent->co.shco.blue->refcnt == 0) - xfree(pent->co.shco.blue); + free(pent->co.shco.blue); } } } @@ -463,13 +463,13 @@ FreeColormap (pointer value, XID mid) { for(i = 0; i < MAXCLIENTS; i++) { - xfree(pmap->clientPixelsGreen[i]); - xfree(pmap->clientPixelsBlue[i]); + free(pmap->clientPixelsGreen[i]); + free(pmap->clientPixelsBlue[i]); } } dixFreePrivates(pmap->devPrivates); - xfree(pmap); + free(pmap); return(Success); } @@ -720,11 +720,11 @@ FreeCell (ColormapPtr pmap, Pixel i, int channel) if (pent->fShared) { if(--pent->co.shco.red->refcnt == 0) - xfree(pent->co.shco.red); + free(pent->co.shco.red); if(--pent->co.shco.green->refcnt == 0) - xfree(pent->co.shco.green); + free(pent->co.shco.green); if(--pent->co.shco.blue->refcnt == 0) - xfree(pent->co.shco.blue); + free(pent->co.shco.blue); pent->fShared = FALSE; } pent->refcnt = 0; @@ -743,7 +743,7 @@ UpdateColors (ColormapPtr pmap) pVisual = pmap->pVisual; size = pVisual->ColormapEntries; - defs = xalloc(size * sizeof(xColorItem)); + defs = malloc(size * sizeof(xColorItem)); if (!defs) return; n = 0; @@ -793,7 +793,7 @@ UpdateColors (ColormapPtr pmap) } if (n) (*pmap->pScreen->StoreColors)(pmap, n, defs); - xfree(defs); + free(defs); } /* Get a read-only color from a ColorMap (probably slow for large maps) @@ -840,7 +840,7 @@ AllocColor (ColormapPtr pmap, *pgreen = pmap->red[pixR].co.local.green; *pblue = pmap->red[pixR].co.local.blue; npix = pmap->numPixelsRed[client]; - ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client], + ppix = (Pixel *) realloc(pmap->clientPixelsRed[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); @@ -863,21 +863,21 @@ AllocColor (ColormapPtr pmap, *pgreen = pmap->green[pixG].co.local.green; *pblue = pmap->blue[pixB].co.local.blue; npix = pmap->numPixelsRed[client]; - ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client], + ppix = (Pixel *) realloc(pmap->clientPixelsRed[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixR; pmap->clientPixelsRed[client] = ppix; npix = pmap->numPixelsGreen[client]; - ppix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client], + ppix = (Pixel *) realloc(pmap->clientPixelsGreen[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixG; pmap->clientPixelsGreen[client] = ppix; npix = pmap->numPixelsBlue[client]; - ppix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client], + ppix = (Pixel *) realloc(pmap->clientPixelsBlue[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); @@ -962,7 +962,7 @@ AllocColor (ColormapPtr pmap, { colorResource *pcr; - pcr = xalloc(sizeof(colorResource)); + pcr = malloc(sizeof(colorResource)); if (!pcr) { (void)FreeColors(pmap, client, 1, pPix, (Pixel)0); @@ -1348,7 +1348,7 @@ gotit: break; } npix = nump[client]; - ppix = (Pixel *) xrealloc (pixp[client], (npix + 1) * sizeof(Pixel)); + ppix = (Pixel *) realloc(pixp[client], (npix + 1) * sizeof(Pixel)); if (!ppix) { pent->refcnt--; @@ -1518,7 +1518,7 @@ FreePixels(ColormapPtr pmap, int client) } } - xfree(ppixStart); + free(ppixStart); pmap->clientPixelsRed[client] = (Pixel *) NULL; pmap->numPixelsRed[client] = 0; if ((class | DynamicClass) == DirectColor) @@ -1527,7 +1527,7 @@ FreePixels(ColormapPtr pmap, int client) if (class & DynamicClass) for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;) FreeCell(pmap, *ppix++, GREENMAP); - xfree(ppixStart); + free(ppixStart); pmap->clientPixelsGreen[client] = (Pixel *) NULL; pmap->numPixelsGreen[client] = 0; @@ -1535,7 +1535,7 @@ FreePixels(ColormapPtr pmap, int client) if (class & DynamicClass) for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0; ) FreeCell(pmap, *ppix++, BLUEMAP); - xfree(ppixStart); + free(ppixStart); pmap->clientPixelsBlue[client] = (Pixel *) NULL; pmap->numPixelsBlue[client] = 0; } @@ -1558,7 +1558,7 @@ FreeClientPixels (pointer value, XID fakeid) DixRemoveAccess); if (rc == Success) FreePixels((ColormapPtr)pmap, pcr->client); - xfree(pcr); + free(pcr); return Success; } @@ -1580,7 +1580,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 = xalloc(sizeof(colorResource)); + pcr = malloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } @@ -1628,7 +1628,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes, if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr)) ok = BadAlloc; } else if (pcr) - xfree(pcr); + free(pcr); return (ok); } @@ -1655,7 +1655,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors, oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { - pcr = xalloc(sizeof(colorResource)); + pcr = malloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } @@ -1719,7 +1719,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors, if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr)) ok = BadAlloc; } else if (pcr) - xfree(pcr); + free(pcr); return (ok); } @@ -1747,14 +1747,14 @@ 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 = xalloc(npixR * sizeof(Pixel)); - ppixGreen = xalloc(npixG * sizeof(Pixel)); - ppixBlue = xalloc(npixB * sizeof(Pixel)); + ppixRed = malloc(npixR * sizeof(Pixel)); + ppixGreen = malloc(npixG * sizeof(Pixel)); + ppixBlue = malloc(npixB * sizeof(Pixel)); if (!ppixRed || !ppixGreen || !ppixBlue) { - if (ppixBlue) xfree(ppixBlue); - if (ppixGreen) xfree(ppixGreen); - if (ppixRed) xfree(ppixRed); + if (ppixBlue) free(ppixBlue); + if (ppixGreen) free(ppixGreen); + if (ppixRed) free(ppixRed); return(BadAlloc); } @@ -1764,17 +1764,17 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont if (okR && okG && okB) { - rpix = (Pixel *) xrealloc(pmap->clientPixelsRed[client], + rpix = (Pixel *) realloc(pmap->clientPixelsRed[client], (pmap->numPixelsRed[client] + (c << r)) * sizeof(Pixel)); if (rpix) pmap->clientPixelsRed[client] = rpix; - gpix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client], + gpix = (Pixel *) realloc(pmap->clientPixelsGreen[client], (pmap->numPixelsGreen[client] + (c << g)) * sizeof(Pixel)); if (gpix) pmap->clientPixelsGreen[client] = gpix; - bpix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client], + bpix = (Pixel *) realloc(pmap->clientPixelsBlue[client], (pmap->numPixelsBlue[client] + (c << b)) * sizeof(Pixel)); if (bpix) @@ -1792,9 +1792,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont if (okB) for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++) pmap->blue[*ppix].refcnt = 0; - xfree(ppixBlue); - xfree(ppixGreen); - xfree(ppixRed); + free(ppixBlue); + free(ppixGreen); + free(ppixRed); return(BadAlloc); } @@ -1836,9 +1836,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont for (pDst = pixels; pDst < pixels + c; pDst++) *pDst |= ALPHAMASK(pmap->pVisual); - xfree(ppixBlue); - xfree(ppixGreen); - xfree(ppixRed); + free(ppixBlue); + free(ppixGreen); + free(ppixRed); return (Success); } @@ -1854,7 +1854,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 = xalloc(npix * sizeof(Pixel)))) + if(!(ppixTemp = malloc(npix * sizeof(Pixel)))) return(BadAlloc); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); @@ -1863,7 +1863,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, /* all the allocated pixels are added to the client pixel list, * but only the unique ones are returned to the client */ - ppix = (Pixel *)xrealloc(pmap->clientPixelsRed[client], + ppix = (Pixel *)realloc(pmap->clientPixelsRed[client], (pmap->numPixelsRed[client] + npix) * sizeof(Pixel)); if (!ppix) { @@ -1884,7 +1884,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, pmap->numPixelsRed[client] += npix; pmap->freeRed -= npix; } - xfree(ppixTemp); + free(ppixTemp); return (ok ? Success : BadAlloc); } @@ -2084,16 +2084,16 @@ 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 = xalloc(npixShared * sizeof(SHAREDCOLOR *)); + psharedList = malloc(npixShared * sizeof(SHAREDCOLOR *)); if (!psharedList) return FALSE; ppshared = psharedList; for (z = npixShared; --z >= 0; ) { - if (!(ppshared[z] = xalloc(sizeof(SHAREDCOLOR)))) + if (!(ppshared[z] = malloc(sizeof(SHAREDCOLOR)))) { for (z++ ; z < npixShared; z++) - xfree(ppshared[z]); + free(ppshared[z]); return FALSE; } } @@ -2198,7 +2198,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, } } } - xfree(psharedList); + free(psharedList); return TRUE; } @@ -2366,7 +2366,7 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe npix++; } } - pptr = (Pixel *)xrealloc(ppixClient, npixNew * sizeof(Pixel)); + pptr = (Pixel *)realloc(ppixClient, npixNew * sizeof(Pixel)); if (pptr) ppixClient = pptr; npixClient = npixNew; @@ -2374,7 +2374,7 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe else { npixClient = 0; - xfree(ppixClient); + free(ppixClient); ppixClient = (Pixel *)NULL; } switch(color) @@ -2673,7 +2673,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin) Colormap *pmaps; int imap, nummaps, found; - pmaps = xalloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap)); + pmaps = malloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap)); if(!pmaps) return(FALSE); nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) @@ -2687,7 +2687,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin) break; } } - xfree(pmaps); + free(pmaps); return (found); } @@ -2727,7 +2727,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, first_new_vid = depth->numVids; first_new_visual = pScreen->numVisuals; - vids = xrealloc(depth->vids, (depth->numVids + new_visual_count) * sizeof(XID)); + vids = realloc(depth->vids, (depth->numVids + new_visual_count) * sizeof(XID)); if (!vids) return FALSE; @@ -2735,7 +2735,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, depth->vids = vids; numVisuals = pScreen->numVisuals + new_visual_count; - visuals = xrealloc(pScreen->visuals, numVisuals * sizeof(VisualRec)); + visuals = realloc(pScreen->visuals, numVisuals * sizeof(VisualRec)); if (!visuals) { return FALSE; } diff --git a/dix/cursor.c b/dix/cursor.c index 5d9c8b080..a512309bb 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -81,10 +81,10 @@ FreeCursorBits(CursorBitsPtr bits) { if (--bits->refcnt > 0) return; - xfree(bits->source); - xfree(bits->mask); + free(bits->source); + free(bits->mask); #ifdef ARGB_CURSOR - xfree(bits->argb); + free(bits->argb); #endif dixFreePrivates(bits->devPrivates); bits->devPrivates = NULL; @@ -100,9 +100,9 @@ FreeCursorBits(CursorBitsPtr bits) { *prev = this->next; CloseFont(this->font, (Font)0); - xfree(this); + free(this); } - xfree(bits); + free(bits); } } @@ -130,7 +130,7 @@ FreeCursor(pointer value, XID cid) } dixFreePrivates(pCurs->devPrivates); FreeCursorBits(pCurs->bits); - xfree( pCurs); + free( pCurs); return(Success); } @@ -237,11 +237,11 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, int rc; *ppCurs = NULL; - pCurs = (CursorPtr)xcalloc(sizeof(CursorRec) + sizeof(CursorBits), 1); + pCurs = (CursorPtr)calloc(sizeof(CursorRec) + sizeof(CursorBits), 1); if (!pCurs) { - xfree(psrcbits); - xfree(pmaskbits); + free(psrcbits); + free(pmaskbits); return BadAlloc; } bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); @@ -291,7 +291,7 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, error: dixFreePrivates(pCurs->devPrivates); FreeCursorBits(bits); - xfree(pCurs); + free(pCurs); return rc; } @@ -339,7 +339,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, } if (pShare) { - pCurs = (CursorPtr)xcalloc(sizeof(CursorRec), 1); + pCurs = (CursorPtr)calloc(sizeof(CursorRec), 1); if (!pCurs) return BadAlloc; bits = pShare->bits; @@ -358,7 +358,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, unsigned char *mskptr; n = BitmapBytePad(cm.width)*(long)cm.height; - mskptr = mskbits = xalloc(n); + mskptr = mskbits = malloc(n); if (!mskptr) return BadAlloc; while (--n >= 0) @@ -376,13 +376,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, } if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))) { - xfree(mskbits); + free(mskbits); return rc; } if (sourcefont != maskfont) { pCurs = - (CursorPtr)xcalloc(sizeof(CursorRec) + sizeof(CursorBits), 1); + (CursorPtr)calloc(sizeof(CursorRec) + sizeof(CursorBits), 1); if (pCurs) bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); else @@ -390,17 +390,17 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, } else { - pCurs = (CursorPtr)xcalloc(sizeof(CursorRec), 1); + pCurs = (CursorPtr)calloc(sizeof(CursorRec), 1); if (pCurs) - bits = (CursorBitsPtr)xcalloc(sizeof(CursorBits), 1); + bits = (CursorBitsPtr)calloc(sizeof(CursorBits), 1); else bits = (CursorBitsPtr)NULL; } if (!bits) { - xfree(pCurs); - xfree(mskbits); - xfree(srcbits); + free(pCurs); + free(mskbits); + free(srcbits); return BadAlloc; } bits->source = srcbits; @@ -418,7 +418,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, else { bits->refcnt = 1; - pShare = xalloc(sizeof(GlyphShare)); + pShare = malloc(sizeof(GlyphShare)); if (!pShare) { FreeCursorBits(bits); @@ -469,7 +469,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, error: dixFreePrivates(pCurs->devPrivates); FreeCursorBits(bits); - xfree(pCurs); + free(pCurs); return rc; } diff --git a/dix/devices.c b/dix/devices.c index a33df4d0a..db5c4a136 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -141,7 +141,7 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd) if (kbd->spriteInfo->spriteOwner) { - xfree(kbd->spriteInfo->sprite); + free(kbd->spriteInfo->sprite); kbd->spriteInfo->sprite = NULL; kbd->spriteInfo->spriteOwner = FALSE; } @@ -195,7 +195,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) if (devid >= MAXDEVICES) return (DeviceIntPtr)NULL; - dev = xcalloc(sizeof(DeviceIntRec) + sizeof(SpriteInfoRec), 1); + dev = calloc(sizeof(DeviceIntRec) + sizeof(SpriteInfoRec), 1); if (!dev) return (DeviceIntPtr)NULL; dev->id = devid; @@ -218,7 +218,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) /* security creation/labeling check */ if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) { - xfree(dev); + free(dev); return NULL; } @@ -664,15 +664,15 @@ FreeDeviceClass(int type, pointer *class) XkbFreeInfo((*k)->xkbInfo); (*k)->xkbInfo = NULL; } - xfree((*k)); + free((*k)); break; } case ButtonClass: { ButtonClassPtr *b = (ButtonClassPtr*)class; if ((*b)->xkb_acts) - xfree((*b)->xkb_acts); - xfree((*b)); + free((*b)->xkb_acts); + free((*b)); break; } case ValuatorClass: @@ -680,21 +680,21 @@ FreeDeviceClass(int type, pointer *class) ValuatorClassPtr *v = (ValuatorClassPtr*)class; if ((*v)->motion) - xfree((*v)->motion); - xfree((*v)); + free((*v)->motion); + free((*v)); break; } case FocusClass: { FocusClassPtr *f = (FocusClassPtr*)class; - xfree((*f)->trace); - xfree((*f)); + free((*f)->trace); + free((*f)); break; } case ProximityClass: { ProximityClassPtr *p = (ProximityClassPtr*)class; - xfree((*p)); + free((*p)); break; } } @@ -717,7 +717,7 @@ FreeFeedbackClass(int type, pointer *class) knext = k->next; if (k->xkb_sli) XkbFreeSrvLedInfo(k->xkb_sli); - xfree(k); + free(k); } break; } @@ -728,7 +728,7 @@ FreeFeedbackClass(int type, pointer *class) for (p = (*ptrfeed); p; p = pnext) { pnext = p->next; - xfree(p); + free(p); } break; } @@ -739,7 +739,7 @@ FreeFeedbackClass(int type, pointer *class) for (i = (*intfeed); i; i = inext) { inext = i->next; - xfree(i); + free(i); } break; } @@ -750,9 +750,9 @@ FreeFeedbackClass(int type, pointer *class) for (s = (*stringfeed); s; s = snext) { snext = s->next; - xfree(s->ctrl.symbols_supported); - xfree(s->ctrl.symbols_displayed); - xfree(s); + free(s->ctrl.symbols_supported); + free(s->ctrl.symbols_displayed); + free(s); } break; } @@ -763,7 +763,7 @@ FreeFeedbackClass(int type, pointer *class) for (b = (*bell); b; b = bnext) { bnext = b->next; - xfree(b); + free(b); } break; } @@ -776,7 +776,7 @@ FreeFeedbackClass(int type, pointer *class) lnext = l->next; if (l->xkb_sli) XkbFreeSrvLedInfo(l->xkb_sli); - xfree(l); + free(l); } break; } @@ -838,7 +838,7 @@ CloseDevice(DeviceIntPtr dev) while (dev->xkb_interest) XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); - xfree(dev->name); + free(dev->name); classes = (ClassesPtr)&dev->key; FreeAllDeviceClasses(classes); @@ -847,14 +847,14 @@ CloseDevice(DeviceIntPtr dev) { classes = dev->unused_classes; FreeAllDeviceClasses(classes); - xfree(classes); + free(classes); } if (DevHasCursor(dev) && dev->spriteInfo->sprite) { if (dev->spriteInfo->sprite->current) FreeCursor(dev->spriteInfo->sprite->current, None); - xfree(dev->spriteInfo->sprite->spriteTrace); - xfree(dev->spriteInfo->sprite); + free(dev->spriteInfo->sprite->spriteTrace); + free(dev->spriteInfo->sprite); } /* a client may have the device set as client pointer */ @@ -867,9 +867,9 @@ CloseDevice(DeviceIntPtr dev) } } - xfree(dev->deviceGrab.sync.event); + free(dev->deviceGrab.sync.event); dixFreePrivates(dev->devPrivates); - xfree(dev); + free(dev); } /** @@ -1110,7 +1110,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src) else if (src->mapWidth > dst->mapWidth) { i = sizeof(KeySym) * src->mapWidth * (dst->maxKeyCode - dst->minKeyCode + 1); - tmp = xcalloc(sizeof(KeySym), i); + tmp = calloc(sizeof(KeySym), i); if (!tmp) return FALSE; @@ -1118,7 +1118,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src) for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++) memmove(&tmp[i * src->mapWidth], &dst->map[i * dst->mapWidth], dst->mapWidth * sizeof(KeySym)); - xfree(dst->map); + free(dst->map); } dst->mapWidth = src->mapWidth; dst->map = tmp; @@ -1126,7 +1126,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src) else if (!dst->map) { i = sizeof(KeySym) * src->mapWidth * (dst->maxKeyCode - dst->minKeyCode + 1); - tmp = xcalloc(sizeof(KeySym), i); + tmp = calloc(sizeof(KeySym), i); if (!tmp) return FALSE; @@ -1148,7 +1148,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom* labels, ButtonClassPtr butc; int i; - butc = xcalloc(1, sizeof(ButtonClassRec)); + butc = calloc(1, sizeof(ButtonClassRec)); if (!butc) return FALSE; butc->numButtons = numButtons; @@ -1180,7 +1180,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels, numAxes = MAX_VALUATORS; } - valc = (ValuatorClassPtr)xcalloc(1, sizeof(ValuatorClassRec) + + valc = (ValuatorClassPtr)calloc(1, sizeof(ValuatorClassRec) + numAxes * sizeof(AxisInfo) + numAxes * sizeof(double)); if (!valc) @@ -1263,7 +1263,7 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, case PtrAccelPredictable: { DeviceVelocityPtr s; - s = xalloc(sizeof(DeviceVelocityRec)); + s = malloc(sizeof(DeviceVelocityRec)); if(!s) return FALSE; InitVelocityData(s); @@ -1295,7 +1295,7 @@ InitAbsoluteClassDeviceStruct(DeviceIntPtr dev) { AbsoluteClassPtr abs; - abs = xalloc(sizeof(AbsoluteClassRec)); + abs = malloc(sizeof(AbsoluteClassRec)); if (!abs) return FALSE; @@ -1328,7 +1328,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev) { FocusClassPtr focc; - focc = xalloc(sizeof(FocusClassRec)); + focc = malloc(sizeof(FocusClassRec)); if (!focc) return FALSE; focc->win = PointerRootWin; @@ -1347,7 +1347,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) { PtrFeedbackPtr feedc; - feedc = xalloc(sizeof(PtrFeedbackClassRec)); + feedc = malloc(sizeof(PtrFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; @@ -1385,22 +1385,22 @@ InitStringFeedbackClassDeviceStruct ( int i; StringFeedbackPtr feedc; - feedc = xalloc(sizeof(StringFeedbackClassRec)); + feedc = malloc(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 = xalloc (sizeof (KeySym) * num_symbols_supported); - feedc->ctrl.symbols_displayed = xalloc (sizeof (KeySym) * max_symbols); + feedc->ctrl.symbols_supported = malloc(sizeof (KeySym) * num_symbols_supported); + feedc->ctrl.symbols_displayed = malloc(sizeof (KeySym) * max_symbols); if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) { if (feedc->ctrl.symbols_supported) - xfree(feedc->ctrl.symbols_supported); + free(feedc->ctrl.symbols_supported); if (feedc->ctrl.symbols_displayed) - xfree(feedc->ctrl.symbols_displayed); - xfree(feedc); + free(feedc->ctrl.symbols_displayed); + free(feedc); return FALSE; } for (i=0; i<num_symbols_supported; i++) @@ -1421,7 +1421,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc, { BellFeedbackPtr feedc; - feedc = xalloc(sizeof(BellFeedbackClassRec)); + feedc = malloc(sizeof(BellFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; @@ -1440,7 +1440,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc) { LedFeedbackPtr feedc; - feedc = xalloc(sizeof(LedFeedbackClassRec)); + feedc = malloc(sizeof(LedFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; @@ -1459,7 +1459,7 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr { IntegerFeedbackPtr feedc; - feedc = xalloc(sizeof(IntegerFeedbackClassRec)); + feedc = malloc(sizeof(IntegerFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; @@ -1559,7 +1559,7 @@ ProcGetModifierMapping(ClientPtr client) WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep); (void)WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap); - xfree(modkeymap); + free(modkeymap); return client->noClientException; } @@ -1719,8 +1719,8 @@ ProcGetKeyboardMapping(ClientPtr client) syms->mapWidth * stuff->count * sizeof(KeySym), &syms->map[syms->mapWidth * (stuff->firstKeyCode - syms->minKeyCode)]); - xfree(syms->map); - xfree(syms); + free(syms->map); + free(syms); return client->noClientException; } @@ -2215,7 +2215,7 @@ ProcGetMotionEvents(ClientPtr client) (char *)coords); } if (coords) - xfree(coords); + free(coords); return Success; } @@ -2348,7 +2348,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) { screen = miPointerGetScreen(dev); screen->DeviceCursorCleanup(dev, screen); - xfree(dev->spriteInfo->sprite); + free(dev->spriteInfo->sprite); } oldmaster = dev->u.master; @@ -2467,7 +2467,7 @@ AllocDevicePair (ClientPtr client, char* name, if (!pointer) return BadAlloc; - pointer->name = xcalloc(strlen(name) + strlen(" pointer") + 1, sizeof(char)); + pointer->name = calloc(strlen(name) + strlen(" pointer") + 1, sizeof(char)); strcpy(pointer->name, name); strcat(pointer->name, " pointer"); @@ -2490,7 +2490,7 @@ AllocDevicePair (ClientPtr client, char* name, return BadAlloc; } - keyboard->name = xcalloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char)); + keyboard->name = calloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char)); strcpy(keyboard->name, name); strcat(keyboard->name, " keyboard"); @@ -2507,8 +2507,8 @@ AllocDevicePair (ClientPtr client, char* name, keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE; /* The ClassesRec stores the device classes currently not used. */ - pointer->unused_classes = xcalloc(1, sizeof(ClassesRec)); - keyboard->unused_classes = xcalloc(1, sizeof(ClassesRec)); + pointer->unused_classes = calloc(1, sizeof(ClassesRec)); + keyboard->unused_classes = calloc(1, sizeof(ClassesRec)); *ptr = pointer; *keybd = keyboard; diff --git a/dix/dispatch.c b/dix/dispatch.c index a2cffacda..63c978c12 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -359,7 +359,7 @@ Dispatch(void) nextFreeClientID = 1; nClients = 0; - clientReady = xalloc(sizeof(int) * MaxClients); + clientReady = malloc(sizeof(int) * MaxClients); if (!clientReady) return; @@ -466,7 +466,7 @@ Dispatch(void) ddxBeforeReset (); #endif KillAllClients(); - xfree(clientReady); + free(clientReady); dispatchException &= ~DE_RESET; SmartScheduleLatencyLimited = 0; } @@ -530,7 +530,7 @@ CreateConnectionBlock(void) pad_to_int32(setup.nbytesVendor) + (setup.numFormats * sizeof(xPixmapFormat)) + (setup.numRoots * sizeof(xWindowRoot)); - ConnectionInfo = xalloc(lenofblock); + ConnectionInfo = malloc(lenofblock); if (!ConnectionInfo) return FALSE; @@ -592,10 +592,10 @@ CreateConnectionBlock(void) { lenofblock += sizeof(xDepth) + (pDepth->numVids * sizeof(xVisualType)); - pBuf = (char *)xrealloc(ConnectionInfo, lenofblock); + pBuf = (char *)realloc(ConnectionInfo, lenofblock); if (!pBuf) { - xfree(ConnectionInfo); + free(ConnectionInfo); return FALSE; } ConnectionInfo = pBuf; @@ -1019,7 +1019,7 @@ ProcQueryTree(ClientPtr client) { int curChild = 0; - childIDs = xalloc(numChildren * sizeof(Window)); + childIDs = malloc(numChildren * sizeof(Window)); if (!childIDs) return BadAlloc; for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) @@ -1034,7 +1034,7 @@ ProcQueryTree(ClientPtr client) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); - xfree(childIDs); + free(childIDs); } return(client->noClientException); @@ -1308,7 +1308,7 @@ ProcQueryFont(ClientPtr client) rlength = sizeof(xQueryFontReply) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + nprotoxcistructs * sizeof(xCharInfo); - reply = xcalloc(1, rlength); + reply = calloc(1, rlength); if(!reply) { return(BadAlloc); @@ -1320,7 +1320,7 @@ ProcQueryFont(ClientPtr client) QueryFont( pFont, reply, nprotoxcistructs); WriteReplyToClient(client, rlength, reply); - xfree(reply); + free(reply); return(client->noClientException); } } @@ -2154,7 +2154,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, xgi.length = length; if (im_return) { - pBuf = xcalloc(1, sz_xGetImageReply + length); + pBuf = calloc(1, sz_xGetImageReply + length); if (!pBuf) return (BadAlloc); if (widthBytesLine == 0) @@ -2192,7 +2192,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, length += widthBytesLine; } } - if(!(pBuf = xcalloc(1, length))) + if(!(pBuf = calloc(1, length))) return (BadAlloc); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); } @@ -2293,7 +2293,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, if (pVisibleRegion) REGION_DESTROY(pDraw->pScreen, pVisibleRegion); if (!im_return) - xfree(pBuf); + free(pBuf); return (client->noClientException); } @@ -2564,7 +2564,7 @@ ProcListInstalledColormaps(ClientPtr client) if (rc != Success) goto out; - preply = xalloc(sizeof(xListInstalledColormapsReply) + + preply = malloc(sizeof(xListInstalledColormapsReply) + pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!preply) @@ -2579,7 +2579,7 @@ ProcListInstalledColormaps(ClientPtr client) WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]); - xfree(preply); + free(preply); rc = client->noClientException; out: return rc; @@ -2708,7 +2708,7 @@ ProcAllocColorCells (ClientPtr client) } nmasks = stuff->planes; length = ((long)npixels + (long)nmasks) * sizeof(Pixel); - ppixels = xalloc(length); + ppixels = malloc(length); if(!ppixels) return(BadAlloc); pmasks = ppixels + npixels; @@ -2716,7 +2716,7 @@ ProcAllocColorCells (ClientPtr client) if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks, (Bool)stuff->contiguous, ppixels, pmasks)) ) { - xfree(ppixels); + free(ppixels); if (client->noClientException != Success) return(client->noClientException); else @@ -2735,7 +2735,7 @@ ProcAllocColorCells (ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); } - xfree(ppixels); + free(ppixels); return (client->noClientException); } else @@ -2777,7 +2777,7 @@ ProcAllocColorPlanes(ClientPtr client) acpr.sequenceNumber = client->sequence; acpr.nPixels = npixels; length = (long)npixels * sizeof(Pixel); - ppixels = xalloc(length); + ppixels = malloc(length); if(!ppixels) return(BadAlloc); if( (rc = AllocColorPlanes(client->index, pcmp, npixels, @@ -2785,7 +2785,7 @@ ProcAllocColorPlanes(ClientPtr client) (Bool)stuff->contiguous, ppixels, &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) ) { - xfree(ppixels); + free(ppixels); if (client->noClientException != Success) return(client->noClientException); else @@ -2800,7 +2800,7 @@ ProcAllocColorPlanes(ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); } - xfree(ppixels); + free(ppixels); return (client->noClientException); } else @@ -2930,12 +2930,12 @@ ProcQueryColors(ClientPtr client) xQueryColorsReply qcr; count = bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq)); - prgbs = xcalloc(1, count * sizeof(xrgb)); + prgbs = calloc(1, count * sizeof(xrgb)); if(!prgbs && count) return(BadAlloc); if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) { - if (prgbs) xfree(prgbs); + if (prgbs) free(prgbs); if (client->noClientException != Success) return(client->noClientException); else @@ -2955,7 +2955,7 @@ ProcQueryColors(ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs); } - if (prgbs) xfree(prgbs); + if (prgbs) free(prgbs); return(client->noClientException); } @@ -3054,13 +3054,13 @@ ProcCreateCursor (ClientPtr client) return (BadMatch); n = BitmapBytePad(width)*height; - srcbits = xcalloc(1, n); + srcbits = calloc(1, n); if (!srcbits) return (BadAlloc); - mskbits = xalloc(n); + mskbits = malloc(n); if (!mskbits) { - xfree(srcbits); + free(srcbits); return (BadAlloc); } @@ -3323,7 +3323,7 @@ ProcListHosts(ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend; WriteSwappedDataToClient(client, len, pdata); } - xfree(pdata); + free(pdata); return (client->noClientException); } @@ -3619,7 +3619,7 @@ CloseDownClient(ClientPtr client) clients[client->index] = NullClient; SmartLastClient = NullClient; dixFreePrivates(client->devPrivates); - xfree(client); + free(client); while (!clients[currentMaxClients-1]) currentMaxClients--; @@ -3668,13 +3668,13 @@ ClientPtr NextAvailableClient(pointer ospriv) i = nextFreeClientID; if (i == MAXCLIENTS) return (ClientPtr)NULL; - clients[i] = client = xalloc(sizeof(ClientRec)); + clients[i] = client = malloc(sizeof(ClientRec)); if (!client) return (ClientPtr)NULL; InitClient(client, i, ospriv); if (!InitClientResources(client)) { - xfree(client); + free(client); return (ClientPtr)NULL; } data.reqType = 1; @@ -3682,7 +3682,7 @@ ClientPtr NextAvailableClient(pointer ospriv) if (!InsertFakeRequest(client, (char *)&data, sz_xReq)) { FreeClientResources(client); - xfree(client); + free(client); return (ClientPtr)NULL; } if (i == currentMaxClients) @@ -3985,7 +3985,7 @@ AddScreen( if (i == MAXSCREENS) return -1; - pScreen = (ScreenPtr) xcalloc(1, sizeof(ScreenRec)); + pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec)); if (!pScreen) return -1; @@ -4044,7 +4044,7 @@ AddScreen( if (!(*pfnInit)(i, pScreen, argc, argv)) { dixFreePrivates(pScreen->devPrivates); - xfree(pScreen); + free(pScreen); screenInfo.numScreens--; return -1; } diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 6dc819313..cc58b89fd 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -166,7 +166,7 @@ QueueFontWakeup(FontPathElementPtr fpe) } if (num_slept_fpes == size_slept_fpes) { new = (FontPathElementPtr *) - xrealloc(slept_fpes, + realloc(slept_fpes, sizeof(FontPathElementPtr) * (size_slept_fpes + 4)); if (!new) return; @@ -222,8 +222,8 @@ FreeFPE (FontPathElementPtr fpe) fpe->refcount--; if (fpe->refcount == 0) { (*fpe_functions[fpe->type].free_fpe) (fpe); - xfree(fpe->name); - xfree(fpe); + free(fpe->name); + free(fpe); } } @@ -297,7 +297,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (err == FontNameAlias && alias) { newlen = strlen(alias); - newname = (char *) xrealloc(c->fontname, newlen); + newname = (char *) realloc(c->fontname, newlen); if (!newname) { err = AllocError; break; @@ -378,9 +378,9 @@ bail: for (i = 0; i < c->num_fpes; i++) { FreeFPE(c->fpe_list[i]); } - xfree(c->fpe_list); - xfree(c->fontname); - xfree(c); + free(c->fpe_list); + free(c->fontname); + free(c); return TRUE; } @@ -393,11 +393,11 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna #ifdef FONTDEBUG char *f; - f = xalloc(lenfname + 1); + f = malloc(lenfname + 1); memmove(f, pfontname, lenfname); f[lenfname] = '\0'; ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f); - xfree(f); + free(f); #endif if (!lenfname || lenfname > XLFDMAXFONTNAMELEN) return BadName; @@ -430,24 +430,24 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna return Success; } } - c = xalloc(sizeof(OFclosureRec)); + c = malloc(sizeof(OFclosureRec)); if (!c) return BadAlloc; - c->fontname = xalloc(lenfname); + c->fontname = malloc(lenfname); c->origFontName = pfontname; c->origFontNameLen = lenfname; if (!c->fontname) { - xfree(c); + free(c); return BadAlloc; } /* * 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 = xalloc(sizeof(FontPathElementPtr) * num_fpes); + c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { - xfree(c->fontname); - xfree(c); + free(c->fontname); + free(c); return BadAlloc; } memmove(c->fontname, pfontname, lenfname); @@ -677,8 +677,8 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) return TRUE; } if (err == FontNameAlias) { - if (resolved) xfree(resolved); - resolved = xalloc(resolvedlen + 1); + if (resolved) free(resolved); + resolved = malloc(resolvedlen + 1); if (resolved) memmove(resolved, tmpname, resolvedlen + 1); } @@ -732,8 +732,8 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) c->saved = c->current; c->haveSaved = TRUE; if (c->savedName) - xfree(c->savedName); - c->savedName = xalloc(namelen + 1); + free(c->savedName); + c->savedName = malloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); c->savedNameLen = namelen; @@ -795,7 +795,7 @@ finish: reply.nFonts = nnames; reply.sequenceNumber = client->sequence; - bufptr = bufferStart = xalloc(reply.length << 2); + bufptr = bufferStart = malloc(reply.length << 2); if (!bufptr && reply.length) { SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); @@ -820,18 +820,18 @@ finish: client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); (void) WriteToClient(client, stringLens + nnames, bufferStart); - xfree(bufferStart); + free(bufferStart); bail: if (c->slept) ClientWakeup(client); for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); - xfree(c->fpe_list); - if (c->savedName) xfree(c->savedName); + free(c->fpe_list); + if (c->savedName) free(c->savedName); FreeFontNames(names); - xfree(c); - if (resolved) xfree(resolved); + free(c); + if (resolved) free(resolved); return TRUE; } @@ -855,18 +855,18 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, if (i != Success) return i; - if (!(c = xalloc(sizeof *c))) + if (!(c = malloc(sizeof *c))) return BadAlloc; - c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes); + c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { - xfree(c); + free(c); return BadAlloc; } c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100); if (!c->names) { - xfree(c->fpe_list); - xfree(c); + free(c->fpe_list); + free(c); return BadAlloc; } memmove( c->current.pattern, pattern, length); @@ -995,8 +995,8 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) c->haveSaved = TRUE; c->savedNumFonts = numFonts; if (c->savedName) - xfree(c->savedName); - c->savedName = xalloc(namelen + 1); + free(c->savedName); + c->savedName = malloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); aliascount = 20; @@ -1039,7 +1039,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) reply = c->reply; if (c->length < length) { - reply = (xListFontsWithInfoReply *) xrealloc(c->reply, length); + reply = (xListFontsWithInfoReply *) realloc(c->reply, length); if (!reply) { err = AllocError; @@ -1085,8 +1085,8 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) (void) WriteToClient(client, namelen, name); if (pFontInfo == &fontInfo) { - xfree(fontInfo.props); - xfree(fontInfo.isStringProp); + free(fontInfo.props); + free(fontInfo.isStringProp); } --c->current.max_names; } @@ -1104,10 +1104,10 @@ bail: ClientWakeup(client); for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); - xfree(c->reply); - xfree(c->fpe_list); - if (c->savedName) xfree(c->savedName); - xfree(c); + free(c->reply); + free(c->fpe_list); + if (c->savedName) free(c->savedName); + free(c); return TRUE; } @@ -1131,12 +1131,12 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern, if (i != Success) return i; - if (!(c = xalloc(sizeof *c))) + if (!(c = malloc(sizeof *c))) goto badAlloc; - c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes); + c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { - xfree(c); + free(c); goto badAlloc; } memmove(c->current.pattern, pattern, length); @@ -1320,7 +1320,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) /* Step 1 */ /* Allocate a malloc'd closure structure to replace the local one we were passed */ - new_closure = xalloc(sizeof(PTclosureRec)); + new_closure = malloc(sizeof(PTclosureRec)); if (!new_closure) { err = BadAlloc; @@ -1330,10 +1330,10 @@ doPolyText(ClientPtr client, PTclosurePtr c) c = new_closure; len = c->endReq - c->pElt; - c->data = xalloc(len); + c->data = malloc(len); if (!c->data) { - xfree(c); + free(c); err = BadAlloc; goto bail; } @@ -1346,8 +1346,8 @@ doPolyText(ClientPtr client, PTclosurePtr c) pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); if (!pGC) { - xfree(c->data); - xfree(c); + free(c->data); + free(c); err = BadAlloc; goto bail; } @@ -1362,8 +1362,8 @@ doPolyText(ClientPtr client, PTclosurePtr c) Success) { FreeScratchGC(pGC); - xfree(c->data); - xfree(c); + free(c->data); + free(c); err = BadAlloc; goto bail; } @@ -1430,8 +1430,8 @@ bail: c->pGC->font = NullFont; FreeScratchGC(c->pGC); - xfree(c->data); - xfree(c); + free(c->data); + free(c); } return TRUE; } @@ -1513,7 +1513,7 @@ doImageText(ClientPtr client, ITclosurePtr c) in doPolyText, but much simpler because the request structure is much simpler. */ - new_closure = xalloc(sizeof(ITclosureRec)); + new_closure = malloc(sizeof(ITclosureRec)); if (!new_closure) { err = BadAlloc; @@ -1522,10 +1522,10 @@ doImageText(ClientPtr client, ITclosurePtr c) *new_closure = *c; c = new_closure; - data = xalloc(c->nChars * c->itemSize); + data = malloc(c->nChars * c->itemSize); if (!data) { - xfree(c); + free(c); err = BadAlloc; goto bail; } @@ -1535,8 +1535,8 @@ doImageText(ClientPtr client, ITclosurePtr c) pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); if (!pGC) { - xfree(c->data); - xfree(c); + free(c->data); + free(c); err = BadAlloc; goto bail; } @@ -1548,8 +1548,8 @@ doImageText(ClientPtr client, ITclosurePtr c) GCClipYOrigin | GCClipMask)) != Success) { FreeScratchGC(pGC); - xfree(c->data); - xfree(c); + free(c->data); + free(c); err = BadAlloc; goto bail; } @@ -1587,8 +1587,8 @@ bail: c->pGC->font = NullFont; FreeScratchGC(c->pGC); - xfree(c->data); - xfree(c); + free(c->data); + free(c); } return TRUE; } @@ -1659,7 +1659,7 @@ FreeFontPath(FontPathElementPtr *list, int n, Bool force) } FreeFPE(list[i]); } - xfree(list); + free(list); } static FontPathElementPtr @@ -1686,7 +1686,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) unsigned char *cp = paths; FontPathElementPtr fpe = NULL, *fplist; - fplist = xalloc(sizeof(FontPathElementPtr) * npaths); + fplist = malloc(sizeof(FontPathElementPtr) * npaths); if (!fplist) { *bad = 0; return BadAlloc; @@ -1727,16 +1727,16 @@ 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 = xalloc(sizeof(FontPathElementRec)); + fpe = malloc(sizeof(FontPathElementRec)); if (!fpe) { err = BadAlloc; goto bail; } - fpe->name = xalloc(len + 1); + fpe->name = malloc(len + 1); if (!fpe->name) { - xfree(fpe); + free(fpe); err = BadAlloc; goto bail; } @@ -1757,8 +1757,8 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) ErrorF("[dix] Could not init font path element %s, removing from list!\n", fpe->name); } - xfree (fpe->name); - xfree (fpe); + free(fpe->name); + free(fpe); } } } @@ -1785,7 +1785,7 @@ bail: *bad = i; while (--valid_paths >= 0) FreeFPE(fplist[valid_paths]); - xfree(fplist); + free(fplist); return FontToXError(err); } @@ -1843,7 +1843,7 @@ SetDefaultFontPath(char *path) /* get enough for string, plus values -- use up commas */ len = strlen(temp_path) + 1; - nump = cp = newpath = xalloc(len); + nump = cp = newpath = malloc(len); if (!newpath) return BadAlloc; pp = (unsigned char *) temp_path; @@ -1864,8 +1864,8 @@ SetDefaultFontPath(char *path) err = SetFontPathElements(num, newpath, &bad, TRUE); - xfree(newpath); - xfree(temp_path); + free(newpath); + free(temp_path); return err; } @@ -1887,7 +1887,7 @@ GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result) fpe = font_path_elements[i]; len += fpe->name_length + 1; } - font_path_string = (unsigned char *) xrealloc(font_path_string, len); + font_path_string = (unsigned char *) realloc(font_path_string, len); if (!font_path_string) return BadAlloc; @@ -1988,7 +1988,7 @@ RegisterFPEFunctions(NameCheckFunc name_func, FPEFunctions *new; /* grow the list */ - new = (FPEFunctions *) xrealloc(fpe_functions, + new = (FPEFunctions *) realloc(fpe_functions, (num_fpe_types + 1) * sizeof(FPEFunctions)); if (!new) return -1; @@ -2027,7 +2027,7 @@ FreeFonts(void) FreeFontPath(font_path_elements, num_fpes, TRUE); font_path_elements = 0; num_fpes = 0; - xfree(fpe_functions); + free(fpe_functions); num_fpe_types = 0; fpe_functions = (FPEFunctions *) 0; } diff --git a/dix/dixutils.c b/dix/dixutils.c index d61083609..5955eb84a 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -300,7 +300,7 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, if (j < numnow) /* duplicate */ return(Success); numnow++; - pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(*pTmp) * numnow); + pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow); if (!pTmp) return(BadAlloc); client->saveSet = pTmp; @@ -320,13 +320,13 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, numnow--; if (numnow) { - pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(*pTmp) * numnow); + pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow); if (pTmp) client->saveSet = pTmp; } else { - xfree(client->saveSet); + free(client->saveSet); client->saveSet = (SaveSetElt *)NULL; } client->numSaved = numnow; @@ -453,7 +453,7 @@ RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, if (numHandlers >= sizeHandlers) { - new = (BlockHandlerPtr) xrealloc (handlers, (numHandlers + 1) * + new = (BlockHandlerPtr) realloc(handlers, (numHandlers + 1) * sizeof (BlockHandlerRec)); if (!new) return FALSE; @@ -498,7 +498,7 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, void InitBlockAndWakeupHandlers (void) { - xfree (handlers); + free(handlers); handlers = (BlockHandlerPtr) 0; numHandlers = 0; sizeHandlers = 0; @@ -530,7 +530,7 @@ ProcessWorkQueue(void) { /* remove q from the list */ *p = q->next; /* don't fetch until after func called */ - xfree (q); + free(q); } else { @@ -553,7 +553,7 @@ ProcessWorkQueueZombies(void) (void) (*q->function) (q->client, q->closure); /* remove q from the list */ *p = q->next; /* don't fetch until after func called */ - xfree (q); + free(q); } else { @@ -570,7 +570,7 @@ QueueWorkProc ( { WorkQueuePtr q; - q = xalloc (sizeof *q); + q = malloc(sizeof *q); if (!q) return FALSE; q->function = function; @@ -604,7 +604,7 @@ ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure) { SleepQueuePtr q; - q = xalloc (sizeof *q); + q = malloc(sizeof *q); if (!q) return FALSE; @@ -641,7 +641,7 @@ ClientWakeup (ClientPtr client) if (q->client == client) { *prev = q->next; - xfree (q); + free(q); if (client->clientGone) /* Oops -- new zombie cleanup code ensures this only * happens from inside CloseDownClient; don't want to @@ -684,7 +684,7 @@ _AddCallback( { CallbackPtr cbr; - cbr = xalloc(sizeof(CallbackRec)); + cbr = malloc(sizeof(CallbackRec)); if (!cbr) return FALSE; cbr->proc = callback; @@ -724,7 +724,7 @@ _DeleteCallback( cbl->list = cbr->next; else pcbr->next = cbr->next; - xfree(cbr); + free(cbr); } return TRUE; } @@ -769,12 +769,12 @@ _CallCallbacks( if (pcbr) { cbr = cbr->next; - xfree(pcbr->next); + free(pcbr->next); pcbr->next = cbr; } else { cbr = cbr->next; - xfree(cbl->list); + free(cbl->list); cbl->list = cbr; } cbl->numDeleted--; @@ -814,9 +814,9 @@ _DeleteCallbackList( for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) { nextcbr = cbr->next; - xfree(cbr); + free(cbr); } - xfree(cbl); + free(cbl); *pcbl = NULL; } @@ -827,7 +827,7 @@ CreateCallbackList(CallbackListPtr *pcbl) int i; if (!pcbl) return FALSE; - cbl = xalloc(sizeof(CallbackListRec)); + cbl = malloc(sizeof(CallbackListRec)); if (!cbl) return FALSE; cbl->inCallback = 0; cbl->deleted = FALSE; @@ -895,7 +895,7 @@ InitCallbackManager(void) { DeleteCallbackList(listsToCleanup[i]); } - if (listsToCleanup) xfree(listsToCleanup); + if (listsToCleanup) free(listsToCleanup); numCallbackListsToCleanup = 0; listsToCleanup = NULL; diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 878dba576..4e3de0b46 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -254,7 +254,7 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count) num_events = (countValuators(ev, &first) + 5)/6; /* valuator ev */ num_events++; /* the actual event event */ - *xi = xcalloc(num_events, sizeof(xEvent)); + *xi = calloc(num_events, sizeof(xEvent)); if (!(*xi)) { return BadAlloc; @@ -462,7 +462,7 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi) len += sizeof(CARD32) * nkeys; /* keycodes */ } - dcce = xcalloc(1, len); + dcce = calloc(1, len); if (!dcce) { ErrorF("[Xi] BadAlloc in SendDeviceChangedEvent.\n"); @@ -545,7 +545,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi) vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS)); len += vallen * 4; /* valuators mask */ - *xi = xcalloc(1, len); + *xi = calloc(1, len); xde = (xXIDeviceEvent*)*xi; xde->type = GenericEvent; xde->extension = IReqCode; @@ -612,7 +612,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi) vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS)); len += vallen * 4; /* valuators mask */ - *xi = xcalloc(1, len); + *xi = calloc(1, len); raw = (xXIRawEvent*)*xi; raw->type = GenericEvent; raw->extension = IReqCode; diff --git a/dix/events.c b/dix/events.c index f96fe1ce4..3ed344d5f 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1159,7 +1159,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) eventlen = event->length; - qe = xalloc(sizeof(QdEventRec) + eventlen); + qe = malloc(sizeof(QdEventRec) + eventlen); if (!qe) return; qe->next = (QdEventPtr)NULL; @@ -1229,7 +1229,7 @@ PlayReleasedEvents(void) } #endif (*qe->device->public.processInputProc)(qe->event, qe->device); - xfree(qe); + free(qe); for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next) ; if (!dev) @@ -2435,7 +2435,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, FixUpEventFromWindow(dev, xi2, pWin, child, FALSE); deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1, filter, grab); - xfree(xi2); + free(xi2); if (deliveries > 0) goto unwind; } else if (rc != BadMatch) @@ -2492,7 +2492,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, } unwind: - xfree(xE); + free(xE); return deliveries; } @@ -2633,7 +2633,7 @@ XYToWindow(DeviceIntPtr pDev, int x, int y) if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) { pSprite->spriteTraceSize += 10; - pSprite->spriteTrace = xrealloc(pSprite->spriteTrace, + pSprite->spriteTrace = realloc(pSprite->spriteTrace, pSprite->spriteTraceSize*sizeof(WindowPtr)); } pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; @@ -2938,7 +2938,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) { DeviceIntPtr it; - pDev->spriteInfo->sprite = (SpritePtr)xcalloc(1, sizeof(SpriteRec)); + pDev->spriteInfo->sprite = (SpritePtr)calloc(1, sizeof(SpriteRec)); if (!pDev->spriteInfo->sprite) FatalError("InitializeSprite: failed to allocate sprite struct"); @@ -2977,7 +2977,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) if (pWin) { pCursor = wCursor(pWin); - pSprite->spriteTrace = (WindowPtr *)xcalloc(1, 32*sizeof(WindowPtr)); + pSprite->spriteTrace = (WindowPtr *)calloc(1, 32*sizeof(WindowPtr)); if (!pSprite->spriteTrace) FatalError("Failed to allocate spriteTrace"); pSprite->spriteTraceSize = 32; @@ -3638,13 +3638,13 @@ CheckPassiveGrabsOnWindow( if (grabinfo->sync.state == FROZEN_NO_EVENT) { if (!grabinfo->sync.event) - grabinfo->sync.event = xcalloc(1, sizeof(InternalEvent)); + grabinfo->sync.event = calloc(1, sizeof(InternalEvent)); *grabinfo->sync.event = *event; grabinfo->sync.state = FROZEN_WITH_EVENT; } if (match & (XI_MATCH | XI2_MATCH)) - xfree(xE); /* on core match xE == &core */ + free(xE); /* on core match xE == &core */ return TRUE; } } @@ -3813,9 +3813,9 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) unwind: if (xE) - xfree(xE); + free(xE); if (xi2) - xfree(xi2); + free(xi2); return; } @@ -3989,16 +3989,16 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, grabinfo->sync.state = FROZEN_WITH_EVENT; FreezeThaw(thisDev, TRUE); if (!grabinfo->sync.event) - grabinfo->sync.event = xcalloc(1, sizeof(InternalEvent)); + grabinfo->sync.event = calloc(1, sizeof(InternalEvent)); *grabinfo->sync.event = event->device_event; break; } } if (xi) - xfree(xi); + free(xi); if (xi2) - xfree(xi2); + free(xi2); } /* This function is used to set the key pressed or key released state - @@ -4104,7 +4104,7 @@ OtherClientGone(pointer value, XID id) if (!(pWin->optional->otherClients = other->next)) CheckWindowOptionalNeed (pWin); } - xfree(other); + free(other); RecalculateDeliverableEvents(pWin); return(Success); } @@ -4176,7 +4176,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) check = 0; if (!pWin->optional && !MakeWindowOptional (pWin)) return BadAlloc; - others = xalloc(sizeof(OtherClients)); + others = malloc(sizeof(OtherClients)); if (!others) return BadAlloc; others->mask = mask; @@ -4367,7 +4367,7 @@ DeviceEnterLeaveEvent( btlen = bytes_to_int32(btlen); len = sizeof(xXIEnterEvent) + btlen * 4; - event = xcalloc(1, len); + event = calloc(1, len); event->type = GenericEvent; event->extension = IReqCode; event->evtype = type; @@ -4417,7 +4417,7 @@ DeviceEnterLeaveEvent( } out: - xfree(event); + free(event); } void @@ -4548,7 +4548,7 @@ SetInputFocus( if (depth > focus->traceSize) { focus->traceSize = depth+1; - focus->trace = xrealloc(focus->trace, + focus->trace = realloc(focus->trace, focus->traceSize * sizeof(WindowPtr)); } focus->traceGood = depth; @@ -5058,7 +5058,7 @@ InitEvents(void) while (syncEvents.pending) { QdEventPtr next = syncEvents.pending->next; - xfree(syncEvents.pending); + free(syncEvents.pending); syncEvents.pending = next; } syncEvents.pendtail = &syncEvents.pending; @@ -5743,7 +5743,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) if (eventlength > swapEventLen) { swapEventLen = eventlength; - swapEvent = Xrealloc(swapEvent, swapEventLen); + swapEvent = realloc(swapEvent, swapEventLen); if (!swapEvent) { FatalError("WriteEventsToClient: Out of memory.\n"); diff --git a/dix/extension.c b/dix/extension.c index f34866586..6940b68b0 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -89,26 +89,26 @@ AddExtension(char *name, int NumEvents, int NumErrors, return((ExtensionEntry *) NULL); } - ext = xalloc(sizeof(ExtensionEntry)); + ext = malloc(sizeof(ExtensionEntry)); if (!ext) return(NULL); - ext->name = xalloc(strlen(name) + 1); + ext->name = malloc(strlen(name) + 1); ext->num_aliases = 0; ext->aliases = (char **)NULL; ext->devPrivates = NULL; if (!ext->name) { - xfree(ext); + free(ext); return((ExtensionEntry *) NULL); } strcpy(ext->name, name); i = NumExtensions; - newexts = (ExtensionEntry **) xrealloc(extensions, + newexts = (ExtensionEntry **) realloc(extensions, (i + 1) * sizeof(ExtensionEntry *)); if (!newexts) { - xfree(ext->name); - xfree(ext); + free(ext->name); + free(ext); return((ExtensionEntry *) NULL); } NumExtensions++; @@ -154,12 +154,12 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext) if (!ext) return FALSE ; - aliases = (char **)xrealloc(ext->aliases, + aliases = (char **)realloc(ext->aliases, (ext->num_aliases + 1) * sizeof(char *)); if (!aliases) return FALSE; ext->aliases = aliases; - name = xalloc(strlen(alias) + 1); + name = malloc(strlen(alias) + 1); if (!name) return FALSE; strcpy(name, alias); @@ -249,14 +249,14 @@ CloseDownExtensions(void) if (extensions[i]->CloseDown) extensions[i]->CloseDown(extensions[i]); NumExtensions = i; - xfree(extensions[i]->name); + free(extensions[i]->name); for (j = extensions[i]->num_aliases; --j >= 0;) - xfree(extensions[i]->aliases[j]); - xfree(extensions[i]->aliases); + free(extensions[i]->aliases[j]); + free(extensions[i]->aliases); dixFreePrivates(extensions[i]->devPrivates); - xfree(extensions[i]); + free(extensions[i]); } - xfree(extensions); + free(extensions); extensions = (ExtensionEntry **)NULL; lastEvent = EXTENSION_EVENT_BASE; lastError = FirstExtensionError; @@ -328,7 +328,7 @@ ProcListExtensions(ClientPtr client) total_length += strlen(extensions[i]->aliases[j]) + 1; } reply.length = bytes_to_int32(total_length); - buffer = bufptr = xalloc(total_length); + buffer = bufptr = malloc(total_length); if (!buffer) return(BadAlloc); for (i=0; i<NumExtensions; i++) @@ -352,7 +352,7 @@ ProcListExtensions(ClientPtr client) if (reply.length) { WriteToClient(client, total_length, buffer); - xfree(buffer); + free(buffer); } return(client->noClientException); } @@ -436,7 +436,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr { if (pGC->dash != DefaultDash) { - xfree(pGC->dash); + free(pGC->dash); pGC->numInDashList = 2; pGC->dash = DefaultDash; } @@ -445,11 +445,11 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr { unsigned char *dash; - dash = xalloc(2 * sizeof(unsigned char)); + dash = malloc(2 * sizeof(unsigned char)); if (dash) { if (pGC->dash != DefaultDash) - xfree(pGC->dash); + free(pGC->dash); pGC->numInDashList = 2; pGC->dash = dash; dash[0] = newdash; @@ -554,7 +554,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus, { GCPtr pGC; - pGC = xalloc(sizeof(GC)); + pGC = malloc(sizeof(GC)); if (!pGC) { *pStatus = BadAlloc; @@ -794,7 +794,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask) { if (pgcDst->dash != DefaultDash) { - xfree(pgcDst->dash); + free(pgcDst->dash); pgcDst->numInDashList = pgcSrc->numInDashList; pgcDst->dash = pgcSrc->dash; } @@ -804,11 +804,11 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask) unsigned char *dash; unsigned int i; - dash = xalloc(pgcSrc->numInDashList * sizeof(unsigned char)); + dash = malloc(pgcSrc->numInDashList * sizeof(unsigned char)); if (dash) { if (pgcDst->dash != DefaultDash) - xfree(pgcDst->dash); + free(pgcDst->dash); pgcDst->numInDashList = pgcSrc->numInDashList; pgcDst->dash = dash; for (i=0; i<pgcSrc->numInDashList; i++) @@ -859,9 +859,9 @@ FreeGC(pointer value, XID gid) (*pGC->funcs->DestroyGC) (pGC); if (pGC->dash != DefaultDash) - xfree(pGC->dash); + free(pGC->dash); dixFreePrivates(pGC->devPrivates); - xfree(pGC); + free(pGC); return(Success); } @@ -883,7 +883,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth) { GCPtr pGC; - pGC = xalloc(sizeof(GC)); + pGC = malloc(sizeof(GC)); if (!pGC) return (GCPtr)NULL; @@ -1044,9 +1044,9 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) } if (ndash & 1) - p = xalloc(2 * ndash * sizeof(unsigned char)); + p = malloc(2 * ndash * sizeof(unsigned char)); else - p = xalloc(ndash * sizeof(unsigned char)); + p = malloc(ndash * sizeof(unsigned char)); if (!p) return BadAlloc; @@ -1059,7 +1059,7 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) } if (pGC->dash != DefaultDash) - xfree(pGC->dash); + free(pGC->dash); pGC->numInDashList = ndash; pGC->dash = p; if (ndash & 1) @@ -1141,7 +1141,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects, if (newct < 0) return(BadMatch); size = nrects * sizeof(xRectangle); - prectsNew = xalloc(size); + prectsNew = malloc(size); if (!prectsNew && size) return BadAlloc; diff --git a/dix/getevents.c b/dix/getevents.c index 197deb4fb..62aaff981 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -326,7 +326,7 @@ AllocateMotionHistory(DeviceIntPtr pDev) { int size; if (pDev->valuator->motion) - xfree(pDev->valuator->motion); + free(pDev->valuator->motion); if (pDev->valuator->numMotionEvents < 1) return; @@ -342,7 +342,7 @@ AllocateMotionHistory(DeviceIntPtr pDev) size += sizeof(Time); - pDev->valuator->motion = xcalloc(pDev->valuator->numMotionEvents, size); + pDev->valuator->motion = calloc(pDev->valuator->numMotionEvents, size); pDev->valuator->first_motion = 0; pDev->valuator->last_motion = 0; if (!pDev->valuator->motion) @@ -384,7 +384,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start, else size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time); - *buff = xalloc(size * pDev->valuator->numMotionEvents); + *buff = malloc(size * pDev->valuator->numMotionEvents); if (!(*buff)) return 0; obuff = (char *)*buff; @@ -959,20 +959,20 @@ InitEventList(int num_events) EventListPtr events; int i; - events = (EventListPtr)xcalloc(num_events, sizeof(EventList)); + events = (EventListPtr)calloc(num_events, sizeof(EventList)); if (!events) return NULL; for (i = 0; i < num_events; i++) { events[i].evlen = sizeof(InternalEvent); - events[i].event = xcalloc(1, sizeof(InternalEvent)); + events[i].event = calloc(1, sizeof(InternalEvent)); if (!events[i].event) { /* rollback */ while(i--) - xfree(events[i].event); - xfree(events); + free(events[i].event); + free(events); events = NULL; break; } @@ -993,8 +993,8 @@ FreeEventList(EventListPtr list, int num_events) if (!list) return; while(num_events--) - xfree(list[num_events].event); - xfree(list); + free(list[num_events].event); + free(list); } /** diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c index f74b13730..f10400f7b 100644 --- a/dix/glyphcurs.c +++ b/dix/glyphcurs.c @@ -91,7 +91,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha pScreen = screenInfo.screens[0]; nby = BitmapBytePad(cm->width) * (long)cm->height; - pbits = xcalloc(1, nby); + pbits = calloc(1, nby); if (!pbits) return BadAlloc; @@ -105,7 +105,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha (*pScreen->DestroyPixmap)(ppix); if (pGC) FreeScratchGC(pGC); - xfree(pbits); + free(pbits); return BadAlloc; } diff --git a/dix/grabs.c b/dix/grabs.c index 4a351d647..2931631c0 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -84,7 +84,7 @@ CreateGrab( { GrabPtr grab; - grab = xcalloc(1, sizeof(GrabRec)); + grab = calloc(1, sizeof(GrabRec)); if (!grab) return (GrabPtr)NULL; grab->resource = FakeClientID(client); @@ -118,15 +118,15 @@ static void FreeGrab(GrabPtr pGrab) { if (pGrab->modifiersDetail.pMask != NULL) - xfree(pGrab->modifiersDetail.pMask); + free(pGrab->modifiersDetail.pMask); if (pGrab->detail.pMask != NULL) - xfree(pGrab->detail.pMask); + free(pGrab->detail.pMask); if (pGrab->cursor) FreeCursor(pGrab->cursor, (Cursor)0); - xfree(pGrab); + free(pGrab); } int @@ -160,7 +160,7 @@ DeleteDetailFromMask(Mask *pDetailMask, unsigned int detail) Mask *mask; int i; - mask = xalloc(sizeof(Mask) * MasksPerDetailMask); + mask = malloc(sizeof(Mask) * MasksPerDetailMask); if (mask) { if (pDetailMask) @@ -435,16 +435,16 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) i++; if (!i) return TRUE; - deletes = xalloc(i * sizeof(GrabPtr)); - adds = xalloc(i * sizeof(GrabPtr)); - updates = xalloc(i * sizeof(Mask **)); - details = xalloc(i * sizeof(Mask *)); + deletes = malloc(i * sizeof(GrabPtr)); + adds = malloc(i * sizeof(GrabPtr)); + updates = malloc(i * sizeof(Mask **)); + details = malloc(i * sizeof(Mask *)); if (!deletes || !adds || !updates || !details) { - if (details) xfree(details); - if (updates) xfree(updates); - if (adds) xfree(adds); - if (deletes) xfree(deletes); + if (details) free(details); + if (updates) free(updates); + if (adds) free(adds); + if (deletes) free(deletes); return FALSE; } @@ -532,7 +532,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) for (i = 0; i < nadds; i++) FreeResource(adds[i]->resource, RT_NONE); for (i = 0; i < nups; i++) - xfree(details[i]); + free(details[i]); } else { @@ -546,14 +546,14 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) } for (i = 0; i < nups; i++) { - xfree(*updates[i]); + free(*updates[i]); *updates[i] = details[i]; } } - xfree(details); - xfree(updates); - xfree(adds); - xfree(deletes); + free(details); + free(updates); + free(adds); + free(deletes); return ok; #undef UPDATE diff --git a/dix/inpututils.c b/dix/inpututils.c index 4848c1bc2..e3b44fc08 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -311,7 +311,7 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, } } - modkeymap = xcalloc(max_keys_per_mod * 8, sizeof(KeyCode)); + modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode)); if (!modkeymap) return BadAlloc; diff --git a/dix/main.c b/dix/main.c index 2cff59c8e..3e500ba4d 100644 --- a/dix/main.c +++ b/dix/main.c @@ -174,7 +174,7 @@ int main(int argc, char *argv[], char *envp[]) InitProcVectors(); for (i=1; i<MAXCLIENTS; i++) clients[i] = NullClient; - serverClient = xalloc(sizeof(ClientRec)); + serverClient = malloc(sizeof(ClientRec)); if (!serverClient) FatalError("couldn't create server client"); InitClient(serverClient, 0, (pointer)NULL); @@ -314,7 +314,7 @@ int main(int argc, char *argv[], char *envp[]) FreeDefaultStipple(i); (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]); dixFreePrivates(screenInfo.screens[i]->devPrivates); - xfree(screenInfo.screens[i]); + free(screenInfo.screens[i]); screenInfo.numScreens = i; } FreeFonts(); @@ -337,7 +337,7 @@ int main(int argc, char *argv[], char *envp[]) break; } - xfree(ConnectionInfo); + free(ConnectionInfo); ConnectionInfo = NULL; } return(0); diff --git a/dix/pixmap.c b/dix/pixmap.c index 10ec02a78..a4ad2557b 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 = xalloc(pScreen->totalPixmapSize + pixDataSize); + pPixmap = malloc(pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; diff --git a/dix/privates.c b/dix/privates.c index e3e727462..27694cbeb 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -115,7 +115,7 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) /* initialize privates array if necessary */ if (!*privates) { - ptr = xcalloc(newsize, sizeof(*ptr)); + ptr = calloc(newsize, sizeof(*ptr)); if (!ptr) return NULL; *privates = ptr; @@ -126,7 +126,7 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) /* resize privates array if necessary */ if (*key >= oldsize) { - ptr = xrealloc(*privates, newsize * sizeof(*ptr)); + ptr = realloc(*privates, newsize * sizeof(*ptr)); if (!ptr) return NULL; memset(ptr + oldsize, 0, (newsize - oldsize) * sizeof(*ptr)); @@ -138,7 +138,7 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) ptr = *privates + *key; ptr->state = 1; if (item->size) { - value = xcalloc(item->size, 1); + value = calloc(item->size, 1); if (!value) return NULL; ptr->value = value; @@ -214,10 +214,10 @@ dixFreePrivates(PrivateRec *privates) /* free pre-allocated memory */ if (items[i].size) - xfree(privates[i].value); + free(privates[i].value); } - xfree(privates); + free(privates); } /* @@ -273,7 +273,7 @@ dixRegisterPrivateOffset(RESTYPE type, int offset) /* resize offsets table if necessary */ while (type >= offsetsSize) { unsigned i = offsetsSize * 2 * sizeof(int); - offsets = (int *)xrealloc(offsets, i); + offsets = (int *)realloc(offsets, i); if (!offsets) { offsetsSize = 0; return FALSE; @@ -311,9 +311,9 @@ dixResetPrivates(void) /* reset offsets */ if (offsets) - xfree(offsets); + free(offsets); offsetsSize = sizeof(offsetDefaults); - offsets = xalloc(offsetsSize); + offsets = malloc(offsetsSize); offsetsSize /= sizeof(int); if (!offsets) return FALSE; diff --git a/dix/property.c b/dix/property.c index 9ec5dc6ae..74d3d7826 100644 --- a/dix/property.c +++ b/dix/property.c @@ -137,8 +137,8 @@ ProcRotateProperties(ClientPtr client) return rc; atoms = (Atom *) & stuff[1]; - props = xalloc(stuff->nAtoms * sizeof(PropertyPtr)); - saved = xalloc(stuff->nAtoms * sizeof(PropertyRec)); + props = malloc(stuff->nAtoms * sizeof(PropertyPtr)); + saved = malloc(stuff->nAtoms * sizeof(PropertyRec)); if (!props || !saved) { rc = BadAlloc; goto out; @@ -188,8 +188,8 @@ ProcRotateProperties(ClientPtr client) } } out: - xfree(saved); - xfree(props); + free(saved); + free(props); return rc; } @@ -269,13 +269,13 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, { if (!pWin->optional && !MakeWindowOptional (pWin)) return(BadAlloc); - pProp = xalloc(sizeof(PropertyRec)); + pProp = malloc(sizeof(PropertyRec)); if (!pProp) return(BadAlloc); - data = xalloc(totalSize); + data = malloc(totalSize); if (!data && len) { - xfree(pProp); + free(pProp); return(BadAlloc); } memcpy(data, value, totalSize); @@ -288,8 +288,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, rc = XaceHookPropertyAccess(pClient, pWin, &pProp, DixCreateAccess|DixWriteAccess); if (rc != Success) { - xfree(data); - xfree(pProp); + free(data); + free(pProp); pClient->errorValue = property; return rc; } @@ -313,7 +313,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, if (mode == PropModeReplace) { - data = xalloc(totalSize); + data = malloc(totalSize); if (!data && len) return(BadAlloc); memcpy(data, value, totalSize); @@ -328,7 +328,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, } else if (mode == PropModeAppend) { - data = xalloc((pProp->size + len) * sizeInBytes); + data = malloc((pProp->size + len) * sizeInBytes); if (!data) return(BadAlloc); memcpy(data, pProp->data, pProp->size * sizeInBytes); @@ -338,7 +338,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, } else if (mode == PropModePrepend) { - data = xalloc(sizeInBytes * (len + pProp->size)); + data = malloc(sizeInBytes * (len + pProp->size)); if (!data) return(BadAlloc); memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes); @@ -353,12 +353,12 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, if (rc == Success) { if (savedProp.data != pProp->data) - xfree(savedProp.data); + free(savedProp.data); } else { if (savedProp.data != pProp->data) - xfree(pProp->data); + free(pProp->data); *pProp = savedProp; return rc; } @@ -406,8 +406,8 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName) deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); dixFreePrivates(pProp->devPrivates); - xfree(pProp->data); - xfree(pProp); + free(pProp->data); + free(pProp); } return rc; } @@ -423,8 +423,8 @@ DeleteAllWindowProperties(WindowPtr pWin) deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); pNextProp = pProp->next; dixFreePrivates(pProp->devPrivates); - xfree(pProp->data); - xfree(pProp); + free(pProp->data); + free(pProp); pProp = pNextProp; } } @@ -571,8 +571,8 @@ ProcGetProperty(ClientPtr client) } dixFreePrivates(pProp->devPrivates); - xfree(pProp->data); - xfree(pProp); + free(pProp->data); + free(pProp); } return(client->noClientException); } @@ -595,7 +595,7 @@ ProcListProperties(ClientPtr client) for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) numProps++; - if (numProps && !(pAtoms = xalloc(numProps * sizeof(Atom)))) + if (numProps && !(pAtoms = malloc(numProps * sizeof(Atom)))) return BadAlloc; numProps = 0; @@ -619,7 +619,7 @@ ProcListProperties(ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); } - xfree(pAtoms); + free(pAtoms); return(client->noClientException); } diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index 100d6f8be..cedc829d0 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -111,7 +111,7 @@ InitVelocityData(DeviceVelocityPtr vel) */ void FreeVelocityData(DeviceVelocityPtr vel){ - xfree(vel->tracker); + free(vel->tracker); SetAccelerationProfile(vel, PROFILE_UNINITIALIZE); } @@ -127,7 +127,7 @@ AccelerationDefaultCleanup(DeviceIntPtr dev) && dev->valuator->accelScheme.accelData != NULL){ dev->valuator->accelScheme.AccelSchemeProc = NULL; FreeVelocityData(dev->valuator->accelScheme.accelData); - xfree(dev->valuator->accelScheme.accelData); + free(dev->valuator->accelScheme.accelData); dev->valuator->accelScheme.accelData = NULL; DeletePredictableAccelerationProperties(dev); } @@ -372,8 +372,8 @@ InitTrackers(DeviceVelocityPtr vel, int ntracker) ErrorF("(dix ptracc) invalid number of trackers\n"); return; } - xfree(vel->tracker); - vel->tracker = (MotionTrackerPtr)xalloc(ntracker * sizeof(MotionTracker)); + free(vel->tracker); + vel->tracker = (MotionTrackerPtr)malloc(ntracker * sizeof(MotionTracker)); memset(vel->tracker, 0, ntracker * sizeof(MotionTracker)); vel->num_tracker = ntracker; } @@ -954,7 +954,7 @@ SetAccelerationProfile( if(vel->profile_private != NULL){ /* Here one could free old profile-private data */ - xfree(vel->profile_private); + free(vel->profile_private); vel->profile_private = NULL; } /* Here one could init profile-private data */ diff --git a/dix/registry.c b/dix/registry.c index 1381a3dcd..fc35dbbc7 100644 --- a/dix/registry.c +++ b/dix/registry.c @@ -61,7 +61,7 @@ static int double_size(void *p, unsigned n, unsigned size) n = f = BASE_SIZE * size; } - *ptr = xrealloc(*ptr, n); + *ptr = realloc(*ptr, n); if (!*ptr) { dixResetRegistry(); return FALSE; @@ -285,20 +285,20 @@ dixResetRegistry(void) while (nmajor--) { while (nminor[nmajor]) free(requests[nmajor][--nminor[nmajor]]); - xfree(requests[nmajor]); + free(requests[nmajor]); } - xfree(requests); - xfree(nminor); + free(requests); + free(nminor); while (nevent--) free(events[nevent]); - xfree(events); + free(events); while (nerror--) free(errors[nerror]); - xfree(errors); + free(errors); - xfree(resources); + free(resources); requests = NULL; nminor = NULL; diff --git a/dix/resource.c b/dix/resource.c index ab3762eb5..143b51a77 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -204,7 +204,7 @@ CreateNewResourceType(DeleteType deleteFunc, char *name) if (next & lastResourceClass) return 0; - funcs = (DeleteType *)xrealloc(DeleteFuncs, + funcs = (DeleteType *)realloc(DeleteFuncs, (next + 1) * sizeof(DeleteType)); if (!funcs) return 0; @@ -252,8 +252,8 @@ InitClientResources(ClientPtr client) lastResourceClass = RC_LASTPREDEF; TypeMask = RC_LASTPREDEF - 1; if (DeleteFuncs) - xfree(DeleteFuncs); - DeleteFuncs = xalloc((lastResourceType + 1) * sizeof(DeleteType)); + free(DeleteFuncs); + DeleteFuncs = malloc((lastResourceType + 1) * sizeof(DeleteType)); if (!DeleteFuncs) return FALSE; DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA; @@ -268,7 +268,7 @@ InitClientResources(ClientPtr client) DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; } clientTable[i = client->index].resources = - xalloc(INITBUCKETS*sizeof(ResourcePtr)); + malloc(INITBUCKETS*sizeof(ResourcePtr)); if (!clientTable[i].resources) return FALSE; clientTable[i].buckets = INITBUCKETS; @@ -459,7 +459,7 @@ AddResource(XID id, RESTYPE type, pointer value) (rrec->hashsize < MAXHASHSIZE)) RebuildTable(client); head = &rrec->resources[Hash(client, id)]; - res = xalloc(sizeof(ResourceRec)); + res = malloc(sizeof(ResourceRec)); if (!res) { (*DeleteFuncs[type & TypeMask])(value, id); @@ -491,13 +491,13 @@ RebuildTable(int client) */ j = 2 * clientTable[client].buckets; - tails = xalloc(j * sizeof(ResourcePtr *)); + tails = malloc(j * sizeof(ResourcePtr *)); if (!tails) return; - resources = xalloc(j * sizeof(ResourcePtr)); + resources = malloc(j * sizeof(ResourcePtr)); if (!resources) { - xfree(tails); + free(tails); return; } for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) @@ -520,9 +520,9 @@ RebuildTable(int client) *tptr = &res->next; } } - xfree(tails); + free(tails); clientTable[client].buckets *= 2; - xfree(clientTable[client].resources); + free(clientTable[client].resources); clientTable[client].resources = resources; } @@ -558,7 +558,7 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); - xfree(res); + free(res); if (*eltptr != elements) prev = head; /* prev may no longer be valid */ } @@ -595,7 +595,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); - xfree(res); + free(res); break; } else @@ -762,7 +762,7 @@ FreeClientNeverRetainResources(ClientPtr client) elements = *eltptr; (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); - xfree(this); + free(this); if (*eltptr != elements) prev = &resources[j]; /* prev may no longer be valid */ } @@ -816,10 +816,10 @@ FreeClientResources(ClientPtr client) CallResourceStateCallback(ResourceStateFreeing, this); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); - xfree(this); + free(this); } } - xfree(clientTable[client->index].resources); + free(clientTable[client->index].resources); clientTable[client->index].resources = NULL; clientTable[client->index].buckets = 0; } diff --git a/dix/selection.c b/dix/selection.c index d72f381ca..6a13572fb 100644 --- a/dix/selection.c +++ b/dix/selection.c @@ -95,7 +95,7 @@ InitSelections(void) while (pSel) { pNextSel = pSel->next; dixFreePrivates(pSel->devPrivates); - xfree(pSel); + free(pSel); pSel = pNextSel; } @@ -198,7 +198,7 @@ ProcSetSelectionOwner(ClientPtr client) /* * It doesn't exist, so add it... */ - pSel = xalloc(sizeof(Selection)); + pSel = malloc(sizeof(Selection)); if (!pSel) return BadAlloc; @@ -209,7 +209,7 @@ ProcSetSelectionOwner(ClientPtr client) rc = XaceHookSelectionAccess(client, &pSel, DixCreateAccess|DixSetAttrAccess); if (rc != Success) { - xfree(pSel); + free(pSel); return rc; } diff --git a/dix/swaprep.c b/dix/swaprep.c index 12c6dbd26..c173411ab 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 = xalloc(bufsize))) + while (!(pbufT = malloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) @@ -131,7 +131,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) } if (pbufT != tmpbuf) - xfree (pbufT); + free(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 = xalloc(bufsize))) + while (!(pbufT = malloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) @@ -179,7 +179,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) } if (pbufT != tmpbuf) - xfree (pbufT); + free(pbufT); } @@ -1262,7 +1262,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) { char *pInfoTBase; - pInfoTBase = xalloc(size); + pInfoTBase = malloc(size); if (!pInfoTBase) { pClient->noClientException = -1; @@ -1270,7 +1270,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) } SwapConnSetupInfo(pInfo, pInfoTBase); (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase); - xfree(pInfoTBase); + free(pInfoTBase); } void diff --git a/dix/window.c b/dix/window.c index 02451fc7e..0d0321992 100644 --- a/dix/window.c +++ b/dix/window.c @@ -359,7 +359,7 @@ CreateRootWindow(ScreenPtr pScreen) BoxRec box; PixmapFormatRec *format; - pWin = xalloc(sizeof(WindowRec)); + pWin = malloc(sizeof(WindowRec)); if (!pWin) return FALSE; @@ -386,7 +386,7 @@ CreateRootWindow(ScreenPtr pScreen) pWin->parent = NullWindow; SetWindowToDefaults(pWin); - pWin->optional = xalloc (sizeof (WindowOptRec)); + pWin->optional = malloc(sizeof (WindowOptRec)); if (!pWin->optional) return FALSE; @@ -639,7 +639,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, return NullWindow; } - pWin = xalloc(sizeof(WindowRec)); + pWin = malloc(sizeof(WindowRec)); if (!pWin) { *error = BadAlloc; @@ -670,7 +670,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, { if (!MakeWindowOptional (pWin)) { - xfree (pWin); + free(pWin); *error = BadAlloc; return NullWindow; } @@ -685,7 +685,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin, RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess); if (*error != Success) { - xfree(pWin); + free(pWin); return NullWindow; } @@ -809,12 +809,12 @@ DisposeWindowOptional (WindowPtr pWin) FreeCursor(pList->cursor, (XID)0); pPrev = pList; pList = pList->next; - xfree(pPrev); + free(pPrev); } pWin->optional->deviceCursors = NULL; } - xfree (pWin->optional); + free(pWin->optional); pWin->optional = NULL; } @@ -884,7 +884,7 @@ CrushTree(WindowPtr pWin) } FreeWindowResources(pChild); dixFreePrivates(pChild->devPrivates); - xfree(pChild); + free(pChild); if ( (pChild = pSib) ) break; pChild = pParent; @@ -934,9 +934,9 @@ DeleteWindow(pointer value, XID wid) if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; } - xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey)); + free(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey)); dixFreePrivates(pWin->devPrivates); - xfree(pWin); + free(pWin); return Success; } @@ -2996,7 +2996,7 @@ HandleSaveSet(ClientPtr client) MapWindow(pWin, client); } } - xfree(client->saveSet); + free(client->saveSet); client->numSaved = 0; client->saveSet = (SaveSetElt *)NULL; } @@ -3298,12 +3298,12 @@ TileScreenSaver(int i, int kind) cm.height=16; cm.xhot=8; cm.yhot=8; - srcbits = xalloc( BitmapBytePad(32)*16); - mskbits = xalloc( BitmapBytePad(32)*16); + srcbits = malloc( BitmapBytePad(32)*16); + mskbits = malloc( BitmapBytePad(32)*16); if (!srcbits || !mskbits) { - xfree(srcbits); - xfree(mskbits); + free(srcbits); + free(mskbits); cursor = 0; } else @@ -3325,8 +3325,8 @@ TileScreenSaver(int i, int kind) } else { - xfree (srcbits); - xfree (mskbits); + free(srcbits); + free(mskbits); } } @@ -3456,7 +3456,7 @@ MakeWindowOptional (WindowPtr pWin) if (pWin->optional) return TRUE; - optional = xalloc (sizeof (WindowOptRec)); + optional = malloc(sizeof (WindowOptRec)); if (!optional) return FALSE; optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate]; @@ -3547,7 +3547,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin, /* first item in list */ pWin->optional->deviceCursors = pNode->next; - xfree(pNode); + free(pNode); goto out; } @@ -3559,7 +3559,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin, if (!pCursor) return Success; - pNewNode = xalloc(sizeof(DevCursNodeRec)); + pNewNode = malloc(sizeof(DevCursNodeRec)); pNewNode->dev = pDev; pNewNode->next = pWin->optional->deviceCursors; pWin->optional->deviceCursors = pNewNode; |