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>
This commit is contained in:
Mikhail Gusarov 2010-05-06 01:44:06 +07:00
parent 96c7ab27c3
commit 3f3ff971ec
345 changed files with 3011 additions and 3011 deletions

View File

@ -158,7 +158,7 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
if (pScreen->myNum == 0)
REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
xfree ((pointer) pScreenPriv);
free((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (i, pScreen);
}
@ -328,7 +328,7 @@ XineramaDestroyClip(GCPtr pGC)
int
XineramaDeleteResource(pointer data, XID id)
{
xfree(data);
free(data);
return 1;
}
@ -376,7 +376,7 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void))
{
XineramaConnectionCallbackList *newlist;
if(!(newlist = xalloc(sizeof(XineramaConnectionCallbackList))))
if(!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
return FALSE;
newlist->next = ConnectionCallbackList;
@ -474,7 +474,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
*/
panoramiXdataPtr = (PanoramiXData *)
xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
calloc(PanoramiXNumScreens, sizeof(PanoramiXData));
if (!panoramiXdataPtr)
break;
@ -486,7 +486,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
for (i = 0; i < PanoramiXNumScreens; i++) {
pScreen = screenInfo.screens[i];
pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
pScreenPriv);
if(!pScreenPriv) {
@ -675,8 +675,8 @@ Bool PanoramiXCreateConnectionBlock(void)
connSetupPrefix.length = bytes_to_int32(length);
for (i = 0; i < PanoramiXNumDepths; i++)
xfree(PanoramiXDepths[i].vids);
xfree(PanoramiXDepths);
free(PanoramiXDepths[i].vids);
free(PanoramiXDepths);
PanoramiXDepths = NULL;
/*
@ -699,7 +699,7 @@ Bool PanoramiXCreateConnectionBlock(void)
tmp = (pointer)ConnectionCallbackList;
(*ConnectionCallbackList->func)();
ConnectionCallbackList = ConnectionCallbackList->next;
xfree(tmp);
free(tmp);
}
return TRUE;
@ -750,13 +750,13 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
j = PanoramiXNumDepths;
PanoramiXNumDepths++;
PanoramiXDepths = xrealloc(PanoramiXDepths,
PanoramiXDepths = realloc(PanoramiXDepths,
PanoramiXNumDepths * sizeof(DepthRec));
PanoramiXDepths[j].depth = pDepth->depth;
PanoramiXDepths[j].numVids = 0;
/* XXX suboptimal, should grow these dynamically */
if(pDepth->numVids)
PanoramiXDepths[j].vids = xalloc(sizeof(VisualID) * pDepth->numVids);
PanoramiXDepths[j].vids = malloc(sizeof(VisualID) * pDepth->numVids);
else
PanoramiXDepths[j].vids = NULL;
}
@ -792,7 +792,7 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
/* found a matching visual on all screens, add it to the subset list */
j = PanoramiXNumVisuals;
PanoramiXNumVisuals++;
PanoramiXVisuals = xrealloc(PanoramiXVisuals,
PanoramiXVisuals = realloc(PanoramiXVisuals,
PanoramiXNumVisuals * sizeof(VisualRec));
memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
@ -824,11 +824,11 @@ PanoramiXConsolidate(void)
for (i = 0; i < pScreen->numVisuals; i++)
PanoramiXMaybeAddVisual(pVisual++);
root = xalloc(sizeof(PanoramiXRes));
root = malloc(sizeof(PanoramiXRes));
root->type = XRT_WINDOW;
defmap = xalloc(sizeof(PanoramiXRes));
defmap = malloc(sizeof(PanoramiXRes));
defmap->type = XRT_COLORMAP;
saver = xalloc(sizeof(PanoramiXRes));
saver = malloc(sizeof(PanoramiXRes));
saver->type = XRT_WINDOW;
for (i = 0; i < PanoramiXNumScreens; i++) {
@ -893,7 +893,7 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
for (i = 256; i--; )
ProcVector[i] = SavedProcVector[i];
Xfree(panoramiXdataPtr);
free(panoramiXdataPtr);
}
@ -1202,7 +1202,7 @@ XineramaGetImageData(
if(sizeNeeded > size) {
char *tmpdata = ScratchMem;
ScratchMem = xrealloc(ScratchMem, sizeNeeded);
ScratchMem = realloc(ScratchMem, sizeNeeded);
if(ScratchMem)
size = sizeNeeded;
else {
@ -1277,7 +1277,7 @@ XineramaGetImageData(
}
if(ScratchMem)
xfree(ScratchMem);
free(ScratchMem);
REGION_UNINIT(pScreen, &SrcRegion);
REGION_UNINIT(pScreen, &GrabRegion);

View File

@ -120,7 +120,7 @@ int PanoramiXCreateWindow(ClientPtr client)
}
}
if(!(newWin = xalloc(sizeof(PanoramiXRes))))
if(!(newWin = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newWin->type = XRT_WINDOW;
@ -160,7 +160,7 @@ int PanoramiXCreateWindow(ClientPtr client)
if (result == Success)
AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
else
xfree(newWin);
free(newWin);
return (result);
}
@ -666,7 +666,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
if(!(newPix = xalloc(sizeof(PanoramiXRes))))
if(!(newPix = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@ -685,7 +685,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
if (result == Success)
AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
else
xfree(newPix);
free(newPix);
return (result);
}
@ -771,7 +771,7 @@ int PanoramiXCreateGC(ClientPtr client)
}
}
if(!(newGC = xalloc(sizeof(PanoramiXRes))))
if(!(newGC = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newGC->type = XRT_GC;
@ -795,7 +795,7 @@ int PanoramiXCreateGC(ClientPtr client)
if (result == Success)
AddResource(newGC->info[0].id, XRT_GC, newGC);
else
xfree(newGC);
free(newGC);
return (result);
}
@ -1064,7 +1064,7 @@ int PanoramiXCopyArea(ClientPtr client)
}
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
if(!(data = xcalloc(1, stuff->height * pitch)))
if(!(data = calloc(1, stuff->height * pitch)))
return BadAlloc;
XineramaGetImageData(drawables, srcx, srcy,
@ -1076,7 +1076,7 @@ int PanoramiXCopyArea(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, DixWriteAccess);
if(drawables[0]->depth != pDst->depth) {
client->errorValue = stuff->dstDrawable;
xfree(data);
free(data);
return (BadMatch);
}
@ -1087,7 +1087,7 @@ int PanoramiXCopyArea(ClientPtr client)
if(dstShared) break;
}
xfree(data);
free(data);
result = Success;
} else {
@ -1301,7 +1301,7 @@ int PanoramiXPolyPoint(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
if (npoint > 0) {
origPts = xalloc(npoint * sizeof(xPoint));
origPts = malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
@ -1328,7 +1328,7 @@ int PanoramiXPolyPoint(ClientPtr client)
result = (* SavedProcVector[X_PolyPoint])(client);
if(result != Success) break;
}
xfree(origPts);
free(origPts);
return (result);
} else
return (client->noClientException);
@ -1361,7 +1361,7 @@ int PanoramiXPolyLine(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
if (npoint > 0){
origPts = xalloc(npoint * sizeof(xPoint));
origPts = malloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
@ -1388,7 +1388,7 @@ int PanoramiXPolyLine(ClientPtr client)
result = (* SavedProcVector[X_PolyLine])(client);
if(result != Success) break;
}
xfree(origPts);
free(origPts);
return (result);
} else
return (client->noClientException);
@ -1424,7 +1424,7 @@ int PanoramiXPolySegment(ClientPtr client)
if(nsegs & 4) return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
origSegs = xalloc(nsegs * sizeof(xSegment));
origSegs = malloc(nsegs * sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j){
@ -1451,7 +1451,7 @@ int PanoramiXPolySegment(ClientPtr client)
result = (* SavedProcVector[X_PolySegment])(client);
if(result != Success) break;
}
xfree(origSegs);
free(origSegs);
return (result);
} else
return (client->noClientException);
@ -1487,7 +1487,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(nrects & 4) return BadLength;
nrects >>= 3;
if (nrects > 0){
origRecs = xalloc(nrects * sizeof(xRectangle));
origRecs = malloc(nrects * sizeof(xRectangle));
memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
@ -1513,7 +1513,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
result = (* SavedProcVector[X_PolyRectangle])(client);
if(result != Success) break;
}
xfree(origRecs);
free(origRecs);
return (result);
} else
return (client->noClientException);
@ -1549,7 +1549,7 @@ int PanoramiXPolyArc(ClientPtr client)
if(narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0){
origArcs = xalloc(narcs * sizeof(xArc));
origArcs = malloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
@ -1573,7 +1573,7 @@ int PanoramiXPolyArc(ClientPtr client)
result = (* SavedProcVector[X_PolyArc])(client);
if(result != Success) break;
}
xfree(origArcs);
free(origArcs);
return (result);
} else
return (client->noClientException);
@ -1607,7 +1607,7 @@ int PanoramiXFillPoly(ClientPtr client)
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
if (count > 0){
locPts = xalloc(count * sizeof(DDXPointRec));
locPts = malloc(count * sizeof(DDXPointRec));
memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j){
@ -1634,7 +1634,7 @@ int PanoramiXFillPoly(ClientPtr client)
result = (* SavedProcVector[X_FillPoly])(client);
if(result != Success) break;
}
xfree(locPts);
free(locPts);
return (result);
} else
return (client->noClientException);
@ -1670,7 +1670,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if(things & 4) return BadLength;
things >>= 3;
if (things > 0){
origRects = xalloc(things * sizeof(xRectangle));
origRects = malloc(things * sizeof(xRectangle));
memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
@ -1695,7 +1695,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
result = (* SavedProcVector[X_PolyFillRectangle])(client);
if(result != Success) break;
}
xfree(origRects);
free(origRects);
return (result);
} else
return (client->noClientException);
@ -1731,7 +1731,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
if (narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
origArcs = xalloc(narcs * sizeof(xArc));
origArcs = malloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
@ -1756,7 +1756,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
result = (* SavedProcVector[X_PolyFillArc])(client);
if(result != Success) break;
}
xfree(origArcs);
free(origArcs);
return (result);
} else
return (client->noClientException);
@ -1907,7 +1907,7 @@ int PanoramiXGetImage(ClientPtr client)
linesPerBuf = h;
}
length = linesPerBuf * widthBytesLine;
if(!(pBuf = xalloc(length)))
if(!(pBuf = malloc(length)))
return (BadAlloc);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
@ -1953,7 +1953,7 @@ int PanoramiXGetImage(ClientPtr client)
}
}
}
xfree(pBuf);
free(pBuf);
return (client->noClientException);
}
@ -2141,7 +2141,7 @@ int PanoramiXCreateColormap(ClientPtr client)
if (result != Success)
return (result == BadValue) ? BadWindow : result;
if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
if(!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@ -2161,7 +2161,7 @@ int PanoramiXCreateColormap(ClientPtr client)
if (result == Success)
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
else
xfree(newCmap);
free(newCmap);
return (result);
}
@ -2212,7 +2212,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
if (result != Success)
return (result == BadValue) ? BadColor : result;
if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
if(!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@ -2230,7 +2230,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
if (result == Success)
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
else
xfree(newCmap);
free(newCmap);
return (result);
}

View File

@ -235,7 +235,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
#define New(t) (xalloc (sizeof (t)))
#define New(t) (malloc(sizeof (t)))
/****************
* ScreenSaverExtensionInit
@ -283,7 +283,7 @@ CheckScreenPrivate (ScreenPtr pScreen)
if (!pPriv->attr && !pPriv->events &&
!pPriv->hasWindow && pPriv->installedMap == None)
{
xfree (pPriv);
free(pPriv);
SetScreenPrivate (pScreen, NULL);
savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
}
@ -343,7 +343,7 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
{
FreeResource (pEv->resource, SaverEventType);
*pPrev = pEv->next;
xfree (pEv);
free(pEv);
CheckScreenPrivate (pScreen);
}
else
@ -387,8 +387,8 @@ static void
FreeScreenAttr (ScreenSaverAttrPtr pAttr)
{
FreeAttrs (pAttr);
xfree (pAttr->values);
xfree (pAttr);
free(pAttr->values);
free(pAttr);
}
static int
@ -407,7 +407,7 @@ ScreenSaverFreeEvents (pointer value, XID id)
if (!pEv)
return TRUE;
*pPrev = pEv->next;
xfree (pEv);
free(pEv);
CheckScreenPrivate (pScreen);
return TRUE;
}
@ -446,7 +446,7 @@ ScreenSaverFreeSuspend (pointer value, XID id)
if (this == data)
{
*prev = this->next;
xfree (this);
free(this);
break;
}
}
@ -644,14 +644,14 @@ CreateSaverWindow (ScreenPtr pScreen)
wantMap = wColormap (pWin);
if (wantMap == None)
return TRUE;
installedMaps = xalloc (pScreen->maxInstalledCmaps * sizeof (Colormap));
installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof (Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pScreen, installedMaps);
for (i = 0; i < numInstalled; i++)
if (installedMaps[i] == wantMap)
break;
xfree ((char *) installedMaps);
free((char *) installedMaps);
if (i < numInstalled)
return TRUE;
@ -982,7 +982,7 @@ ScreenSaverSetAttributes (ClientPtr client)
goto bail;
}
/* over allocate for override redirect */
values = xalloc ((len + 1) * sizeof (unsigned long));
values = malloc((len + 1) * sizeof (unsigned long));
if (!values)
{
ret = BadAlloc;
@ -1219,8 +1219,8 @@ PatchUp:
FreeAttrs (pAttr);
bail:
CheckScreenPrivate (pScreen);
if (pAttr) xfree (pAttr->values);
xfree (pAttr);
if (pAttr) free(pAttr->values);
free(pAttr);
return ret;
}
@ -1392,7 +1392,7 @@ ProcScreenSaverSuspend (ClientPtr client)
* to the record, so the screensaver will be reenabled and the record freed
* if the client disconnects without reenabling it first.
*/
this = xalloc (sizeof (ScreenSaverSuspensionRec));
this = malloc(sizeof (ScreenSaverSuspensionRec));
if (!this)
return BadAlloc;
@ -1404,7 +1404,7 @@ ProcScreenSaverSuspend (ClientPtr client)
if (!AddResource (this->clientResource, SuspendType, (pointer) this))
{
xfree (this);
free(this);
return BadAlloc;
}

