Xext: Remove usage of alloca

Replace with heap allocations.
This commit is contained in:
Daniel Stone 2007-11-05 14:18:22 +00:00
parent fb32bb9839
commit 934281126f
10 changed files with 66 additions and 66 deletions

View File

@ -524,12 +524,12 @@ ProcDisplayImageBuffers (client)
return Success; return Success;
minDelay = stuff->minDelay; minDelay = stuff->minDelay;
ids = (XID *) &stuff[1]; ids = (XID *) &stuff[1];
ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr)); ppMultibuffers = (MultibuffersPtr *) xalloc(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr)); pMultibuffer = (MultibufferPtr *) xalloc(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer) if (!ppMultibuffers || !pMultibuffer)
{ {
if (ppMultibuffers) DEALLOCATE_LOCAL(ppMultibuffers); if (ppMultibuffers) xfree(ppMultibuffers);
if (pMultibuffer) DEALLOCATE_LOCAL(pMultibuffer); if (pMultibuffer) xfree(pMultibuffer);
client->errorValue = 0; client->errorValue = 0;
return BadAlloc; return BadAlloc;
} }
@ -541,8 +541,8 @@ ProcDisplayImageBuffers (client)
MultibufferResType); MultibufferResType);
if (!pMultibuffer[i]) if (!pMultibuffer[i])
{ {
DEALLOCATE_LOCAL(ppMultibuffers); xfree(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer); xfree(pMultibuffer);
client->errorValue = ids[i]; client->errorValue = ids[i];
return MultibufferErrorBase + MultibufferBadBuffer; return MultibufferErrorBase + MultibufferBadBuffer;
} }
@ -551,8 +551,8 @@ MultibufferResType);
{ {
if (ppMultibuffers[i] == ppMultibuffers[j]) if (ppMultibuffers[i] == ppMultibuffers[j])
{ {
DEALLOCATE_LOCAL(ppMultibuffers); xfree(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer); xfree(pMultibuffer);
client->errorValue = ids[i]; client->errorValue = ids[i];
return BadMatch; return BadMatch;
} }
@ -571,8 +571,8 @@ MultibufferResType);
else else
PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf); PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
DEALLOCATE_LOCAL(ppMultibuffers); xfree(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer); xfree(pMultibuffer);
return Success; return Success;
} }
@ -665,7 +665,7 @@ ProcGetMBufferAttributes (client)
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers) if (!pMultibuffers)
return BadAccess; return BadAccess;
ids = (XID *) ALLOCATE_LOCAL (pMultibuffers->numMultibuffer * sizeof (XID)); ids = (XID *) xalloc (pMultibuffers->numMultibuffer * sizeof (XID));
if (!ids) if (!ids)
return BadAlloc; return BadAlloc;
for (i = 0; i < pMultibuffers->numMultibuffer; i++) for (i = 0; i < pMultibuffers->numMultibuffer; i++)
@ -688,7 +688,7 @@ ProcGetMBufferAttributes (client)
(char *)&rep); (char *)&rep);
WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)), WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)),
(char *)ids); (char *)ids);
DEALLOCATE_LOCAL((pointer) ids); xfree((pointer) ids);
return client->noClientException; return client->noClientException;
} }
@ -803,7 +803,7 @@ ProcGetBufferInfo (client)
nInfo += pDepth->numVids; nInfo += pDepth->numVids;
} }
pInfo = (xMbufBufferInfo *) pInfo = (xMbufBufferInfo *)
ALLOCATE_LOCAL (nInfo * sizeof (xMbufBufferInfo)); xalloc (nInfo * sizeof (xMbufBufferInfo));
if (!pInfo) if (!pInfo)
return BadAlloc; return BadAlloc;
@ -839,7 +839,7 @@ ProcGetBufferInfo (client)
} }
WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (pointer) &rep); WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (pointer) &rep);
WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (pointer) pInfo); WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (pointer) pInfo);
DEALLOCATE_LOCAL ((pointer) pInfo); xfree ((pointer) pInfo);
return client->noClientException; return client->noClientException;
} }
@ -1256,7 +1256,7 @@ DisplayImageBuffers (ids, nbuf)
MultibuffersPtr *pMultibuffers; MultibuffersPtr *pMultibuffers;
int i, j; int i, j;
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL (nbuf * sizeof *pMultibuffer + pMultibuffer = (MultibufferPtr *) xalloc (nbuf * sizeof *pMultibuffer +
nbuf * sizeof *pMultibuffers); nbuf * sizeof *pMultibuffers);
if (!pMultibuffer) if (!pMultibuffer)
return BadAlloc; return BadAlloc;
@ -1266,19 +1266,19 @@ DisplayImageBuffers (ids, nbuf)
pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType); pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType);
if (!pMultibuffer[i]) if (!pMultibuffer[i])
{ {
DEALLOCATE_LOCAL (pMultibuffer); xfree (pMultibuffer);
return MultibufferErrorBase + MultibufferBadBuffer; return MultibufferErrorBase + MultibufferBadBuffer;
} }
pMultibuffers[i] = pMultibuffer[i]->pMultibuffers; pMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
if (pMultibuffers[i] == pMultibuffers[j]) if (pMultibuffers[i] == pMultibuffers[j])
{ {
DEALLOCATE_LOCAL (pMultibuffer); xfree (pMultibuffer);
return BadMatch; return BadMatch;
} }
} }
PerformDisplayRequest (pMultibuffers, pMultibuffer, nbuf); PerformDisplayRequest (pMultibuffers, pMultibuffer, nbuf);
DEALLOCATE_LOCAL (pMultibuffer); xfree (pMultibuffer);
return Success; return Success;
} }
@ -1382,7 +1382,7 @@ MultibufferExpose (pMultibuffer, pRegion)
numRects = REGION_NUM_RECTS(pRegion); numRects = REGION_NUM_RECTS(pRegion);
pBox = REGION_RECTS(pRegion); pBox = REGION_RECTS(pRegion);
pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)); pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent));
if (pEvent) { if (pEvent) {
pe = pEvent; pe = pEvent;
@ -1398,7 +1398,7 @@ MultibufferExpose (pMultibuffer, pRegion)
} }
(void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects, (void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects,
ExposureMask); ExposureMask);
DEALLOCATE_LOCAL(pEvent); xfree(pEvent);
} }
} }
} }

View File

@ -614,7 +614,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
if (!pGC) if (!pGC)
return; return;
prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) *
sizeof(xRectangle)); sizeof(xRectangle));
if (!prect) if (!prect)
{ {
@ -638,7 +638,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
prect -= numRects; prect -= numRects;
(* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect); (* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect);
DEALLOCATE_LOCAL(prect); xfree(prect);
FreeScratchGC (pGC); FreeScratchGC (pGC);
} }

View File

@ -263,7 +263,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
int nrects = REGION_NUM_RECTS(pRegion); int nrects = REGION_NUM_RECTS(pRegion);
BoxPtr pbox = REGION_RECTS(pRegion); BoxPtr pbox = REGION_RECTS(pRegion);
pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle)); pRects = (xRectangle *)xalloc(nrects * sizeof(xRectangle));
if (pRects) if (pRects)
{ {
int i; int i;
@ -275,7 +275,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
pRects[i].height = pbox->y2 - pbox->y1; pRects[i].height = pbox->y2 - pbox->y1;
} }
MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects); MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects);
DEALLOCATE_LOCAL(pRects); xfree(pRects);
} }
} }

View File

@ -1272,7 +1272,7 @@ int PanoramiXPolyPoint(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
if (npoint > 0) { if (npoint > 0) {
origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint)); origPts = (xPoint *) xalloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1299,7 +1299,7 @@ int PanoramiXPolyPoint(ClientPtr client)
result = (* SavedProcVector[X_PolyPoint])(client); result = (* SavedProcVector[X_PolyPoint])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(origPts); xfree(origPts);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
@ -1330,7 +1330,7 @@ int PanoramiXPolyLine(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
if (npoint > 0){ if (npoint > 0){
origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint)); origPts = (xPoint *) xalloc(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1357,7 +1357,7 @@ int PanoramiXPolyLine(ClientPtr client)
result = (* SavedProcVector[X_PolyLine])(client); result = (* SavedProcVector[X_PolyLine])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(origPts); xfree(origPts);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
@ -1391,7 +1391,7 @@ int PanoramiXPolySegment(ClientPtr client)
if(nsegs & 4) return BadLength; if(nsegs & 4) return BadLength;
nsegs >>= 3; nsegs >>= 3;
if (nsegs > 0) { if (nsegs > 0) {
origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment)); origSegs = (xSegment *) xalloc(nsegs * sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment)); memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1418,7 +1418,7 @@ int PanoramiXPolySegment(ClientPtr client)
result = (* SavedProcVector[X_PolySegment])(client); result = (* SavedProcVector[X_PolySegment])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(origSegs); xfree(origSegs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
@ -1453,7 +1453,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(nrects & 4) return BadLength; if(nrects & 4) return BadLength;
nrects >>= 3; nrects >>= 3;
if (nrects > 0){ if (nrects > 0){
origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle)); origRecs = (xRectangle *) xalloc(nrects * sizeof(xRectangle));
memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle)); memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1479,7 +1479,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
result = (* SavedProcVector[X_PolyRectangle])(client); result = (* SavedProcVector[X_PolyRectangle])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(origRecs); xfree(origRecs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
@ -1513,7 +1513,7 @@ int PanoramiXPolyArc(ClientPtr client)
if(narcs % sizeof(xArc)) return BadLength; if(narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc); narcs /= sizeof(xArc);
if (narcs > 0){ if (narcs > 0){
origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc)); origArcs = (xArc *) xalloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1537,7 +1537,7 @@ int PanoramiXPolyArc(ClientPtr client)
result = (* SavedProcVector[X_PolyArc])(client); result = (* SavedProcVector[X_PolyArc])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(origArcs); xfree(origArcs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
@ -1569,7 +1569,7 @@ int PanoramiXFillPoly(ClientPtr client)
count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
if (count > 0){ if (count > 0){
locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec)); locPts = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec));
memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec)); memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1596,7 +1596,7 @@ int PanoramiXFillPoly(ClientPtr client)
result = (* SavedProcVector[X_FillPoly])(client); result = (* SavedProcVector[X_FillPoly])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(locPts); xfree(locPts);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
@ -1630,7 +1630,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if(things & 4) return BadLength; if(things & 4) return BadLength;
things >>= 3; things >>= 3;
if (things > 0){ if (things > 0){
origRects = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle)); origRects = (xRectangle *) xalloc(things * sizeof(xRectangle));
memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle)); memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1655,7 +1655,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
result = (* SavedProcVector[X_PolyFillRectangle])(client); result = (* SavedProcVector[X_PolyFillRectangle])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(origRects); xfree(origRects);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
@ -1689,7 +1689,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
IF_RETURN((narcs % sizeof(xArc)), BadLength); IF_RETURN((narcs % sizeof(xArc)), BadLength);
narcs /= sizeof(xArc); narcs /= sizeof(xArc);
if (narcs > 0) { if (narcs > 0) {
origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc)); origArcs = (xArc *) xalloc(narcs * sizeof(xArc));
memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){ FOR_NSCREENS_FORWARD(j){
@ -1714,7 +1714,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
result = (* SavedProcVector[X_PolyFillArc])(client); result = (* SavedProcVector[X_PolyFillArc])(client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(origArcs); xfree(origArcs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);

View File

@ -673,7 +673,7 @@ CreateSaverWindow (pScreen)
wantMap = wColormap (pWin); wantMap = wColormap (pWin);
if (wantMap == None) if (wantMap == None)
return TRUE; return TRUE;
installedMaps = (Colormap *) ALLOCATE_LOCAL (pScreen->maxInstalledCmaps * installedMaps = (Colormap *) xalloc (pScreen->maxInstalledCmaps *
sizeof (Colormap)); sizeof (Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps) numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pScreen, installedMaps); (pScreen, installedMaps);
@ -681,7 +681,7 @@ CreateSaverWindow (pScreen)
if (installedMaps[i] == wantMap) if (installedMaps[i] == wantMap)
break; break;
DEALLOCATE_LOCAL ((char *) installedMaps); xfree ((char *) installedMaps);
if (i < numInstalled) if (i < numInstalled)
return TRUE; return TRUE;

View File

@ -1060,7 +1060,7 @@ ProcShapeGetRectangles (client)
} }
if (!region) { if (!region) {
nrects = 1; nrects = 1;
rects = (xRectangle *) ALLOCATE_LOCAL (sizeof (xRectangle)); rects = (xRectangle *) xalloc (sizeof (xRectangle));
if (!rects) if (!rects)
return BadAlloc; return BadAlloc;
switch (stuff->kind) { switch (stuff->kind) {
@ -1087,7 +1087,7 @@ ProcShapeGetRectangles (client)
BoxPtr box; BoxPtr box;
nrects = REGION_NUM_RECTS(region); nrects = REGION_NUM_RECTS(region);
box = REGION_RECTS(region); box = REGION_RECTS(region);
rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle)); rects = (xRectangle *) xalloc (nrects * sizeof (xRectangle));
if (!rects && nrects) if (!rects && nrects)
return BadAlloc; return BadAlloc;
for (i = 0; i < nrects; i++, box++) { for (i = 0; i < nrects; i++, box++) {
@ -1110,7 +1110,7 @@ ProcShapeGetRectangles (client)
} }
WriteToClient (client, sizeof (rep), (char *) &rep); WriteToClient (client, sizeof (rep), (char *) &rep);
WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects); WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
DEALLOCATE_LOCAL (rects); xfree (rects);
return client->noClientException; return client->noClientException;
} }