View File

@ -222,7 +222,7 @@ SecurityDeleteAuthorization(
}
SecurityAudit("revoked authorization ID %d\n", pAuth->id);
xfree(pAuth);
free(pAuth);
return Success;
} /* SecurityDeleteAuthorization */
@ -247,7 +247,7 @@ SecurityDeleteAuthorizationEventClient(
prev->next = pEventClient->next;
else
pAuth->eventClients = pEventClient->next;
xfree(pEventClient);
free(pEventClient);
return(Success);
}
prev = pEventClient;
@ -409,7 +409,7 @@ SecurityEventSelectForAuthorization(
}
}
pEventClient = xalloc(sizeof(OtherClients));
pEventClient = malloc(sizeof(OtherClients));
if (!pEventClient)
return BadAlloc;
pEventClient->mask = mask;
@ -418,7 +418,7 @@ SecurityEventSelectForAuthorization(
if (!AddResource(pEventClient->resource, RTEventClient,
(pointer)pAuth))
{
xfree(pEventClient);
free(pEventClient);
return BadAlloc;
}
pAuth->eventClients = pEventClient;
@ -541,7 +541,7 @@ ProcSecurityGenerateAuthorization(
/* associate additional information with this auth ID */
pAuth = xalloc(sizeof(SecurityAuthorizationRec));
pAuth = malloc(sizeof(SecurityAuthorizationRec));
if (!pAuth)
{
err = BadAlloc;
@ -613,7 +613,7 @@ bailout:
if (removeAuth)
RemoveAuthorization(stuff->nbytesAuthProto, protoname,
authdata_len, pAuthdata);
if (pAuth) xfree(pAuth);
if (pAuth) free(pAuth);
return err;
} /* ProcSecurityGenerateAuthorization */

View File

@ -764,7 +764,7 @@ ShapeFreeClient (pointer data, XID id)
*pHead = pShapeEvent->next;
}
}
xfree ((pointer) pShapeEvent);
free((pointer) pShapeEvent);
return 1;
}
@ -778,9 +778,9 @@ ShapeFreeEvents (pointer data, XID id)
for (pCur = *pHead; pCur; pCur = pNext) {
pNext = pCur->next;
FreeResource (pCur->clientResource, ClientType);
xfree ((pointer) pCur);
free((pointer) pCur);
}
xfree ((pointer) pHead);
free((pointer) pHead);
return 1;
}
@ -817,7 +817,7 @@ ProcShapeSelectInput (ClientPtr client)
}
/* build the entry */
pNewShapeEvent = xalloc (sizeof (ShapeEventRec));
pNewShapeEvent = malloc(sizeof (ShapeEventRec));
if (!pNewShapeEvent)
return BadAlloc;
pNewShapeEvent->next = 0;
@ -839,7 +839,7 @@ ProcShapeSelectInput (ClientPtr client)
*/
if (!pHead)
{
pHead = xalloc (sizeof (ShapeEventPtr));
pHead = malloc(sizeof (ShapeEventPtr));
if (!pHead ||
!AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
{
@ -866,7 +866,7 @@ ProcShapeSelectInput (ClientPtr client)
pNewShapeEvent->next = pShapeEvent->next;
else
*pHead = pShapeEvent->next;
xfree (pShapeEvent);
free(pShapeEvent);
}
}
break;
@ -1030,7 +1030,7 @@ ProcShapeGetRectangles (ClientPtr client)
}
if (!region) {
nrects = 1;
rects = xalloc (sizeof (xRectangle));
rects = malloc(sizeof (xRectangle));
if (!rects)
return BadAlloc;
switch (stuff->kind) {
@ -1057,7 +1057,7 @@ ProcShapeGetRectangles (ClientPtr client)
BoxPtr box;
nrects = REGION_NUM_RECTS(region);
box = REGION_RECTS(region);
rects = xalloc (nrects * sizeof (xRectangle));
rects = malloc(nrects * sizeof (xRectangle));
if (!rects && nrects)
return BadAlloc;
for (i = 0; i < nrects; i++, box++) {
@ -1080,7 +1080,7 @@ ProcShapeGetRectangles (ClientPtr client)
}
WriteToClient (client, sizeof (rep), (char *) &rep);
WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
xfree (rects);
free(rects);
return client->noClientException;
}

View File

@ -226,7 +226,7 @@ ShmCloseScreen(int i, ScreenPtr pScreen)
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
xfree (screen_priv);
free(screen_priv);
return (*pScreen->CloseScreen) (i, pScreen);
}
@ -236,7 +236,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
if (!screen_priv)
{
screen_priv = xcalloc (1, sizeof (ShmScrPrivateRec));
screen_priv = calloc(1, sizeof (ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
@ -454,7 +454,7 @@ ProcShmAttach(ClientPtr client)
}
else
{
shmdesc = xalloc(sizeof(ShmDescRec));
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
shmdesc->addr = shmat(stuff->shmid, 0,
@ -462,7 +462,7 @@ ProcShmAttach(ClientPtr client)
if ((shmdesc->addr == ((char *)-1)) ||
SHMSTAT(stuff->shmid, &buf))
{
xfree(shmdesc);
free(shmdesc);
return BadAccess;
}
@ -472,7 +472,7 @@ ProcShmAttach(ClientPtr client)
if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
shmdt(shmdesc->addr);
xfree(shmdesc);
free(shmdesc);
return BadAccess;
}
@ -502,7 +502,7 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
;
*prev = shmdesc->next;
xfree(shmdesc);
free(shmdesc);
return Success;
}
@ -671,7 +671,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return(BadMatch);
}
drawables = xcalloc(PanoramiXNumScreens, sizeof(DrawablePtr));
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if(!drawables)
return(BadAlloc);
@ -681,7 +681,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
DixReadAccess);
if (rc != Success)
{
xfree(drawables);
free(drawables);
return rc;
}
}
@ -722,7 +722,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
}
}
xfree(drawables);
free(drawables);
if (client->swapped) {
int n;
@ -795,7 +795,7 @@ CreatePmap:
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
if(!(newPix = xalloc(sizeof(PanoramiXRes))))
if(!(newPix = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@ -836,7 +836,7 @@ CreatePmap:
(*pScreen->DestroyPixmap)(pMap);
FreeResource(newPix->info[j].id, RT_NONE);
}
xfree(newPix);
free(newPix);
} else
AddResource(stuff->pid, XRT_PIXMAP, newPix);

View File

@ -94,7 +94,7 @@ ClientSleepUntil (ClientPtr client,
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}
pRequest = xalloc (sizeof (SertafiedRec));
pRequest = malloc(sizeof (SertafiedRec));
if (!pRequest)
return FALSE;
pRequest->pClient = client;
@ -107,7 +107,7 @@ ClientSleepUntil (ClientPtr client,
SertafiedWakeupHandler,
(pointer) 0))
{
xfree (pRequest);
free(pRequest);
return FALSE;
}
BlockHandlerRegistered = TRUE;
@ -161,7 +161,7 @@ SertafiedDelete (pointer value, XID id)
}
if (pRequest->notifyFunc)
(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
xfree (pRequest);
free(pRequest);
return TRUE;
}

View File

@ -158,7 +158,7 @@ SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger)
else
pTrigger->pCounter->pTriglist = pCur->next;
xfree(pCur);
free(pCur);
break;
}
@ -186,7 +186,7 @@ SyncAddTriggerToCounter(SyncTrigger *pTrigger)
return Success;
}
if (!(pCur = xalloc(sizeof(SyncTriggerList))))
if (!(pCur = malloc(sizeof(SyncTriggerList))))
return BadAlloc;
pCur->pTrigger = pTrigger;
@ -417,7 +417,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
if (client->clientGone)
return;
pev = pEvents = xalloc(num_events * sizeof(xSyncCounterNotifyEvent));
pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
if (!pEvents)
return;
UpdateCurrentTime();
@ -438,7 +438,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
}
/* swapping will be taken care of by this */
WriteEventsToClient(client, num_events, (xEvent *)pEvents);
xfree(pEvents);
free(pEvents);
}
@ -545,7 +545,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger)
pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
numwaits = pAwaitUnion->header.num_waitconditions;
ppAwait = xalloc(numwaits * sizeof(SyncAwait *));
ppAwait = malloc(numwaits * sizeof(SyncAwait *));
if (!ppAwait)
goto bail;
@ -614,7 +614,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger)
if (num_events)
SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
num_events);
xfree(ppAwait);
free(ppAwait);
bail:
/* unblock the client */
@ -695,7 +695,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
/* add new client to pAlarm->pEventClients */
pClients = xalloc(sizeof(SyncAlarmClientList));
pClients = malloc(sizeof(SyncAlarmClientList));
if (!pClients)
return BadAlloc;
@ -706,7 +706,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
pClients->delete_id = FakeClientID(client->index);
if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm))
{
xfree(pClients);
free(pClients);
return BadAlloc;
}
@ -824,12 +824,12 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue)
{
SyncCounter *pCounter;
if (!(pCounter = xalloc(sizeof(SyncCounter))))
if (!(pCounter = malloc(sizeof(SyncCounter))))
return NULL;
if (!AddResource(id, RTCounter, (pointer) pCounter))
{
xfree(pCounter);
free(pCounter);
return NULL;
}
@ -863,7 +863,7 @@ SyncCreateSystemCounter(
{
SyncCounter *pCounter;
SysCounterList = xrealloc(SysCounterList,
SysCounterList = realloc(SysCounterList,
(SyncNumSystemCounters+1)*sizeof(SyncCounter *));
if (!SysCounterList)
return NULL;
@ -886,7 +886,7 @@ SyncCreateSystemCounter(
{
SysCounterInfo *psci;
psci = xalloc(sizeof(SysCounterInfo));
psci = malloc(sizeof(SysCounterInfo));
if (!psci)
{
FreeResource(pCounter->id, RT_NONE);
@ -1008,7 +1008,7 @@ FreeAlarm(void *addr, XID id)
SyncDeleteTriggerFromCounter(&pAlarm->trigger);
xfree(pAlarm);
free(pAlarm);
return Success;
}
@ -1029,13 +1029,13 @@ FreeCounter(void *env, XID id)
{
(*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
pnext = ptl->next;
xfree(ptl); /* destroy the trigger list as we go */
free(ptl); /* destroy the trigger list as we go */
}
if (IsSystemCounter(pCounter))
{
int i, found = 0;
xfree(pCounter->pSysCounterInfo);
free(pCounter->pSysCounterInfo);
/* find the counter in the list of system counters and remove it */
@ -1059,7 +1059,7 @@ FreeCounter(void *env, XID id)
}
SyncNumSystemCounters--;
}
xfree(pCounter);
free(pCounter);
return Success;
}
@ -1088,7 +1088,7 @@ FreeAwait(void *addr, XID id)
if (pCounter && !pCounter->beingDestroyed)
SyncDeleteTriggerFromCounter(&pAwait->trigger);
}
xfree(pAwaitUnion);
free(pAwaitUnion);
return Success;
}
@ -1109,7 +1109,7 @@ FreeAlarmClient(void *value, XID id)
pPrev->next = pCur->next;
else
pAlarm->pEventClients = pCur->next;
xfree(pCur);
free(pCur);
return Success;
}
}
@ -1174,7 +1174,7 @@ ProcSyncListSystemCounters(ClientPtr client)
if (len)
{
walklist = list = xalloc(len);
walklist = list = malloc(len);
if (!list)
return BadAlloc;
}
@ -1220,7 +1220,7 @@ ProcSyncListSystemCounters(ClientPtr client)
if (len)
{
WriteToClient(client, len, (char *) list);
xfree(list);
free(list);
}
return client->noClientException;
@ -1448,7 +1448,7 @@ ProcSyncAwait(ClientPtr client)
/* all the memory for the entire await list is allocated
* here in one chunk
*/
pAwaitUnion = xalloc((items+1) * sizeof(SyncAwaitUnion));
pAwaitUnion = malloc((items+1) * sizeof(SyncAwaitUnion));
if (!pAwaitUnion)
return BadAlloc;
@ -1457,7 +1457,7 @@ ProcSyncAwait(ClientPtr client)
pAwaitUnion->header.delete_id = FakeClientID(client->index);
if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion))
{
xfree(pAwaitUnion);
free(pAwaitUnion);
return BadAlloc;
}
@ -1595,7 +1595,7 @@ ProcSyncCreateAlarm(ClientPtr client)
if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
return BadLength;
if (!(pAlarm = xalloc(sizeof(SyncAlarm))))
if (!(pAlarm = malloc(sizeof(SyncAlarm))))
{
return BadAlloc;
}
@ -1612,7 +1612,7 @@ ProcSyncCreateAlarm(ClientPtr client)
status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger);
if (status != Success)
{
xfree(pAlarm);
free(pAlarm);
return status;
}
@ -1626,13 +1626,13 @@ ProcSyncCreateAlarm(ClientPtr client)
(CARD32 *)&stuff[1]);
if (status != Success)
{
xfree(pAlarm);
free(pAlarm);
return status;
}
if (!AddResource(stuff->id, RTAlarm, pAlarm))
{
xfree(pAlarm);
free(pAlarm);
return BadAlloc;
}
@ -2091,7 +2091,7 @@ SAlarmNotifyEvent(xSyncAlarmNotifyEvent *from, xSyncAlarmNotifyEvent *to)
static void
SyncResetProc(ExtensionEntry *extEntry)
{
xfree(SysCounterList);
free(SysCounterList);
SysCounterList = NULL;
RTCounter = 0;
}