View File

@ -601,7 +601,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events)
if (client->clientGone) if (client->clientGone)
return; return;
pev = pEvents = (xSyncCounterNotifyEvent *) pev = pEvents = (xSyncCounterNotifyEvent *)
ALLOCATE_LOCAL(num_events * sizeof(xSyncCounterNotifyEvent)); xalloc(num_events * sizeof(xSyncCounterNotifyEvent));
if (!pEvents) if (!pEvents)
return; return;
UpdateCurrentTime(); UpdateCurrentTime();
@ -622,7 +622,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events)
} }
/* swapping will be taken care of by this */ /* swapping will be taken care of by this */
WriteEventsToClient(client, num_events, (xEvent *)pEvents); WriteEventsToClient(client, num_events, (xEvent *)pEvents);
DEALLOCATE_LOCAL(pEvents); xfree(pEvents);
} }
@ -732,7 +732,7 @@ SyncAwaitTriggerFired(pTrigger)
pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader; pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
numwaits = pAwaitUnion->header.num_waitconditions; numwaits = pAwaitUnion->header.num_waitconditions;
ppAwait = (SyncAwait **)ALLOCATE_LOCAL(numwaits * sizeof(SyncAwait *)); ppAwait = (SyncAwait **)xalloc(numwaits * sizeof(SyncAwait *));
if (!ppAwait) if (!ppAwait)
goto bail; goto bail;
@ -801,7 +801,7 @@ SyncAwaitTriggerFired(pTrigger)
if (num_events) if (num_events)
SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait, SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
num_events); num_events);
DEALLOCATE_LOCAL(ppAwait); xfree(ppAwait);
bail: bail:
/* unblock the client */ /* unblock the client */
@ -1396,7 +1396,7 @@ ProcSyncListSystemCounters(client)
if (len) if (len)
{ {
walklist = list = (xSyncSystemCounter *) ALLOCATE_LOCAL(len); walklist = list = (xSyncSystemCounter *) xalloc(len);
if (!list) if (!list)
return BadAlloc; return BadAlloc;
} }
@ -1442,7 +1442,7 @@ ProcSyncListSystemCounters(client)
if (len) if (len)
{ {
WriteToClient(client, len, (char *) list); WriteToClient(client, len, (char *) list);
DEALLOCATE_LOCAL(list); xfree(list);
} }
return (client->noClientException); return (client->noClientException);

View File

@ -437,7 +437,7 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
/* convert region to list-of-rectangles for PolyFillRect */ /* convert region to list-of-rectangles for PolyFillRect */
pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *)); pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle *));
if (!pRects) if (!pRects)
{ {
failed = TRUE; failed = TRUE;
@ -489,7 +489,7 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
*/ */
bzero(pBuf, (int)(widthBytesLine * h)); bzero(pBuf, (int)(widthBytesLine * h));
} }
if (pRects) DEALLOCATE_LOCAL(pRects); if (pRects) xfree(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC); if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix); if (pPix) FreeScratchPixmapHeader(pPix);
} }

View File

@ -491,7 +491,7 @@ ProcXF86BigfontQueryFont(
} else { } else {
#endif #endif
pCI = (xCharInfo *) pCI = (xCharInfo *)
ALLOCATE_LOCAL(nCharInfos * sizeof(xCharInfo)); xalloc(nCharInfos * sizeof(xCharInfo));
if (!pCI) if (!pCI)
return BadAlloc; return BadAlloc;
#ifdef HAS_SHM #ifdef HAS_SHM
@ -554,9 +554,9 @@ ProcXF86BigfontQueryFont(
hashModulus = nCharInfos+1; hashModulus = nCharInfos+1;
tmp = (CARD16*) tmp = (CARD16*)
ALLOCATE_LOCAL((4*nCharInfos+1) * sizeof(CARD16)); xalloc((4*nCharInfos+1) * sizeof(CARD16));
if (!tmp) { if (!tmp) {
if (!pDesc) DEALLOCATE_LOCAL(pCI); if (!pDesc) xfree(pCI);
return BadAlloc; return BadAlloc;
} }
pIndex2UniqIndex = tmp; pIndex2UniqIndex = tmp;
@ -639,12 +639,12 @@ ProcXF86BigfontQueryFont(
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16) + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0); : 0);
xXF86BigfontQueryFontReply* reply = xXF86BigfontQueryFontReply* reply =
(xXF86BigfontQueryFontReply *) ALLOCATE_LOCAL(rlength); (xXF86BigfontQueryFontReply *) xalloc(rlength);
char* p; char* p;
if (!reply) { if (!reply) {
if (nCharInfos > 0) { if (nCharInfos > 0) {
if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex); if (shmid == -1) xfree(pIndex2UniqIndex);
if (!pDesc) DEALLOCATE_LOCAL(pCI); if (!pDesc) xfree(pCI);
} }
return BadAlloc; return BadAlloc;
} }
@ -722,10 +722,10 @@ ProcXF86BigfontQueryFont(
} }
} }
WriteToClient(client, rlength, (char *)reply); WriteToClient(client, rlength, (char *)reply);
DEALLOCATE_LOCAL(reply); xfree(reply);
if (nCharInfos > 0) { if (nCharInfos > 0) {
if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex); if (shmid == -1) xfree(pIndex2UniqIndex);
if (!pDesc) DEALLOCATE_LOCAL(pCI); if (!pDesc) xfree(pCI);
} }
return (client->noClientException); return (client->noClientException);
} }