View File

@ -274,7 +274,7 @@ XaceCensorImage(
/* convert region to list-of-rectangles for PolyFillRect */
pRects = xalloc(nRects * sizeof(xRectangle));
pRects = malloc(nRects * sizeof(xRectangle));
if (!pRects)
{
failed = TRUE;
@ -326,7 +326,7 @@ XaceCensorImage(
*/
bzero(pBuf, (int)(widthBytesLine * h));
}
if (pRects) xfree(pRects);
if (pRects) free(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix);
}

View File

@ -123,7 +123,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
pids = (XID *)Xalloc(stuff->count * sizeof(XID));
pids = (XID *)malloc(stuff->count * sizeof(XID));
if (!pids)
{
return BadAlloc;
@ -144,7 +144,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
}
Xfree(pids);
free(pids);
return(client->noClientException);
}

View File

@ -230,7 +230,7 @@ shmalloc(
if (size < 3500)
return (ShmDescPtr) NULL;
pDesc = xalloc(sizeof(ShmDescRec));
pDesc = malloc(sizeof(ShmDescRec));
if (!pDesc)
return (ShmDescPtr) NULL;
@ -239,7 +239,7 @@ shmalloc(
if (shmid == -1) {
ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
size, strerror(errno));
xfree(pDesc);
free(pDesc);
return (ShmDescPtr) NULL;
}
@ -247,7 +247,7 @@ shmalloc(
ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
size, strerror(errno));
shmctl(shmid, IPC_RMID, (void *) 0);
xfree(pDesc);
free(pDesc);
return (ShmDescPtr) NULL;
}
@ -276,7 +276,7 @@ shmdealloc(
if (pDesc->next) pDesc->next->prev = pDesc->prev;
*pDesc->prev = pDesc->next;
xfree(pDesc);
free(pDesc);
}
#endif
@ -464,7 +464,7 @@ ProcXF86BigfontQueryFont(
shmid = pDesc->shmid;
} else {
#endif
pCI = xalloc(nCharInfos * sizeof(xCharInfo));
pCI = malloc(nCharInfos * sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef HAS_SHM
@ -526,9 +526,9 @@ ProcXF86BigfontQueryFont(
if (hashModulus > nCharInfos+1)
hashModulus = nCharInfos+1;
tmp = xalloc((4*nCharInfos+1) * sizeof(CARD16));
tmp = malloc((4*nCharInfos+1) * sizeof(CARD16));
if (!tmp) {
if (!pDesc) xfree(pCI);
if (!pDesc) free(pCI);
return BadAlloc;
}
pIndex2UniqIndex = tmp;
@ -610,12 +610,12 @@ ProcXF86BigfontQueryFont(
? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0);
xXF86BigfontQueryFontReply* reply = xalloc(rlength);
xXF86BigfontQueryFontReply* reply = malloc(rlength);
char* p;
if (!reply) {
if (nCharInfos > 0) {
if (shmid == -1) xfree(pIndex2UniqIndex);
if (!pDesc) xfree(pCI);
if (shmid == -1) free(pIndex2UniqIndex);
if (!pDesc) free(pCI);
}
return BadAlloc;
}
@ -693,10 +693,10 @@ ProcXF86BigfontQueryFont(
}
}
WriteToClient(client, rlength, (char *)reply);
xfree(reply);
free(reply);
if (nCharInfos > 0) {
if (shmid == -1) xfree(pIndex2UniqIndex);
if (!pDesc) xfree(pCI);
if (shmid == -1) free(pIndex2UniqIndex);
if (!pDesc) free(pCI);
}
return (client->noClientException);
}

View File

@ -63,7 +63,7 @@ ProcXResQueryClients (ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = xalloc(currentMaxClients * sizeof(int));
current_clients = malloc(currentMaxClients * sizeof(int));
num_clients = 0;
for(i = 0; i < currentMaxClients; i++) {
@ -101,7 +101,7 @@ ProcXResQueryClients (ClientPtr client)
}
}
xfree(current_clients);
free(current_clients);
return (client->noClientException);
}
@ -132,7 +132,7 @@ ProcXResQueryClientResources (ClientPtr client)
return BadValue;
}
counts = xcalloc(lastResourceType + 1, sizeof(int));
counts = calloc(lastResourceType + 1, sizeof(int));
FindAllClientResources(clients[clientID], ResFindAllRes, counts);
@ -182,7 +182,7 @@ ProcXResQueryClientResources (ClientPtr client)
}
}
xfree(counts);
free(counts);
return (client->noClientException);
}

View File

@ -52,7 +52,7 @@ typedef struct {
static security_context_t
SELinuxCopyContext(char *ptr, unsigned len)
{
security_context_t copy = xalloc(len + 1);
security_context_t copy = malloc(len + 1);
if (!copy)
return NULL;
strncpy(copy, ptr, len);
@ -141,7 +141,7 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
rc = BadValue;
}
xfree(ctx);
free(ctx);
return rc;
}
@ -198,7 +198,7 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
rc = Success;
out:
xfree(ctx);
free(ctx);
return rc;
}
@ -334,7 +334,7 @@ SELinuxFreeItems(SELinuxListItemRec *items, int count)
freecon(items[k].octx);
freecon(items[k].dctx);
}
xfree(items);
free(items);
}
static int
@ -345,7 +345,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
SELinuxListItemsReply rep;
CARD32 *buf;
buf = xcalloc(size, sizeof(CARD32));
buf = calloc(size, sizeof(CARD32));
if (size && !buf) {
rc = BadAlloc;
goto out;
@ -391,7 +391,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
/* Free stuff and return */
rc = client->noClientException;
xfree(buf);
free(buf);
out:
SELinuxFreeItems(items, count);
return rc;
@ -417,7 +417,7 @@ ProcSELinuxListProperties(ClientPtr client)
count = 0;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
count++;
items = xcalloc(count, sizeof(SELinuxListItemRec));
items = calloc(count, sizeof(SELinuxListItemRec));
if (count && !items)
return BadAlloc;
@ -451,7 +451,7 @@ ProcSELinuxListSelections(ClientPtr client)
count = 0;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
count++;
items = xcalloc(count, sizeof(SELinuxListItemRec));
items = calloc(count, sizeof(SELinuxListItemRec));
if (count && !items)
return BadAlloc;

View File

@ -151,7 +151,7 @@ SELinuxLabelClient(ClientPtr client)
if (bytes <= 0)
goto finish;
subj->command = xalloc(bytes);
subj->command = malloc(bytes);
if (!subj->command)
goto finish;
@ -830,7 +830,7 @@ SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
PrivateCallbackRec *rec = calldata;
SELinuxSubjectRec *subj = *rec->value;
xfree(subj->command);
free(subj->command);
}
static void

View File

@ -62,7 +62,7 @@ SELinuxArraySet(SELinuxArrayRec *rec, unsigned key, void *val)
{
if (key >= rec->size) {
/* Need to increase size of array */
rec->array = xrealloc(rec->array, (key + 1) * sizeof(val));
rec->array = realloc(rec->array, (key + 1) * sizeof(val));
if (!rec->array)
return FALSE;
memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
@ -79,10 +79,10 @@ SELinuxArrayFree(SELinuxArrayRec *rec, int free_elements)
if (free_elements) {
unsigned i = rec->size;
while (i)
xfree(rec->array[--i]);
free(rec->array[--i]);
}
xfree(rec->array);
free(rec->array);
rec->size = 0;
rec->array = NULL;
}
@ -132,7 +132,7 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn)
rec = SELinuxArrayGet(&arr_atoms, atom);
if (!rec) {
rec = xcalloc(1, sizeof(SELinuxAtomRec));
rec = calloc(1, sizeof(SELinuxAtomRec));
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
return BadAlloc;
}

View File

@ -637,7 +637,7 @@ int AllocXTestDevice (ClientPtr client, char* name,
{
int retval;
int len = strlen(name);
char *xtestname = xcalloc(len + 7, 1 );
char *xtestname = calloc(len + 7, 1 );
char dummy = 1;
strncpy( xtestname, name, len);
@ -660,7 +660,7 @@ int AllocXTestDevice (ClientPtr client, char* name,
XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
}
xfree( xtestname );
free( xtestname );
return retval;
}

View File

@ -1157,7 +1157,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
num_planes = pImage->num_planes;
if(!(offsets = xalloc(num_planes << 3)))
if(!(offsets = malloc(num_planes << 3)))
return BadAlloc;
pitches = offsets + num_planes;
@ -1180,7 +1180,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
SwapLongs((CARD32*)offsets, planeLength);
WriteToClient(client, planeLength << 2, (char*)offsets);
xfree(offsets);
free(offsets);
return Success;
}
@ -1924,7 +1924,7 @@ void XineramifyXv(void)
/* now create a resource for each port */
for(j = 0; j < refAdapt->nPorts; j++) {
PanoramiXRes *port = xalloc(sizeof(PanoramiXRes));
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
if(!port)
break;

View File

@ -277,7 +277,7 @@ XvScreenInit(ScreenPtr pScreen)
/* ALLOCATE SCREEN PRIVATE RECORD */
pxvs = xalloc (sizeof (XvScreenRec));
pxvs = malloc(sizeof (XvScreenRec));
if (!pxvs)
{
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
@ -314,7 +314,7 @@ XvCloseScreen(
(* pxvs->ddCloseScreen)(ii, pScreen);
xfree(pxvs);
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
@ -509,7 +509,7 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id)
{
npn = cpn->next;
if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
xfree(cpn);
free(cpn);
cpn = npn;
}
return Success;
@ -928,12 +928,12 @@ XvdiSelectVideoNotify(
if (!pn)
{
if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = NULL;
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
{
xfree(tpn);
free(tpn);
return BadAlloc;
}
}
@ -966,7 +966,7 @@ XvdiSelectVideoNotify(
}
else
{
if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = pn->next;
pn->next = tpn;
@ -1024,7 +1024,7 @@ XvdiSelectPortNotify(
if (!tpn)
{
if (!(tpn = xalloc(sizeof(XvPortNotifyRec))))
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
return BadAlloc;
tpn->next = pPort->pNotify;
pPort->pNotify = tpn;

View File

@ -71,7 +71,7 @@ XvMCDestroyContextRes(pointer data, XID id)
if(!pContext->refcnt) {
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext);
xfree(pContext);
free(pContext);
}
return Success;
@ -85,7 +85,7 @@ XvMCDestroySurfaceRes(pointer data, XID id)
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface);
xfree(pSurface);
free(pSurface);
XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
@ -101,7 +101,7 @@ XvMCDestroySubpictureRes(pointer data, XID id)
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict);
xfree(pSubpict);
free(pSubpict);
XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
@ -226,7 +226,7 @@ ProcXvMCCreateContext(ClientPtr client)
(stuff->height > surface->max_height))
return BadValue;
if(!(pContext = xalloc(sizeof(XvMCContextRec)))) {
if(!(pContext = malloc(sizeof(XvMCContextRec)))) {
return BadAlloc;
}
@ -243,7 +243,7 @@ ProcXvMCCreateContext(ClientPtr client)
result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data);
if(result != Success) {
xfree(pContext);
free(pContext);
return result;
}
@ -260,7 +260,7 @@ ProcXvMCCreateContext(ClientPtr client)
AddResource(pContext->context_id, XvMCRTContext, pContext);
if(data)
xfree(data);
free(data);
return Success;
}
@ -303,7 +303,7 @@ ProcXvMCCreateSurface(ClientPtr client)
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
if(!(pSurface = xalloc(sizeof(XvMCSurfaceRec))))
if(!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
return BadAlloc;
pSurface->surface_id = stuff->surface_id;
@ -314,7 +314,7 @@ ProcXvMCCreateSurface(ClientPtr client)
pSurface, &dwords, &data);
if(result != Success) {
xfree(pSurface);
free(pSurface);
return result;
}
@ -328,7 +328,7 @@ ProcXvMCCreateSurface(ClientPtr client)
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
if(data)
xfree(data);
free(data);
pContext->refcnt++;
@ -404,7 +404,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
(stuff->height > surface->subpicture_max_height))
return BadValue;
if(!(pSubpicture = xalloc(sizeof(XvMCSubpictureRec))))
if(!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
return BadAlloc;
pSubpicture->subpicture_id = stuff->subpicture_id;
@ -423,7 +423,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
pSubpicture, &dwords, &data);
if(result != Success) {
xfree(pSubpicture);
free(pSubpicture);
return result;
}
@ -445,7 +445,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
if(data)
xfree(data);
free(data);
pContext->refcnt++;
@ -704,7 +704,7 @@ XvMCCloseScreen (int i, ScreenPtr pScreen)
pScreen->CloseScreen = pScreenPriv->CloseScreen;
xfree(pScreenPriv);
free(pScreenPriv);
return (*pScreen->CloseScreen)(i, pScreen);
}
@ -717,7 +717,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
XvMCScreenKey = &XvMCScreenKeyIndex;
if(!(pScreenPriv = xalloc(sizeof(XvMCScreenRec))))
if(!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
return BadAlloc;
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);

View File

@ -234,7 +234,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
if (!(*i))
{
*i = xcalloc(1, sizeof(IntegerFeedbackClassRec));
*i = calloc(1, sizeof(IntegerFeedbackClassRec));
if (!(*i))
{
ErrorF("[Xi] Cannot alloc memory for class copy.");
@ -269,7 +269,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
if (!(*s))
{
*s = xcalloc(1, sizeof(StringFeedbackClassRec));
*s = calloc(1, sizeof(StringFeedbackClassRec));
if (!(*s))
{
ErrorF("[Xi] Cannot alloc memory for class copy.");
@ -304,7 +304,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
if (!(*b))
{
*b = xcalloc(1, sizeof(BellFeedbackClassRec));
*b = calloc(1, sizeof(BellFeedbackClassRec));
if (!(*b))
{
ErrorF("[Xi] Cannot alloc memory for class copy.");
@ -340,7 +340,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
if (!(*l))
{
*l = xcalloc(1, sizeof(LedFeedbackClassRec));
*l = calloc(1, sizeof(LedFeedbackClassRec));
if (!(*l))
{
ErrorF("[Xi] Cannot alloc memory for class copy.");
@ -390,7 +390,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
{
if (!(*k))
{
*k = xcalloc(1, sizeof(KbdFeedbackClassRec));
*k = calloc(1, sizeof(KbdFeedbackClassRec));
if (!*k)
{
ErrorF("[Xi] Cannot alloc memory for class copy.");
@ -471,7 +471,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
to->focus = classes->focus;
if (!to->focus)
{
to->focus = xcalloc(1, sizeof(FocusClassRec));
to->focus = calloc(1, sizeof(FocusClassRec));
if (!to->focus)
FatalError("[Xi] no memory for class shift.\n");
} else
@ -479,7 +479,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
oldTrace = to->focus->trace;
memcpy(to->focus, from->focus, sizeof(FocusClassRec));
to->focus->trace = xrealloc(oldTrace,
to->focus->trace = realloc(oldTrace,
to->focus->traceSize * sizeof(WindowPtr));
if (!to->focus->trace && to->focus->traceSize)
FatalError("[Xi] no memory for trace.\n");
@ -517,7 +517,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
{
if (!(*p))
{
*p = xcalloc(1, sizeof(PtrFeedbackClassRec));
*p = calloc(1, sizeof(PtrFeedbackClassRec));
if (!*p)
{
ErrorF("[Xi] Cannot alloc memory for class copy.");
@ -548,7 +548,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
classes->valuator = NULL;
}
to->valuator = xrealloc(to->valuator, sizeof(ValuatorClassRec) +
to->valuator = realloc(to->valuator, sizeof(ValuatorClassRec) +
from->valuator->numAxes * sizeof(AxisInfo) +
from->valuator->numAxes * sizeof(double));
v = to->valuator;
@ -578,7 +578,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
to->button = classes->button;
if (!to->button)
{
to->button = xcalloc(1, sizeof(ButtonClassRec));
to->button = calloc(1, sizeof(ButtonClassRec));
if (!to->button)
FatalError("[Xi] no memory for class shift.\n");
} else
@ -589,14 +589,14 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
{
if (!to->button->xkb_acts)
{
to->button->xkb_acts = xcalloc(1, sizeof(XkbAction));
to->button->xkb_acts = calloc(1, sizeof(XkbAction));
if (!to->button->xkb_acts)
FatalError("[Xi] not enough memory for xkb_acts.\n");
}
memcpy(to->button->xkb_acts, from->button->xkb_acts,
sizeof(XkbAction));
} else
xfree(to->button->xkb_acts);
free(to->button->xkb_acts);
memcpy(to->button->labels, from->button->labels,
from->button->numButtons * sizeof(Atom));
@ -617,7 +617,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
to->proximity = classes->proximity;
if (!to->proximity)
{
to->proximity = xcalloc(1, sizeof(ProximityClassRec));
to->proximity = calloc(1, sizeof(ProximityClassRec));
if (!to->proximity)
FatalError("[Xi] no memory for class shift.\n");
} else
@ -641,7 +641,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
to->absolute = classes->absolute;
if (!to->absolute)
{
to->absolute = xcalloc(1, sizeof(AbsoluteClassRec));
to->absolute = calloc(1, sizeof(AbsoluteClassRec));
if (!to->absolute)
FatalError("[Xi] no memory for class shift.\n");
} else
@ -698,7 +698,7 @@ XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master, DeviceChanged
/* we don't actually swap if there's a NullClient, swapping is done
* later when event is delivered. */
SendEventToAllWindows(master, XI_DeviceChangedMask, (xEvent*)dcce, 1);
xfree(dcce);
free(dcce);
}
static void
@ -928,7 +928,7 @@ ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
for (i = 0; i < screenInfo.numScreens; i++)
DeliverEventsToWindow(device, WindowTable[i], xi, 1,
GetEventFilter(device, xi), NULL);
xfree(xi);
free(xi);
}
}
@ -1116,7 +1116,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
{
ProximityClassPtr proxc;
proxc = (ProximityClassPtr) xalloc(sizeof(ProximityClassRec));
proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
if (!proxc)
return FALSE;
proxc->sourceid = dev->id;
@ -1232,7 +1232,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
btlen = bytes_to_int32(btlen);
len = sizeof(xXIFocusInEvent) + btlen * 4;
xi2event = xcalloc(1, len);
xi2event = calloc(1, len);
xi2event->type = GenericEvent;
xi2event->extension = IReqCode;
xi2event->evtype = type;
@ -1268,7 +1268,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1,
GetEventFilter(dev, (xEvent*)xi2event), NullGrab);
xfree(xi2event);
free(xi2event);
/* XI 1.x event */
event.deviceid = dev->id;
@ -1322,7 +1322,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
}
}
sev = ev = (deviceStateNotify *) xalloc(evcount * sizeof(xEvent));
sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent));
FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
if (b != NULL) {
@ -1377,7 +1377,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeliverEventsToWindow(dev, pWin, (xEvent *) sev, evcount,
DeviceStateNotifyMask, NullGrab);
xfree(sev);
free(sev);
}
}
@ -1627,7 +1627,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
if (!pWin->optional && !MakeWindowOptional(pWin))
return BadAlloc;
others = xcalloc(1, sizeof(InputClients));
others = calloc(1, sizeof(InputClients));
if (!others)
return BadAlloc;
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
@ -1646,7 +1646,7 @@ MakeInputMasks(WindowPtr pWin)
{
struct _OtherInputMasks *imasks;
imasks = xcalloc(1, sizeof(struct _OtherInputMasks));
imasks = calloc(1, sizeof(struct _OtherInputMasks));
if (!imasks)
return FALSE;
pWin->optional->inputMasks = imasks;
@ -1709,14 +1709,14 @@ InputClientGone(WindowPtr pWin, XID id)
if (other->resource == id) {
if (prev) {
prev->next = other->next;
xfree(other);
free(other);
} else if (!(other->next)) {
if (ShouldFreeInputMasks(pWin, TRUE)) {
wOtherInputMasks(pWin)->inputClients = other->next;
xfree(wOtherInputMasks(pWin));
free(wOtherInputMasks(pWin));
pWin->optional->inputMasks = (OtherInputMasks *) NULL;
CheckWindowOptionalNeed(pWin);
xfree(other);
free(other);
} else {
other->resource = FakeClientID(0);
if (!AddResource(other->resource, RT_INPUTCLIENT,
@ -1725,7 +1725,7 @@ InputClientGone(WindowPtr pWin, XID id)
}
} else {
wOtherInputMasks(pWin)->inputClients = other->next;
xfree(other);
free(other);
}
RecalculateDeviceDeliverableEvents(pWin);
return (Success);

View File

@ -1156,7 +1156,7 @@ void
AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
{
dev->xinput_type = type;
dev->name = (char *)xalloc(strlen(name) + 1);
dev->name = (char *)malloc(strlen(name) + 1);
strcpy(dev->name, name);
}

View File

@ -281,7 +281,7 @@ ProcXGetDeviceControl(ClientPtr client)
return BadValue;
}
buf = (char *)xalloc(total_length);
buf = (char *)malloc(total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -309,6 +309,6 @@ ProcXGetDeviceControl(ClientPtr client)
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf);
xfree(savbuf);
free(savbuf);
return Success;
}

View File

@ -340,7 +340,7 @@ ProcXGetFeedbackControl(ClientPtr client)
if (total_length == 0)
return BadMatch;
buf = (char *)xalloc(total_length);
buf = (char *)malloc(total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -361,6 +361,6 @@ ProcXGetFeedbackControl(ClientPtr client)
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf);
xfree(savbuf);
free(savbuf);
return Success;
}

View File

@ -133,8 +133,8 @@ ProcXGetDeviceKeyMapping(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 Success;
}

View File

@ -113,7 +113,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
xfree(modkeymap);
free(modkeymap);
return Success;
}

View File

@ -119,7 +119,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
&count, COUNT);
if (count) {
rep.count = count;
buf = (XEventClass *) xalloc(rep.count * sizeof(XEventClass));
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
tbuf = buf;
@ -134,7 +134,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
xfree(buf);
free(buf);
}
return Success;
}

View File

@ -132,7 +132,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof(XEventClass);
rep.length = bytes_to_int32(total_length);
buf = (XEventClass *) xalloc(total_length);
buf = (XEventClass *) malloc(total_length);
tclient = buf;
aclient = buf + rep.this_client_count;
@ -152,7 +152,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
if (total_length) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, total_length, buf);
xfree(buf);
free(buf);
}
return Success;
}

View File

@ -154,7 +154,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
WriteToClient(client, length * 4, (char *)coords);
}
if (coords)
xfree(coords);
free(coords);
return Success;
}

View File

@ -360,7 +360,7 @@ ProcXListInputDevices(ClientPtr client)
AddOtherInputDevices();
/* allocate space for saving skip value */
skip = xcalloc(sizeof(Bool), inputInfo.numDevices);
skip = calloc(sizeof(Bool), inputInfo.numDevices);
if (!skip)
return BadAlloc;
@ -386,7 +386,7 @@ ProcXListInputDevices(ClientPtr client)
/* allocate space for reply */
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *)xcalloc(1, total_length);
devbuf = (char *)calloc(1, total_length);
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
@ -411,8 +411,8 @@ ProcXListInputDevices(ClientPtr client)
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf);
xfree(savbuf);
xfree(skip);
free(savbuf);
free(skip);
return Success;
}

View File

@ -119,7 +119,7 @@ ProcXQueryDeviceState(ClientPtr client)
total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
num_classes++;
}
buf = (char *)xcalloc(total_length, 1);
buf = (char *)calloc(total_length, 1);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -169,7 +169,7 @@ ProcXQueryDeviceState(ClientPtr client)
WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
WriteToClient(client, total_length, savbuf);
xfree(savbuf);
free(savbuf);
return Success;
}

View File

@ -68,7 +68,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
if (!flags)
return;
ev = xcalloc(1, sizeof(xXIHierarchyEvent) +
ev = calloc(1, sizeof(xXIHierarchyEvent) +
MAXDEVICES * sizeof(xXIHierarchyInfo));
ev->type = GenericEvent;
ev->extension = IReqCode;
@ -116,7 +116,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
dummyDev.id = XIAllDevices;
SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
xfree(ev);
free(ev);
}
@ -172,7 +172,7 @@ ProcXIChangeHierarchy(ClientPtr client)
char* name;
SWAPIF(swaps(&c->name_len, n));
name = xcalloc(c->name_len + 1, sizeof(char));
name = calloc(c->name_len + 1, sizeof(char));
strncpy(name, (char*)&c[1], c->name_len);
@ -181,7 +181,7 @@ ProcXIChangeHierarchy(ClientPtr client)
TRUE);
if (rc != Success)
{
xfree(name);
free(name);
goto unwind;
}
@ -194,7 +194,7 @@ ProcXIChangeHierarchy(ClientPtr client)
if (rc != Success)
{
xfree(name);
free(name);
goto unwind;
}
@ -228,7 +228,7 @@ ProcXIChangeHierarchy(ClientPtr client)
flags[XTestptr->id] |= XISlaveAttached;
flags[XTestkeybd->id] |= XISlaveAttached;
xfree(name);
free(name);
}
break;
case XIRemoveMaster:

View File

@ -158,7 +158,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
status = CheckGrabValues(client, &param);
modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
modifiers_failed = xcalloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
if (!modifiers_failed)
return BadAlloc;
@ -204,7 +204,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, rep.num_modifiers * 4, (char*)modifiers_failed);
}
xfree(modifiers_failed);
free(modifiers_failed);
return ret;
}

View File