View File

@ -63,7 +63,7 @@ ProcXResQueryClients (ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq); REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = ALLOCATE_LOCAL((currentMaxClients - 1) * sizeof(int)); current_clients = xalloc((currentMaxClients - 1) * sizeof(int));
num_clients = 0; num_clients = 0;
for(i = 1; i < currentMaxClients; i++) { for(i = 1; i < currentMaxClients; i++) {
@ -101,7 +101,7 @@ ProcXResQueryClients (ClientPtr client)
} }
} }
DEALLOCATE_LOCAL(current_clients); xfree(current_clients);
return (client->noClientException); return (client->noClientException);
} }
@ -134,7 +134,7 @@ ProcXResQueryClientResources (ClientPtr client)
return BadValue; return BadValue;
} }
counts = ALLOCATE_LOCAL((lastResourceType + 1) * sizeof(int)); counts = xalloc((lastResourceType + 1) * sizeof(int));
memset(counts, 0, (lastResourceType + 1) * sizeof(int)); memset(counts, 0, (lastResourceType + 1) * sizeof(int));
@ -183,7 +183,7 @@ ProcXResQueryClientResources (ClientPtr client)
} }
} }
DEALLOCATE_LOCAL(counts); xfree(counts);
return (client->noClientException); return (client->noClientException);
} }