@ -225,7 +225,7 @@ static int list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
{
Atom *a;
atoms = xalloc(nprops * sizeof(Atom));
atoms = malloc(nprops * sizeof(Atom));
if(!atoms)
return BadAlloc;
a = atoms;
@ -457,7 +457,7 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
if (!buf && !(*nelem_return))
{
buf = xcalloc(val->size, sizeof(int));
buf = calloc(val->size, sizeof(int));
if (!buf)
return BadAlloc;
*buf_return = buf;
@ -517,7 +517,7 @@ XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
if (!buf && !(*nelem_return))
{
buf = xcalloc(val->size, sizeof(float));
buf = calloc(val->size, sizeof(float));
if (!buf)
return BadAlloc;
*buf_return = buf;
@ -549,7 +549,7 @@ XIRegisterPropertyHandler(DeviceIntPtr dev,
{
XIPropertyHandlerPtr new_handler;
new_handler = xcalloc(1, sizeof(XIPropertyHandler));
new_handler = calloc(1, sizeof(XIPropertyHandler));
if (!new_handler)
return 0;
@ -583,7 +583,7 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
else
prev->next = curr->next;
xfree(curr);
free(curr);
}
static XIPropertyPtr
@ -591,7 +591,7 @@ XICreateDeviceProperty (Atom property)
{
XIPropertyPtr prop;
prop = (XIPropertyPtr)xalloc(sizeof(XIPropertyRec));
prop = (XIPropertyPtr)malloc(sizeof(XIPropertyRec));
if (!prop)
return NULL;
@ -621,8 +621,8 @@ static void
XIDestroyDeviceProperty (XIPropertyPtr prop)
{
if (prop->value.data)
xfree(prop->value.data);
xfree(prop);
free(prop->value.data);
free(prop);
}
/* This function destroys all of the device's property-related stuff,
@ -649,7 +649,7 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
while(curr_handler)
{
next_handler = curr_handler->next;
xfree(curr_handler);
free(curr_handler);
curr_handler = next_handler;
}
@ -745,7 +745,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
pointer new_data = NULL, old_data = NULL;
total_size = total_len * size_in_bytes;
new_value.data = (pointer)xalloc (total_size);
new_value.data = (pointer)malloc(total_size);
if (!new_value.data && total_size)
{
if (add)
@ -797,7 +797,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
if (checkonly && rc != Success)
{
if (new_value.data)
xfree (new_value.data);
free(new_value.data);
return (rc);
}
}
@ -807,7 +807,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
} while (!checkonly);
}
if (prop_value->data)
xfree (prop_value->data);
free(prop_value->data);
*prop_value = new_value;
} else if (len == 0)
{
@ -905,7 +905,7 @@ ProcXListDeviceProperties (ClientPtr client)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
xfree(atoms);
free(atoms);
}
return rc;
}
@ -1149,7 +1149,7 @@ ProcXIListProperties(ClientPtr client)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
xfree(atoms);
free(atoms);
}
return rc;
}

View File

@ -87,7 +87,7 @@ ProcXIQueryDevice(ClientPtr client)
}
else
{
skip = xcalloc(sizeof(Bool), inputInfo.numDevices);
skip = calloc(sizeof(Bool), inputInfo.numDevices);
if (!skip)
return BadAlloc;
@ -106,7 +106,7 @@ ProcXIQueryDevice(ClientPtr client)
}
}
info = xcalloc(1, len);
info = calloc(1, len);
if (!info)
return BadAlloc;
@ -155,8 +155,8 @@ ProcXIQueryDevice(ClientPtr client)
WriteReplyToClient(client, sizeof(xXIQueryDeviceReply), &rep);
WriteToClient(client, rep.length * 4, ptr);
xfree(ptr);
xfree(skip);
free(ptr);
free(skip);
return rc;
}

View File

@ -144,7 +144,7 @@ ProcXIQueryPointer(ClientPtr client)
rep.buttons_len = bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
rep.length += rep.buttons_len;
buttons_size = rep.buttons_len * 4;
buttons = xcalloc(1, buttons_size);
buttons = calloc(1, buttons_size);
if (!buttons)
return BadAlloc;
@ -195,7 +195,7 @@ ProcXIQueryPointer(ClientPtr client)
if (buttons)
WriteToClient(client, buttons_size, buttons);
xfree(buttons);
free(buttons);
return Success;
}

View File

@ -173,7 +173,7 @@ ProcXISelectEvents(ClientPtr client)
RecalculateDeliverableEvents(win);
xfree(types);
free(types);
return Success;
}
@ -234,7 +234,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
return Success;
}
buffer = xcalloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
buffer = calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
if (!buffer)
return BadAlloc;
@ -281,7 +281,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
if (reply.num_masks)
WriteToClient(client, reply.length * 4, buffer);
xfree(buffer);
free(buffer);
return Success;
}

View File

@ -99,7 +99,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
ccw = xalloc (sizeof (CompClientWindowRec));
ccw = malloc(sizeof (CompClientWindowRec));
if (!ccw)
return BadAlloc;
ccw->id = FakeClientID (pClient->index);
@ -109,10 +109,10 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
*/
if (!cw)
{
cw = xalloc (sizeof (CompWindowRec));
cw = malloc(sizeof (CompWindowRec));
if (!cw)
{
xfree (ccw);
free(ccw);
return BadAlloc;
}
cw->damage = DamageCreate (compReportDamage,
@ -123,8 +123,8 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
pWin);
if (!cw->damage)
{
xfree (ccw);
xfree (cw);
free(ccw);
free(cw);
return BadAlloc;
}
if (wasMapped)
@ -207,7 +207,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
*prev = ccw->next;
if (ccw->update == CompositeRedirectManual)
cw->update = CompositeRedirectAutomatic;
xfree (ccw);
free(ccw);
break;
}
}
@ -229,7 +229,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
REGION_UNINIT (pScreen, &cw->borderClip);
dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
xfree (cw);
free(cw);
}
else if (cw->update == CompositeRedirectAutomatic &&
!cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
@ -295,7 +295,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
* The client *could* allocate multiple, but while supported,
* it is not expected to be common
*/
ccw = xalloc (sizeof (CompClientWindowRec));
ccw = malloc(sizeof (CompClientWindowRec));
if (!ccw)
return BadAlloc;
ccw->id = FakeClientID (pClient->index);
@ -305,10 +305,10 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
*/
if (!csw)
{
csw = xalloc (sizeof (CompSubwindowsRec));
csw = malloc(sizeof (CompSubwindowsRec));
if (!csw)
{
xfree (ccw);
free(ccw);
return BadAlloc;
}
csw->update = CompositeRedirectAutomatic;
@ -327,10 +327,10 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
(void) compUnredirectWindow (pClient, pChild, update);
if (!csw->clients)
{
xfree (csw);
free(csw);
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
}
xfree (ccw);
free(ccw);
return ret;
}
}
@ -391,7 +391,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
(void) compUnredirectWindow (pClient, pChild, ccw->update);
xfree (ccw);
free(ccw);
break;
}
}
@ -402,7 +402,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
if (!csw->clients)
{
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
xfree (csw);
free(csw);
}
}

View File

@ -62,7 +62,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
CompScreenPtr cs = GetCompScreen (pScreen);
Bool ret;
xfree (cs->alternateVisuals);
free(cs->alternateVisuals);
pScreen->CloseScreen = cs->CloseScreen;
pScreen->BlockHandler = cs->BlockHandler;
@ -81,7 +81,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->CopyWindow = cs->CopyWindow;
pScreen->PositionWindow = cs->PositionWindow;
xfree (cs);
free(cs);
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
ret = (*pScreen->CloseScreen) (index, pScreen);
@ -202,7 +202,7 @@ compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
{
VisualID *p;
p = xrealloc(cs->alternateVisuals,
p = realloc(cs->alternateVisuals,
sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
if(p == NULL)
return FALSE;
@ -323,7 +323,7 @@ compScreenInit (ScreenPtr pScreen)
if (GetCompScreen (pScreen))
return TRUE;
cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec));
cs = (CompScreenPtr) malloc(sizeof (CompScreenRec));
if (!cs)
return FALSE;
@ -337,7 +337,7 @@ compScreenInit (ScreenPtr pScreen)
if (!compAddAlternateVisuals (pScreen, cs))
{
xfree (cs);
free(cs);
return FALSE;
}

View File

@ -62,7 +62,7 @@ compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
{
if (pOc == pOcToDel) {
*pPrev = pOc->pNext;
xfree (pOc);
free(pOc);
break;
}
}
@ -97,7 +97,7 @@ compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec));
pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
if (pOc == NULL)
return NULL;

View File

@ -130,7 +130,7 @@ add_option(InputOption **options, const char *key, const char *value)
for (; *options; options = &(*options)->next)
;
*options = xcalloc(sizeof(**options), 1);
*options = calloc(sizeof(**options), 1);
if (!*options) /* Yeesh. */
return;
(*options)->key = xstrdup(key);

View File

@ -81,7 +81,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
MALFORMED_MESSAGE();
}
options = xcalloc(sizeof(*options), 1);
options = calloc(sizeof(*options), 1);
if (!options) {
ErrorF("[config/dbus] couldn't allocate option\n");
return BadAlloc;
@ -97,7 +97,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
/* signature should be [ss][ss]... */
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
tmpo = xcalloc(sizeof(*tmpo), 1);
tmpo = calloc(sizeof(*tmpo), 1);
if (!tmpo) {
ErrorF("[config/dbus] couldn't allocate option\n");
ret = BadAlloc;
@ -185,10 +185,10 @@ unwind:
tmpo = options;
options = options->next;
if (tmpo->key)
xfree(tmpo->key);
free(tmpo->key);
if (tmpo->value)
xfree(tmpo->value);
xfree(tmpo);
free(tmpo->value);
free(tmpo);
}
return ret;

View File

@ -63,14 +63,14 @@ device_removed(LibHalContext *ctx, const char *udi)
{
char *value;
value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */
value = malloc(strlen(udi) + 5); /* "hal:" + NULL */
if (!value)
return;
sprintf(value, "hal:%s", udi);
remove_devices("hal", value);
xfree(value);
free(value);
}
static char *
@ -102,7 +102,7 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
for (i = 0; props[i]; i++)
len += strlen(props[i]);
ret = xcalloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
if (!ret) {
libhal_free_string_array(props);
return NULL;
@ -179,7 +179,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
if (libhal_device_query_capability(hal_ctx, udi, "input.touchscreen", NULL))
attrs.flags |= ATTR_TOUCHSCREEN;
options = xcalloc(sizeof(*options), 1);
options = calloc(sizeof(*options), 1);
if (!options){
LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
goto unwind;
@ -200,7 +200,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
add_option(&options, "driver", driver);
add_option(&options, "name", name);
config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */
config_info = malloc(strlen(udi) + 5); /* "hal:" and NULL */
if (!config_info) {
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
goto unwind;
@ -252,34 +252,34 @@ device_added(LibHalContext *hal_ctx, const char *udi)
if (!strcasecmp(&tmp[3], "layout"))
{
if (xkb_opts.layout)
xfree(xkb_opts.layout);
free(xkb_opts.layout);
xkb_opts.layout = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "model"))
{
if (xkb_opts.model)
xfree(xkb_opts.model);
free(xkb_opts.model);
xkb_opts.model = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "rules"))
{
if (xkb_opts.rules)
xfree(xkb_opts.rules);
free(xkb_opts.rules);
xkb_opts.rules = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "variant"))
{
if (xkb_opts.variant)
xfree(xkb_opts.variant);
free(xkb_opts.variant);
xkb_opts.variant = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "options"))
{
if (xkb_opts.options)
xfree(xkb_opts.options);
free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val);
}
} else
{
/* all others */
add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
xfree(tmp_val);
free(tmp_val);
}
} else
{
@ -290,7 +290,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
(tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
{
if (xkb_opts.options)
xfree(xkb_opts.options);
free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val);
}
}
@ -325,7 +325,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
if (!xkb_opts.options)
xkb_opts.options = strdup(tmp_val);
}
xfree(tmp_val);
free(tmp_val);
} else
{
/* server 1.4 had xkb options as strlist */
@ -367,7 +367,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
for (; dev; dev = dev->next){
if (dev->config_info)
xfree(dev->config_info);
free(dev->config_info);
dev->config_info = xstrdup(config_info);
}
@ -375,42 +375,42 @@ unwind:
if (set)
libhal_free_property_set(set);
if (path)
xfree(path);
free(path);
if (driver)
xfree(driver);
free(driver);
if (name)
xfree(name);
free(name);
if (config_info)
xfree(config_info);
free(config_info);
while (!dev && (tmpo = options)) {
options = tmpo->next;
xfree(tmpo->key);
xfree(tmpo->value);
xfree(tmpo);
free(tmpo->key);
free(tmpo->value);
free(tmpo);
}
xfree(attrs.product);
xfree(attrs.vendor);
xfree(attrs.device);
free(attrs.product);
free(attrs.vendor);
free(attrs.device);
if (attrs.tags) {
char **tag = attrs.tags;
while (*tag) {
xfree(*tag);
free(*tag);
tag++;
}
xfree(attrs.tags);
free(attrs.tags);
}
if (xkb_opts.layout)
xfree(xkb_opts.layout);
free(xkb_opts.layout);
if (xkb_opts.rules)
xfree(xkb_opts.rules);
free(xkb_opts.rules);
if (xkb_opts.model)
xfree(xkb_opts.model);
free(xkb_opts.model);
if (xkb_opts.variant)
xfree(xkb_opts.variant);
free(xkb_opts.variant);
if (xkb_opts.options)
xfree(xkb_opts.options);
free(xkb_opts.options);
dbus_error_free(&error);

View File

@ -63,7 +63,7 @@ device_added(struct udev_device *udev_device)
if (!udev_device_get_property_value(udev_device, "ID_INPUT"))
return;
options = xcalloc(sizeof(*options), 1);
options = calloc(sizeof(*options), 1);
if (!options)
return;
@ -141,26 +141,26 @@ device_added(struct udev_device *udev_device)
goto unwind;
for (; dev; dev = dev->next) {
xfree(dev->config_info);
free(dev->config_info);
dev->config_info = xstrdup(config_info);
}
unwind:
xfree(config_info);
free(config_info);
while (!dev && (tmpo = options)) {
options = tmpo->next;
xfree(tmpo->key);
xfree(tmpo->value);
xfree(tmpo);
free(tmpo->key);
free(tmpo->value);
free(tmpo);
}
if (attrs.tags) {
char **tag = attrs.tags;
while (*tag) {
xfree(*tag);
free(*tag);
tag++;
}
xfree(attrs.tags);
free(attrs.tags);
}
return;
@ -178,7 +178,7 @@ device_removed(struct udev_device *device)
remove_devices("udev", value);
xfree(value);
free(value);
}
static void

View File

@ -201,7 +201,7 @@ ProcDamageCreate (ClientPtr client)
return BadValue;
}
pDamageExt = xalloc (sizeof (DamageExtRec));
pDamageExt = malloc(sizeof (DamageExtRec));
if (!pDamageExt)
return BadAlloc;
pDamageExt->id = stuff->damage;
@ -217,7 +217,7 @@ ProcDamageCreate (ClientPtr client)
pDamageExt);
if (!pDamageExt->pDamage)
{
xfree (pDamageExt);
free(pDamageExt);
return BadAlloc;
}
if (!AddResource (stuff->damage, DamageExtType, (pointer) pDamageExt))
@ -457,7 +457,7 @@ FreeDamageExt (pointer value, XID did)
DamageUnregister (pDamageExt->pDrawable, pDamageExt->pDamage);
DamageDestroy (pDamageExt->pDamage);
}
xfree (pDamageExt);
free(pDamageExt);
return Success;
}

View File

@ -241,7 +241,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
}
/* Free what was allocated by the GetVisualInfo() call above. */
xfree(scrVisInfo.visinfo);
free(scrVisInfo.visinfo);
if (!visualMatched)
{
@ -254,7 +254,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
* Allocate a window priv.
*/
pDbeWindowPriv = xcalloc(1, sizeof(DbeWindowPrivRec));
pDbeWindowPriv = calloc(1, sizeof(DbeWindowPrivRec));
if (!pDbeWindowPriv)
return(BadAlloc);
@ -319,7 +319,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
}
/* malloc/realloc a new array and initialize all elements to 0. */
pDbeWindowPriv->IDs = (XID *)xrealloc(pIDs,
pDbeWindowPriv->IDs = (XID *)realloc(pIDs,
(pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID));
if (!pDbeWindowPriv->IDs)
{
@ -383,7 +383,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
out_free:
dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, NULL);
xfree(pDbeWindowPriv);
free(pDbeWindowPriv);
return (status);
} /* ProcDbeAllocateBackBufferName() */
@ -508,7 +508,7 @@ ProcDbeSwapBuffers(ClientPtr client)
dbeSwapInfo = (xDbeSwapInfo *)&stuff[1];
/* Allocate array to record swap information. */
swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec));
swapInfo = (DbeSwapInfoPtr)malloc(nStuff * sizeof(DbeSwapInfoRec));
if (swapInfo == NULL)
{
return(BadAlloc);
@ -523,14 +523,14 @@ ProcDbeSwapBuffers(ClientPtr client)
error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client,
DixWriteAccess);
if (error != Success) {
Xfree(swapInfo);
free(swapInfo);
return error;
}
/* Each window must be double-buffered - BadMatch. */
if (DBE_WINDOW_PRIV(pWin) == NULL)
{
Xfree(swapInfo);
free(swapInfo);
return(BadMatch);
}
@ -539,7 +539,7 @@ ProcDbeSwapBuffers(ClientPtr client)
{
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
{
Xfree(swapInfo);
free(swapInfo);
return(BadMatch);
}
}
@ -550,7 +550,7 @@ ProcDbeSwapBuffers(ClientPtr client)
(dbeSwapInfo[i].swapAction != XdbeUntouched ) &&
(dbeSwapInfo[i].swapAction != XdbeCopied ))
{
Xfree(swapInfo);
free(swapInfo);
return(BadValue);
}
@ -580,12 +580,12 @@ ProcDbeSwapBuffers(ClientPtr client)
error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo);
if (error != Success)
{
Xfree(swapInfo);
free(swapInfo);
return(error);
}
}
Xfree(swapInfo);
free(swapInfo);
return(Success);
} /* ProcDbeSwapBuffers() */
@ -672,7 +672,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
/* Make sure any specified drawables are valid. */
if (stuff->n != 0)
{
if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n *
if (!(pDrawables = (DrawablePtr *)malloc(stuff->n *
sizeof(DrawablePtr))))
{
return(BadAlloc);
@ -685,19 +685,19 @@ ProcDbeGetVisualInfo(ClientPtr client)
rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
DixGetAttrAccess);
if (rc != Success) {
Xfree(pDrawables);
free(pDrawables);
return rc;
}
}
}
count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
if (!(pScrVisInfo = (XdbeScreenVisualInfo *)xalloc(count *
if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count *
sizeof(XdbeScreenVisualInfo))))
{
if (pDrawables)
{
Xfree(pDrawables);
free(pDrawables);
}
return(BadAlloc);
@ -720,13 +720,13 @@ ProcDbeGetVisualInfo(ClientPtr client)
/* Free visinfos that we allocated for previous screen infos.*/
for (j = 0; j < i; j++)
{
xfree(pScrVisInfo[j].visinfo);
free(pScrVisInfo[j].visinfo);
}
/* Free pDrawables if we needed to allocate it above. */
if (pDrawables)
{
Xfree(pDrawables);
free(pDrawables);
}
return (rc == Success) ? BadAlloc : rc;
@ -801,13 +801,13 @@ ProcDbeGetVisualInfo(ClientPtr client)
/* Clean up memory. */
for (i = 0; i < count; i++)
{
xfree(pScrVisInfo[i].visinfo);
free(pScrVisInfo[i].visinfo);
}
xfree(pScrVisInfo);
free(pScrVisInfo);
if (pDrawables)
{
Xfree(pDrawables);
free(pDrawables);
}
return(client->noClientException);
@ -1385,7 +1385,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
DBE_INIT_MAX_IDS * sizeof(XID));
/* Free the extended array; use the static array. */
xfree(pDbeWindowPriv->IDs);
free(pDbeWindowPriv->IDs);
pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs;
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
}
@ -1417,7 +1417,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
/* We are done with the window priv. */
dixFreePrivates(pDbeWindowPriv->devPrivates);
xfree(pDbeWindowPriv);
free(pDbeWindowPriv);
}
return(Success);
@ -1457,7 +1457,7 @@ DbeResetProc(ExtensionEntry *extEntry)
(*pDbeScreenPriv->ResetProc)(pScreen);
dixFreePrivates(pDbeScreenPriv->devPrivates);
xfree(pDbeScreenPriv);
free(pDbeScreenPriv);
}
}
} /* DbeResetProc() */
@ -1596,7 +1596,7 @@ DbeExtensionInit(void)
pScreen = screenInfo.screens[i];
if (!(pDbeScreenPriv =
(DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec))))
(DbeScreenPrivPtr)calloc(1, sizeof(DbeScreenPrivRec))))
{
/* If we can not alloc a window or screen private,
* then free any privates that we already alloc'ed and return
@ -1604,7 +1604,7 @@ DbeExtensionInit(void)
for (j = 0; j < i; j++)
{
xfree(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
free(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
dbeScreenPrivKey));
dixSetPrivate(&screenInfo.screens[j]->devPrivates,
dbeScreenPrivKey, NULL);
@ -1666,7 +1666,7 @@ DbeExtensionInit(void)
for (i = 0; i < screenInfo.numScreens; i++)
{
xfree(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
free(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
dbeScreenPrivKey));
dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
}

View File

@ -100,7 +100,7 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
}
/* Allocate an array of XdbeVisualInfo items. */
if (!(visInfo = (XdbeVisualInfo *)xalloc(count * sizeof(XdbeVisualInfo))))
if (!(visInfo = (XdbeVisualInfo *)malloc(count * sizeof(XdbeVisualInfo))))
{
return(FALSE); /* memory alloc failure */
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}
/**

View File

@ -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;
}

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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 */

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;

View File

@ -783,7 +783,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
unwrap(pExaScr, ps, Triangles);
unwrap(pExaScr, ps, AddTraps);
xfree (pExaScr);
free(pExaScr);
return (*pScreen->CloseScreen) (i, pScreen);
}
@ -794,14 +794,14 @@ exaCloseScreen(int i, ScreenPtr pScreen)
* without breaking ABI between EXA and the drivers. The driver's
* responsibility is to check beforehand that the EXA module has a matching
* major number and sufficient minor. Drivers are responsible for freeing the
* driver structure using xfree().
* driver structure using free().
*
* @return a newly allocated, zero-filled driver structure
*/
ExaDriverPtr
exaDriverAlloc(void)
{
return xcalloc(1, sizeof(ExaDriverRec));
return calloc(1, sizeof(ExaDriverRec));
}
/**
@ -889,7 +889,7 @@ exaDriverInit (ScreenPtr pScreen,
ps = GetPictureScreenIfSet(pScreen);
pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
pExaScr = calloc(sizeof (ExaScreenPrivRec), 1);
if (!pExaScr) {
LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
pScreen->myNum);

View File

@ -394,7 +394,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
rects = xalloc(nbox * sizeof(xRectangle));
rects = malloc(nbox * sizeof(xRectangle));
if (rects) {
int i;
@ -417,7 +417,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
ordering = CT_UNSORTED;
srcregion = RECTS_TO_REGION(pScreen, nbox, rects, ordering);
xfree(rects);
free(rects);
if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
pGC->fillStyle, pGC->alu,
@ -626,7 +626,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
return;
}
prect = xalloc(sizeof(xRectangle) * npt);
prect = malloc(sizeof(xRectangle) * npt);
for (i = 0; i < npt; i++) {
prect[i].x = ppt[i].x;
prect[i].y = ppt[i].y;
@ -638,7 +638,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
prect[i].height = 1;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt, prect);
xfree(prect);
free(prect);
}
/**
@ -667,7 +667,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
return;
}
prect = xalloc(sizeof(xRectangle) * (npt - 1));
prect = malloc(sizeof(xRectangle) * (npt - 1));
x1 = ppt[0].x;
y1 = ppt[0].y;
/* If we have any non-horizontal/vertical, fall back. */
@ -681,7 +681,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
}
if (x1 != x2 && y1 != y2) {
xfree(prect);
free(prect);
ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
return;
}
@ -705,7 +705,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
y1 = y2;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt - 1, prect);
xfree(prect);
free(prect);
}
/**
@ -737,7 +737,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
}
}
prect = xalloc(sizeof(xRectangle) * nseg);
prect = malloc(sizeof(xRectangle) * nseg);
for (i = 0; i < nseg; i++) {
if (pSeg[i].x1 < pSeg[i].x2) {
prect[i].x = pSeg[i].x1;
@ -763,7 +763,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
}
}
pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
xfree(prect);
free(prect);
}
static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,

View File

@ -128,12 +128,12 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
}
if (cache->hashEntries) {
xfree(cache->hashEntries);
free(cache->hashEntries);
cache->hashEntries = NULL;
}
if (cache->glyphs) {
xfree(cache->glyphs);
free(cache->glyphs);
cache->glyphs = NULL;
}
cache->glyphCount = 0;
@ -213,8 +213,8 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
cache->picture = pPicture;
cache->picture->refcnt++;
cache->hashEntries = xalloc(sizeof(int) * cache->hashSize);
cache->glyphs = xalloc(sizeof(ExaCachedGlyphRec) * cache->size);
cache->hashEntries = malloc(sizeof(int) * cache->hashSize);
cache->glyphs = malloc(sizeof(ExaCachedGlyphRec) * cache->size);
cache->glyphCount = 0;
if (!cache->hashEntries || !cache->glyphs)

View File

@ -245,7 +245,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
/* save extra space in new area */
if (real_size < area->size)
{
ExaOffscreenArea *new_area = xalloc (sizeof (ExaOffscreenArea));
ExaOffscreenArea *new_area = malloc(sizeof (ExaOffscreenArea));
if (!new_area)
return NULL;
new_area->base_offset = area->base_offset;
@ -408,7 +408,7 @@ ExaOffscreenMerge (ExaScreenPrivPtr pExaScr, ExaOffscreenArea *area)
area->next->prev = area;
else
pExaScr->info->offScreenAreas->prev = area;
xfree (next);
free(next);
pExaScr->numOffscreenAvailable--;
}
@ -655,7 +655,7 @@ exaOffscreenInit (ScreenPtr pScreen)
ExaOffscreenArea *area;
/* Allocate a big free area */
area = xalloc (sizeof (ExaOffscreenArea));
area = malloc(sizeof (ExaOffscreenArea));
if (!area)
return FALSE;
@ -691,6 +691,6 @@ ExaOffscreenFini (ScreenPtr pScreen)
while ((area = pExaScr->info->offScreenAreas))
{
pExaScr->info->offScreenAreas = area->next;
xfree (area);
free(area);
}
}

View File

@ -61,7 +61,7 @@ fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
FbScreenPrivPtr pScreenPriv;
pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec));
pScreenPriv = (FbScreenPrivPtr) malloc(sizeof (FbScreenPrivRec));
if (!pScreenPriv)
return FALSE;
dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);

View File

@ -388,7 +388,7 @@ fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
{
fbVisualsPtr new, *prev, v;
new = (fbVisualsPtr) xalloc (sizeof *new);
new = (fbVisualsPtr) malloc(sizeof *new);
if (!new)
return FALSE;
if (!redMask || !greenMask || !blueMask)
@ -485,12 +485,12 @@ fbInitVisuals (VisualPtr *visualp,
ndepth++;
nvisual += visuals->count;
}
depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec));
visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec));
depth = (DepthPtr) malloc(ndepth * sizeof (DepthRec));
visual = (VisualPtr) malloc(nvisual * sizeof (VisualRec));
if (!depth || !visual)
{
xfree (depth);
xfree (visual);
free(depth);
free(visual);
return FALSE;
}
*depthp = depth;
@ -506,7 +506,7 @@ fbInitVisuals (VisualPtr *visualp,
vid = NULL;
if (nvtype)
{
vid = (VisualID *) xalloc (nvtype * sizeof (VisualID));
vid = (VisualID *) malloc(nvtype * sizeof (VisualID));
if (!vid)
return FALSE;
}
@ -547,7 +547,7 @@ fbInitVisuals (VisualPtr *visualp,
vid++;
visual++;
}
xfree (visuals);
free(visuals);
}
fbVisuals = NULL;
visual = *visualp;

View File

@ -275,7 +275,7 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
height = pbox->y2 - pbox->y1;
tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
tmp = xalloc (tmpStride * height * sizeof (FbStip));
tmp = malloc(tmpStride * height * sizeof (FbStip));
if (!tmp)
return;
@ -313,7 +313,7 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
pPriv->and, pPriv->xor,
pPriv->bgand, pPriv->bgxor);
xfree (tmp);
free(tmp);
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);

View File

@ -348,7 +348,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
VisualID defaultVisual;
FbOverlayScrPrivPtr pScrPriv;
pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec));
pScrPriv = malloc(sizeof (FbOverlayScrPrivRec));
if (!pScrPriv)
return FALSE;

View File

@ -101,7 +101,7 @@ fbDestroyPixmap (PixmapPtr pPixmap)
if(--pPixmap->refcnt)
return TRUE;
dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
free(pPixmap);
return TRUE;
}
@ -308,7 +308,7 @@ fbPixmapToRegion(PixmapPtr pPix)
pReg->extents.y2 = REGION_END(pReg)->y2;
if (pReg->data->numRects == 1)
{
xfree(pReg->data);
free(pReg->data);
pReg->data = (RegDataPtr)NULL;
}
}

View File

@ -33,12 +33,12 @@ fbCloseScreen (int index, ScreenPtr pScreen)
DepthPtr depths = pScreen->allowedDepths;
for (d = 0; d < pScreen->numDepths; d++)
xfree (depths[d].vids);
xfree (depths);
xfree (pScreen->visuals);
xfree (pScreen->devPrivate);
free(depths[d].vids);
free(depths);
free(pScreen->visuals);
free(pScreen->devPrivate);
#ifdef FB_SCREEN_PRIVATE
xfree (dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
free(dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
#endif
return TRUE;
}
@ -229,8 +229,8 @@ fbFinishScreenInit(ScreenPtr pScreen,
if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
&defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
{
xfree (visuals);
xfree (depths);
free(visuals);
free(depths);
return FALSE;
}
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,

View File

@ -196,7 +196,7 @@ __glXContextDestroy(__GLXcontext *context)
static void __glXdirectContextDestroy(__GLXcontext *context)
{
__glXContextDestroy(context);
xfree(context);
free(context);
}
static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
@ -205,7 +205,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
{
__GLXcontext *context;
context = xcalloc (1, sizeof (__GLXcontext));
context = calloc(1, sizeof (__GLXcontext));
if (context == NULL)
return NULL;
@ -407,9 +407,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
** Didn't find a free slot, so we'll have to grow the table.
*/
if (!num) {
table = (__GLXcontext **) xalloc(sizeof(__GLXcontext *));
table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
} else {
table = (__GLXcontext **) xrealloc(table,
table = (__GLXcontext **) realloc(table,
(num+1)*sizeof(__GLXcontext *));
}
table[num] = glxc;
@ -1527,7 +1527,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
reply.n = nProps;
nReplyBytes = reply.length << 2;
sendBuf = (int *)xalloc((size_t)nReplyBytes);
sendBuf = (int *)malloc((size_t)nReplyBytes);
if (sendBuf == NULL) {
return __glXError(GLXBadContext); /* XXX: Is this correct? */
}
@ -1545,7 +1545,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
xfree((char *)sendBuf);
free((char *)sendBuf);
return Success;
}
@ -1947,9 +1947,9 @@ int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
*/
if (cl->largeCmdBufSize < cmdlen) {
if (!cl->largeCmdBuf) {
cl->largeCmdBuf = (GLbyte *) xalloc(cmdlen);
cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
} else {
cl->largeCmdBuf = (GLbyte *) xrealloc(cl->largeCmdBuf, cmdlen);
cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
}
if (!cl->largeCmdBuf) {
return BadAlloc;
@ -2351,7 +2351,7 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
reply.n = n;
/* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
buf = (char *) xalloc(length << 2);
buf = (char *) malloc(length << 2);
if (buf == NULL)
return BadAlloc;
memcpy(buf, pGlxScreen->GLXextensions, n);
@ -2363,7 +2363,7 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, (int)(length << 2), (char *)buf);
}
xfree(buf);
free(buf);
return Success;
}
@ -2407,7 +2407,7 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
reply.length = length;
reply.n = n;
buf = (char *) xalloc(length << 2);
buf = (char *) malloc(length << 2);
if (buf == NULL) {
return BadAlloc;
}
@ -2420,7 +2420,7 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
WriteToClient(client, (int)(length << 2), buf);
}
xfree(buf);
free(buf);
return Success;
}
@ -2432,7 +2432,7 @@ int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
if (cl->GLClientextensions)
xfree(cl->GLClientextensions);
free(cl->GLClientextensions);
buf = (const char *)(req+1);
cl->GLClientextensions = xstrdup(buf);

View File

@ -242,7 +242,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
__glXDrawableRelease(drawable);
xfree(private);
free(private);
}
static GLboolean
@ -299,7 +299,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
__glXleaveServer(GL_FALSE);
__glXContextDestroy(&context->base);
xfree(context);
free(context);
}
static int
@ -495,7 +495,7 @@ nooverride:
unsigned pitch = PixmapBytePad(pixmap->drawable.width,
pixmap->drawable.depth);
data = xalloc(pitch * pixmap->drawable.height);
data = malloc(pitch * pixmap->drawable.height);
__glXenterServer(GL_FALSE);
pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/,
@ -526,7 +526,7 @@ nooverride:
type,
data) );
xfree(data);
free(data);
} else if (!override) {
int i, numRects;
BoxPtr p;
@ -541,7 +541,7 @@ nooverride:
{
unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
pixmap->drawable.depth);
void *data = xalloc(pitch * (p[i].y2 - p[i].y1));
void *data = malloc(pitch * (p[i].y2 - p[i].y1));
__glXenterServer(GL_FALSE);
pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1,
@ -567,7 +567,7 @@ nooverride:
type,
data) );
xfree(data);
free(data);
}
}
@ -607,7 +607,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
__glXScreenDestroy(baseScreen);
xfree(screen);
free(screen);
}
static __GLXcontext *
@ -634,7 +634,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
if (baseShareContext && baseShareContext->isDirect)
return NULL;
context = xcalloc(1, sizeof *context);
context = calloc(1, sizeof *context);
if (context == NULL)
return NULL;
@ -675,7 +675,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
__glXenterServer(GL_FALSE);
retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
__glXleaveServer(GL_FALSE);
xfree(context);
free(context);
return NULL;
}
@ -697,13 +697,13 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
GLboolean retval;
drm_drawable_t hwDrawable;
private = xcalloc(1, sizeof *private);
private = calloc(1, sizeof *private);
if (private == NULL)
return NULL;
if (!__glXDrawableInit(&private->base, screen,
pDraw, type, glxDrawId, glxConfig)) {
xfree(private);
free(private);
return NULL;
}
@ -719,7 +719,7 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
__glXleaveServer(GL_FALSE);
if (!retval) {
xfree(private);
free(private);
return NULL;
}
@ -735,7 +735,7 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
__glXenterServer(GL_FALSE);
DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
__glXleaveServer(GL_FALSE);
xfree(private);
free(private);
return NULL;
}
@ -772,7 +772,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
if (retval && *numClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numClipRects;
*ppClipRects = xalloc (size);
*ppClipRects = malloc(size);
/* Clip cliprects to screen dimensions (redirected windows) */
if (*ppClipRects != NULL) {
@ -792,7 +792,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
if (*numClipRects != j) {
*numClipRects = j;
*ppClipRects = xrealloc (*ppClipRects,
*ppClipRects = realloc(*ppClipRects,
sizeof (drm_clip_rect_t) *
*numClipRects);
}
@ -806,7 +806,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
if (retval && *numBackClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numBackClipRects;
*ppBackClipRects = xalloc (size);
*ppBackClipRects = malloc(size);
if (*ppBackClipRects != NULL)
memcpy (*ppBackClipRects, pBackClipRects, size);
else
@ -977,7 +977,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
return NULL;
}
screen = xcalloc(1, sizeof *screen);
screen = calloc(1, sizeof *screen);
if (screen == NULL)
return NULL;
@ -1148,7 +1148,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) {
if (screen->base.GLXextensions != NULL) {
xfree(screen->base.GLXextensions);
free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size);
@ -1183,7 +1183,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
if (screen->driver)
dlclose(screen->driver);
xfree(screen);
free(screen);
LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");

View File

@ -107,7 +107,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
__glXDrawableRelease(drawable);
xfree(private);
free(private);
}
static void
@ -248,7 +248,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
(*screen->core->destroyContext)(context->driContext);
__glXContextDestroy(&context->base);
xfree(context);
free(context);
}
static int
@ -386,7 +386,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
__glXScreenDestroy(baseScreen);
xfree(screen);
free(screen);
}
static __GLXcontext *
@ -405,7 +405,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
else
driShare = NULL;
context = xcalloc(1, sizeof *context);
context = calloc(1, sizeof *context);
if (context == NULL)
return NULL;
@ -422,7 +422,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
config->driConfig,
driShare, context);
if (context->driContext == NULL) {
xfree(context);
free(context);
return NULL;
}
@ -442,14 +442,14 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
private = xcalloc(1, sizeof *private);
private = calloc(1, sizeof *private);
if (private == NULL)
return NULL;
private->screen = driScreen;
if (!__glXDrawableInit(&private->base, screen,
pDraw, type, glxDrawId, glxConfig)) {
xfree(private);
free(private);
return NULL;
}
@ -460,7 +460,7 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->base.waitX = __glXDRIdrawableWaitX;
if (DRI2CreateDrawable(client, pDraw, drawId)) {
xfree(private);
free(private);
return NULL;
}
@ -676,7 +676,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
const __DRIconfig **driConfigs;
int i;
screen = xcalloc(1, sizeof *screen);
screen = calloc(1, sizeof *screen);
if (screen == NULL)
return NULL;
@ -759,7 +759,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0) {
if (screen->base.GLXextensions != NULL) {
xfree(screen->base.GLXextensions);
free(screen->base.GLXextensions);
}
screen->base.GLXextensions = xnfalloc(buffer_size);
@ -793,7 +793,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
if (screen->driver)
dlclose(screen->driver);
xfree(screen);
free(screen);
LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");

View File

@ -127,7 +127,7 @@ createModeFromConfig(const __DRIcoreExtension *core,
unsigned int attrib, value;
int i;
config = xalloc(sizeof *config);
config = malloc(sizeof *config);
config->driConfig = driConfig;

View File

@ -104,7 +104,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
__glXDrawableRelease(drawable);
xfree(private);
free(private);
}
static GLboolean
@ -138,7 +138,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
(*screen->core->destroyContext)(context->driContext);
__glXContextDestroy(&context->base);
xfree(context);
free(context);
}
static int
@ -254,7 +254,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
__glXScreenDestroy(baseScreen);
xfree(screen);
free(screen);
}
static __GLXcontext *
@ -274,7 +274,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
else
driShare = NULL;
context = xcalloc(1, sizeof *context);
context = calloc(1, sizeof *context);
if (context == NULL)
return NULL;
@ -315,14 +315,14 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
ScreenPtr pScreen = driScreen->base.pScreen;
private = xcalloc(1, sizeof *private);
private = calloc(1, sizeof *private);
if (private == NULL)
return NULL;
private->screen = driScreen;
if (!__glXDrawableInit(&private->base, screen,
pDraw, type, glxDrawId, glxConfig)) {
xfree(private);
free(private);
return NULL;
}
@ -450,7 +450,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
const __DRIconfig **driConfigs;
int i;
screen = xcalloc(1, sizeof *screen);
screen = calloc(1, sizeof *screen);
if (screen == NULL)
return NULL;
@ -527,7 +527,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
if (screen->driver)
dlclose(screen->driver);
xfree(screen);
free(screen);
LogMessage(X_ERROR, "GLX: could not load software renderer\n");

View File

@ -205,8 +205,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
{
if (cx->idExists || cx->isCurrent) return GL_FALSE;
if (cx->feedbackBuf) xfree(cx->feedbackBuf);
if (cx->selectBuf) xfree(cx->selectBuf);
if (cx->feedbackBuf) free(cx->feedbackBuf);
if (cx->selectBuf) free(cx->selectBuf);
if (cx == __glXLastContext) {
__glXFlushContextCache();
}
@ -323,10 +323,10 @@ glxClientCallback (CallbackListPtr *list,
}
}
if (cl->returnBuf) xfree(cl->returnBuf);
if (cl->largeCmdBuf) xfree(cl->largeCmdBuf);
if (cl->currentContexts) xfree(cl->currentContexts);
if (cl->GLClientextensions) xfree(cl->GLClientextensions);
if (cl->returnBuf) free(cl->returnBuf);
if (cl->largeCmdBuf) free(cl->largeCmdBuf);
if (cl->currentContexts) free(cl->currentContexts);
if (cl->GLClientextensions) free(cl->GLClientextensions);
break;
default:

View File

@ -378,7 +378,7 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
pGlxScreen->numFBConfigs = i;
pGlxScreen->visuals =
xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
calloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
/* First, try to choose featureful FBconfigs for the existing X visuals.
* Note that if multiple X visuals end up with the same FBconfig being
@ -436,7 +436,7 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
void __glXScreenDestroy(__GLXscreen *screen)
{
xfree(screen->GLXvendor);
xfree(screen->GLXextensions);
xfree(screen->GLextensions);
free(screen->GLXvendor);
free(screen->GLXextensions);
free(screen->GLextensions);
}

View File

@ -88,7 +88,7 @@ __glXGetAnswerBuffer( __GLXclientState * cl, size_t required_size,
intptr_t temp_buf;
if ( cl->returnBufSize < worst_case_size ) {
void * temp = xrealloc( cl->returnBuf, worst_case_size );
void * temp = realloc( cl->returnBuf, worst_case_size );
if ( temp == NULL ) {
return NULL;

View File

@ -62,7 +62,7 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
size = *(GLsizei *)(pc+0);
type = *(GLenum *)(pc+4);
if (cx->feedbackBufSize < size) {
cx->feedbackBuf = (GLfloat *) xrealloc(cx->feedbackBuf,
cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
(size_t)size
* __GLX_SIZE_FLOAT32);
if (!cx->feedbackBuf) {
@ -90,7 +90,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
pc += __GLX_SINGLE_HDR_SIZE;
size = *(GLsizei *)(pc+0);
if (cx->selectBufSize < size) {
cx->selectBuf = (GLuint *) xrealloc(cx->selectBuf,
cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
(size_t) size
* __GLX_SIZE_CARD32);
if (!cx->selectBuf) {
@ -261,21 +261,21 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
clen = strlen(cext_string);
slen = strlen(sext_string);
if (clen > slen) {
combo_string = (char *) xalloc(slen + 2);
s1 = (char *) xalloc(slen + 2);
combo_string = (char *) malloc(slen + 2);
s1 = (char *) malloc(slen + 2);
if (s1) strcpy(s1, sext_string);
s2 = cext_string;
} else {
combo_string = (char *) xalloc(clen + 2);
s1 = (char *) xalloc(clen + 2);
combo_string = (char *) malloc(clen + 2);
s1 = (char *) malloc(clen + 2);
if (s1) strcpy(s1, cext_string);
s2 = sext_string;
}
if (!combo_string || !s1) {
if (combo_string)
xfree(combo_string);
free(combo_string);
if (s1)
xfree(s1);
free(s1);
return NULL;
}
combo_string[0] = '\0';
@ -302,7 +302,7 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
/* Get next extension token */
token = strtok( NULL, SEPARATOR);
}
xfree(s1);
free(s1);
return combo_string;
}
@ -349,13 +349,13 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
buf = __glXcombine_strings(buf1,
cx->pGlxScreen->GLextensions);
if (buf1 != NULL) {
xfree(buf1);
free(buf1);
}
string = buf;
}
else if ( name == GL_VERSION ) {
if ( atof( string ) > atof( GLServerVersion ) ) {
buf = xalloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
if ( buf == NULL ) {
string = GLServerVersion;
}
@ -380,7 +380,7 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
__GLX_SEND_HEADER();
WriteToClient(client, length, (char *) string);
if (buf != NULL)
xfree(buf);
free(buf);
return Success;
}

View File

@ -62,7 +62,7 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
size = *(GLsizei *)(pc+0);
type = *(GLenum *)(pc+4);
if (cx->feedbackBufSize < size) {
cx->feedbackBuf = (GLfloat *) xrealloc(cx->feedbackBuf,
cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
(size_t) size
* __GLX_SIZE_FLOAT32);
if (!cx->feedbackBuf) {
@ -93,7 +93,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(pc+0);
size = *(GLsizei *)(pc+0);
if (cx->selectBufSize < size) {
cx->selectBuf = (GLuint *) xrealloc(cx->selectBuf,
cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
(size_t) size
* __GLX_SIZE_CARD32);
if (!cx->selectBuf) {

View File

@ -86,7 +86,7 @@ extern xGLXSingleReply __glXReply;
if ((size) > sizeof(answerBuffer)) { \
int bump; \
if ((cl)->returnBufSize < (size)+(align)) { \
(cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf, \
(cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \
(size)+(align)); \
if (!(cl)->returnBuf) { \
return BadAlloc; \

View File

@ -76,7 +76,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
p = buf;
allocbuf = 0;
} else {
p = (unsigned char *) xalloc(allocBytes);
p = (unsigned char *) malloc(allocBytes);
if (!p)
return BadAlloc;
allocbuf = p;
@ -100,7 +100,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
allocbuf ? allocbuf : buf) );
if (allocbuf) {
xfree(allocbuf);
free(allocbuf);
}
return Success;
#undef __GL_CHAR_BUF_SIZE

View File

@ -419,7 +419,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
if (!_DMXXineramaActive()) goto noxinerama;
if (!(attribs = xalloc(stuff->screenCount * sizeof(*attribs))))
if (!(attribs = malloc(stuff->screenCount * sizeof(*attribs))))
return BadAlloc;
for (i = 0; i < stuff->screenCount; i++) {
@ -438,7 +438,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
&errorScreen);
#endif
xfree(attribs);
free(attribs);
if (status == BadValue) return status;
@ -484,7 +484,7 @@ static int ProcDMXAddScreen(ClientPtr client)
value_list = (CARD32 *)(stuff + 1);
count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
name[stuff->displayNameLength] = '\0';
@ -492,7 +492,7 @@ static int ProcDMXAddScreen(ClientPtr client)
status = dmxAttachScreen(stuff->physicalScreen, &attr);
xfree(name);
free(name);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
@ -612,30 +612,30 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
if (!(screens = xalloc(count * sizeof(*screens))))
if (!(screens = malloc(count * sizeof(*screens))))
return BadAlloc;
if (!(windows = xalloc(count * sizeof(*windows)))) {
xfree(screens);
if (!(windows = malloc(count * sizeof(*windows)))) {
free(screens);
return BadAlloc;
}
if (!(pos = xalloc(count * sizeof(*pos)))) {
xfree(windows);
xfree(screens);
if (!(pos = malloc(count * sizeof(*pos)))) {
free(windows);
free(screens);
return BadAlloc;
}
if (!(vis = xalloc(count * sizeof(*vis)))) {
xfree(pos);
xfree(windows);
xfree(screens);
if (!(vis = malloc(count * sizeof(*vis)))) {
free(pos);
free(windows);
free(screens);
return BadAlloc;
}
if ((count = dmxPopulate(client, stuff->window, screens, windows,
pos, vis)) < 0) {
xfree(vis);
xfree(pos);
xfree(windows);
xfree(screens);
free(vis);
free(pos);
free(windows);
free(screens);
return BadWindow;
}
@ -673,10 +673,10 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
WriteToClient(client, count * sizeof(*vis), (char *)vis);
}
xfree(vis);
xfree(pos);
xfree(windows);
xfree(screens);
free(vis);
free(pos);
free(windows);
free(screens);
return client->noClientException;
}
@ -837,7 +837,7 @@ static int ProcDMXAddInput(ClientPtr client)
value_list = (CARD32 *)(stuff + 1);
count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
name[stuff->displayNameLength] = '\0';
@ -845,7 +845,7 @@ static int ProcDMXAddInput(ClientPtr client)
status = dmxAddInput(&attr, &id);
xfree(name);
free(name);
if (status) return status;

View File

@ -94,7 +94,7 @@ __GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, int screen, int *nconfigs)
config = (__GLXvisualConfig*)
Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
if (!config) {
Xfree(props);
free(props);
UnlockDisplay(dpy);
SyncHandle();
return NULL;
@ -284,7 +284,7 @@ __GLXFBConfig *GetGLXFBConfigs(Display *dpy, int glxMajorOpcode, int *nconfigs)
config = (__GLXFBConfig*)
Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
if (!config) {
Xfree(attrs);
free(attrs);
UnlockDisplay(dpy);
SyncHandle();
return NULL;

View File

@ -50,7 +50,7 @@ static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap)
{
dmxColormapPrivPtr pCmapPriv;
pCmapPriv = (dmxColormapPrivPtr)xalloc(sizeof(*pCmapPriv));
pCmapPriv = (dmxColormapPrivPtr)malloc(sizeof(*pCmapPriv));
if (!pCmapPriv)
return FALSE;
pCmapPriv->cmap = (Colormap)0;
@ -133,7 +133,7 @@ void dmxDestroyColormap(ColormapPtr pColormap)
if (dmxScreen->beDisplay)
dmxBEFreeColormap(pColormap);
xfree(pCmapPriv);
free(pCmapPriv);
DMX_SET_COLORMAP_PRIV(pColormap, NULL);
DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
@ -170,7 +170,7 @@ void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef)
dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) {
XColor *color = xalloc(sizeof(*color) * ndef);
XColor *color = malloc(sizeof(*color) * ndef);
int i;
if (color) {
@ -183,7 +183,7 @@ void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef)
color[i].pad = pdef[i].pad;
}
XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef);
xfree(color);
free(color);
} else { /* xalloc failed, so fallback */
XColor c;
for (i = 0; i < ndef; i++) {

View File

@ -663,7 +663,7 @@ static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
DMX_SET_CURSOR_PRIV(pCursor, pScreen, xalloc(sizeof(*pCursorPriv)));
DMX_SET_CURSOR_PRIV(pCursor, pScreen, malloc(sizeof(*pCursorPriv)));
if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
return FALSE;
@ -701,7 +701,7 @@ static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
if (dmxScreen->beDisplay) {
if (dmxBEFreeCursor(pScreen, pCursor))
xfree(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
free(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
}
DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);

View File

@ -68,9 +68,9 @@ static char **dmxGetFontPath(int *npaths)
GetFontPath(serverClient, npaths, &len, &paths);
newfp = xalloc(*npaths + len);
newfp = malloc(*npaths + len);
c = (unsigned char *)newfp;
fp = xalloc(*npaths * sizeof(*fp));
fp = malloc(*npaths * sizeof(*fp));
memmove(newfp, paths+1, *npaths + len - 1);
l = *paths;
@ -91,8 +91,8 @@ static char **dmxGetFontPath(int *npaths)
static void dmxFreeFontPath(char **fp)
{
xfree(fp[0]);
xfree(fp);
free(fp[0]);
free(fp);
}
static Bool dmxCheckFontPathElement(DMXScreenInfo *dmxScreen, char *fp)
@ -195,7 +195,7 @@ static int dmxProcSetFontPath(ClientPtr client)
return BadLength;
GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
oldFontPath = xalloc(nOldPaths + lenOldPaths);
oldFontPath = malloc(nOldPaths + lenOldPaths);
memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
@ -217,7 +217,7 @@ static int dmxProcSetFontPath(ClientPtr client)
}
}
xfree(oldFontPath);
free(oldFontPath);
return result;
}
@ -300,7 +300,7 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
if (!dmxFontPath)
dmxLog(dmxWarning, "No default font path is set.\n");
goodfps = xalloc(npaths * sizeof(*goodfps));
goodfps = malloc(npaths * sizeof(*goodfps));
dmxLog(dmxError,
"The DMX server failed to set the following font paths on "
@ -347,11 +347,11 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
"more information on font paths.\n");
dmxFreeFontPath(fp);
XFreeFontPath(oldFontPath);
xfree(goodfps);
free(goodfps);
return FALSE;
}
newfp = xalloc(len * sizeof(*newfp));
newfp = malloc(len * sizeof(*newfp));
for (i = 0; i < npaths; i++) {
if (goodfps[i]) {
int n = strlen(fp[i]);
@ -398,7 +398,7 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
/* We still have errors so return with error */
dmxFreeFontPath(fp);
XFreeFontPath(oldFontPath);
xfree(goodfps);
free(goodfps);
return FALSE;
}
}
@ -440,12 +440,12 @@ Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
pFontPriv = xalloc(sizeof(dmxFontPrivRec));
pFontPriv = malloc(sizeof(dmxFontPrivRec));
if (!pFontPriv) return FALSE;
pFontPriv->font = NULL;
MAXSCREENSALLOC(pFontPriv->font);
if (!pFontPriv->font) {
xfree(pFontPriv);
free(pFontPriv);
return FALSE;
}
pFontPriv->refcnt = 0;
@ -491,7 +491,7 @@ Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
/* In case the font failed to load properly */
if (!pFontPriv->refcnt) {
MAXSCREENSFREE(pFontPriv->font);
xfree(pFontPriv);
free(pFontPriv);
FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
} else if (pFontPriv->font[pScreen->myNum]) {
if (dmxScreen->beDisplay)
@ -549,7 +549,7 @@ Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
#endif
) {
MAXSCREENSFREE(pFontPriv->font);
xfree(pFontPriv);
free(pFontPriv);
FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
}
}

View File

@ -364,7 +364,7 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
case CT_REGION:
if (dmxScreen->beDisplay) {
nRects = REGION_NUM_RECTS((RegionPtr)pGC->clientClip);
pRects = xalloc(nRects * sizeof(*pRects));
pRects = malloc(nRects * sizeof(*pRects));
pBox = REGION_RECTS((RegionPtr)pGC->clientClip);
for (i = 0; i < nRects; i++) {
@ -378,7 +378,7 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
pGC->clipOrg.x, pGC->clipOrg.y,
pRects, nRects, Unsorted);
xfree(pRects);
free(pRects);
}
break;

View File

@ -412,7 +412,7 @@ void dmxGetColormaps(DMXScreenInfo *dmxScreen)
int i;
dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
dmxScreen->beDefColormaps = xalloc(dmxScreen->beNumDefColormaps *
dmxScreen->beDefColormaps = malloc(dmxScreen->beNumDefColormaps *
sizeof(*dmxScreen->beDefColormaps));
for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
@ -738,7 +738,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
nconfigs = dmxScreen->numGlxVisuals;
}
configprivs = xalloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
if (configs != NULL && configprivs != NULL) {
@ -748,7 +748,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
for (i = 0; i < nconfigs; i++) {
configprivs[i] = (dmxGlxVisualPrivate *)
xalloc(sizeof(dmxGlxVisualPrivate));
malloc(sizeof(dmxGlxVisualPrivate));
configprivs[i]->x_visual_depth = 0;
configprivs[i]->x_visual_class = 0;
@ -816,11 +816,11 @@ static void dmxSetDefaultFontPath(char *fp)
int len;
len = strlen(dmxFontPath);
dmxFontPath = xrealloc(dmxFontPath, len+fplen+1);
dmxFontPath = realloc(dmxFontPath, len+fplen+1);
dmxFontPath[len] = ',';
strncpy(&dmxFontPath[len+1], fp, fplen);
} else {
dmxFontPath = xalloc(fplen);
dmxFontPath = malloc(fplen);
strncpy(dmxFontPath, fp, fplen);
}

Some files were not shown because too many files have changed in this diff Show More