Commit 06bb154d authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

replace (DE)ALLOCATE_LOCAL by malloc/free

This is basically a backport of the following commits + replacing xalloc/xfree by malloc/free. Fixes ArcticaProject/nx-libs#358. commit 2761c103311a1160bc483fd0367d654733df8598 Author: Daniel Stone <daniel@fooishbar.org> Date: Mon Nov 5 14:03:26 2007 +0000 OS: Remove usage of alloca Replace with heap allocations. commit 5e363500c86042c394595e1a6633581eb8fcd1bb Author: Daniel Stone <daniel@fooishbar.org> Date: Mon Nov 5 14:38:28 2007 +0000 OS: Remove ALLOCATE_LOCAL from os.h Remove ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK from os.h, and remove the include of Xalloca.h as well.
parent 6e8aee49
...@@ -1257,7 +1257,7 @@ int PanoramiXPolyPoint(ClientPtr client) ...@@ -1257,7 +1257,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 *) malloc(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){
...@@ -1284,7 +1284,7 @@ int PanoramiXPolyPoint(ClientPtr client) ...@@ -1284,7 +1284,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); free(origPts);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
...@@ -1315,7 +1315,7 @@ int PanoramiXPolyLine(ClientPtr client) ...@@ -1315,7 +1315,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 *) malloc(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){
...@@ -1342,7 +1342,7 @@ int PanoramiXPolyLine(ClientPtr client) ...@@ -1342,7 +1342,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); free(origPts);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
...@@ -1376,7 +1376,7 @@ int PanoramiXPolySegment(ClientPtr client) ...@@ -1376,7 +1376,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 *) malloc(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){
...@@ -1403,7 +1403,7 @@ int PanoramiXPolySegment(ClientPtr client) ...@@ -1403,7 +1403,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); free(origSegs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
...@@ -1438,7 +1438,7 @@ int PanoramiXPolyRectangle(ClientPtr client) ...@@ -1438,7 +1438,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 *) malloc(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){
...@@ -1464,7 +1464,7 @@ int PanoramiXPolyRectangle(ClientPtr client) ...@@ -1464,7 +1464,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); free(origRecs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
...@@ -1498,7 +1498,7 @@ int PanoramiXPolyArc(ClientPtr client) ...@@ -1498,7 +1498,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 *) malloc(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){
...@@ -1522,7 +1522,7 @@ int PanoramiXPolyArc(ClientPtr client) ...@@ -1522,7 +1522,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); free(origArcs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
...@@ -1554,7 +1554,7 @@ int PanoramiXFillPoly(ClientPtr client) ...@@ -1554,7 +1554,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) malloc(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){
...@@ -1581,7 +1581,7 @@ int PanoramiXFillPoly(ClientPtr client) ...@@ -1581,7 +1581,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); free(locPts);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
...@@ -1615,7 +1615,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client) ...@@ -1615,7 +1615,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 *) malloc(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){
...@@ -1640,7 +1640,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client) ...@@ -1640,7 +1640,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); free(origRects);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
...@@ -1674,7 +1674,7 @@ int PanoramiXPolyFillArc(ClientPtr client) ...@@ -1674,7 +1674,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 *) malloc(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){
...@@ -1699,7 +1699,7 @@ int PanoramiXPolyFillArc(ClientPtr client) ...@@ -1699,7 +1699,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); free(origArcs);
return (result); return (result);
} else } else
return (client->noClientException); return (client->noClientException);
......
...@@ -595,7 +595,7 @@ CreateSaverWindow (pScreen) ...@@ -595,7 +595,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 *) malloc (pScreen->maxInstalledCmaps *
sizeof (Colormap)); sizeof (Colormap));
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps) numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
(pScreen, installedMaps); (pScreen, installedMaps);
...@@ -603,7 +603,7 @@ CreateSaverWindow (pScreen) ...@@ -603,7 +603,7 @@ CreateSaverWindow (pScreen)
if (installedMaps[i] == wantMap) if (installedMaps[i] == wantMap)
break; break;
DEALLOCATE_LOCAL ((char *) installedMaps); free ((char *) installedMaps);
if (i < numInstalled) if (i < numInstalled)
return TRUE; return TRUE;
......
...@@ -1371,7 +1371,7 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, ...@@ -1371,7 +1371,7 @@ SecurityCensorImage(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 *)malloc(nRects * sizeof(xRectangle *));
if (!pRects) if (!pRects)
{ {
failed = TRUE; failed = TRUE;
...@@ -1423,7 +1423,7 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, ...@@ -1423,7 +1423,7 @@ SecurityCensorImage(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) free(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC); if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix); if (pPix) FreeScratchPixmapHeader(pPix);
} }
......
...@@ -1044,7 +1044,7 @@ ProcShapeGetRectangles (client) ...@@ -1044,7 +1044,7 @@ ProcShapeGetRectangles (client)
} }
if (!region) { if (!region) {
nrects = 1; nrects = 1;
rects = (xRectangle *) ALLOCATE_LOCAL (sizeof (xRectangle)); rects = (xRectangle *) malloc (sizeof (xRectangle));
if (!rects) if (!rects)
return BadAlloc; return BadAlloc;
switch (stuff->kind) { switch (stuff->kind) {
...@@ -1071,7 +1071,7 @@ ProcShapeGetRectangles (client) ...@@ -1071,7 +1071,7 @@ ProcShapeGetRectangles (client)
BoxPtr box; BoxPtr box;
nrects = RegionNumRects(region); nrects = RegionNumRects(region);
box = RegionRects(region); box = RegionRects(region);
rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle)); rects = (xRectangle *) malloc (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++) {
...@@ -1094,7 +1094,7 @@ ProcShapeGetRectangles (client) ...@@ -1094,7 +1094,7 @@ ProcShapeGetRectangles (client)
} }
WriteToClient (client, sizeof (rep), &rep); WriteToClient (client, sizeof (rep), &rep);
WriteToClient (client, nrects * sizeof (xRectangle), rects); WriteToClient (client, nrects * sizeof (xRectangle), rects);
DEALLOCATE_LOCAL (rects); free (rects);
return client->noClientException; return client->noClientException;
} }
......
...@@ -578,7 +578,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events) ...@@ -578,7 +578,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)); malloc(num_events * sizeof(xSyncCounterNotifyEvent));
if (!pEvents) if (!pEvents)
return; return;
UpdateCurrentTime(); UpdateCurrentTime();
...@@ -598,7 +598,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events) ...@@ -598,7 +598,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); free(pEvents);
} }
...@@ -708,7 +708,7 @@ SyncAwaitTriggerFired(pTrigger) ...@@ -708,7 +708,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 **)malloc(numwaits * sizeof(SyncAwait *));
if (!ppAwait) if (!ppAwait)
goto bail; goto bail;
...@@ -777,7 +777,7 @@ SyncAwaitTriggerFired(pTrigger) ...@@ -777,7 +777,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); free(ppAwait);
bail: bail:
/* unblock the client */ /* unblock the client */
...@@ -1371,7 +1371,7 @@ ProcSyncListSystemCounters(client) ...@@ -1371,7 +1371,7 @@ ProcSyncListSystemCounters(client)
if (len) if (len)
{ {
walklist = list = (xSyncSystemCounter *) ALLOCATE_LOCAL(len); walklist = list = (xSyncSystemCounter *) malloc(len);
if (!list) if (!list)
return BadAlloc; return BadAlloc;
} }
...@@ -1415,7 +1415,7 @@ ProcSyncListSystemCounters(client) ...@@ -1415,7 +1415,7 @@ ProcSyncListSystemCounters(client)
if (len) if (len)
{ {
WriteToClient(client, len, list); WriteToClient(client, len, list);
DEALLOCATE_LOCAL(list); free(list);
} }
return (client->noClientException); return (client->noClientException);
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#include <nx-X11/X.h> #include <nx-X11/X.h>
#include <nx-X11/Xproto.h> #include <nx-X11/Xproto.h>
#include "misc.h" #include "misc.h"
#include "os.h"
#include "dixstruct.h" #include "dixstruct.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "dixfontstr.h" #include "dixfontstr.h"
...@@ -491,7 +490,7 @@ ProcXF86BigfontQueryFont( ...@@ -491,7 +490,7 @@ ProcXF86BigfontQueryFont(
} else { } else {
#endif #endif
pCI = (xCharInfo *) pCI = (xCharInfo *)
ALLOCATE_LOCAL(nCharInfos * sizeof(xCharInfo)); malloc(nCharInfos * sizeof(xCharInfo));
if (!pCI) if (!pCI)
return BadAlloc; return BadAlloc;
#ifdef HAS_SHM #ifdef HAS_SHM
...@@ -554,9 +553,9 @@ ProcXF86BigfontQueryFont( ...@@ -554,9 +553,9 @@ ProcXF86BigfontQueryFont(
hashModulus = nCharInfos+1; hashModulus = nCharInfos+1;
tmp = (CARD16*) tmp = (CARD16*)
ALLOCATE_LOCAL((4*nCharInfos+1) * sizeof(CARD16)); malloc((4*nCharInfos+1) * sizeof(CARD16));
if (!tmp) { if (!tmp) {
if (!pDesc) DEALLOCATE_LOCAL(pCI); if (!pDesc) free(pCI);
return BadAlloc; return BadAlloc;
} }
pIndex2UniqIndex = tmp; pIndex2UniqIndex = tmp;
...@@ -643,8 +642,8 @@ ProcXF86BigfontQueryFont( ...@@ -643,8 +642,8 @@ ProcXF86BigfontQueryFont(
char* p; char* p;
if (!reply) { if (!reply) {
if (nCharInfos > 0) { if (nCharInfos > 0) {
if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex); if (shmid == -1) free(pIndex2UniqIndex);
if (!pDesc) DEALLOCATE_LOCAL(pCI); if (!pDesc) free(pCI);
} }
return BadAlloc; return BadAlloc;
} }
...@@ -721,8 +720,8 @@ ProcXF86BigfontQueryFont( ...@@ -721,8 +720,8 @@ ProcXF86BigfontQueryFont(
WriteToClient(client, rlength, reply); WriteToClient(client, rlength, reply);
free(reply); free(reply);
if (nCharInfos > 0) { if (nCharInfos > 0) {
if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex); if (shmid == -1) free(pIndex2UniqIndex);
if (!pDesc) DEALLOCATE_LOCAL(pCI); if (!pDesc) free(pCI);
} }
return (client->noClientException); return (client->noClientException);
} }
......
...@@ -49,7 +49,7 @@ ProcXResQueryClients (ClientPtr client) ...@@ -49,7 +49,7 @@ ProcXResQueryClients (ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq); REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = ALLOCATE_LOCAL((currentMaxClients - 1) * sizeof(int)); current_clients = malloc((currentMaxClients - 1) * sizeof(int));
num_clients = 0; num_clients = 0;
for(i = 1; i < currentMaxClients; i++) { for(i = 1; i < currentMaxClients; i++) {
...@@ -85,7 +85,7 @@ ProcXResQueryClients (ClientPtr client) ...@@ -85,7 +85,7 @@ ProcXResQueryClients (ClientPtr client)
} }
} }
DEALLOCATE_LOCAL(current_clients); free(current_clients);
return (client->noClientException); return (client->noClientException);
} }
...@@ -118,7 +118,7 @@ ProcXResQueryClientResources (ClientPtr client) ...@@ -118,7 +118,7 @@ ProcXResQueryClientResources (ClientPtr client)
return BadValue; return BadValue;
} }
counts = ALLOCATE_LOCAL((lastResourceType + 1) * sizeof(int)); counts = malloc((lastResourceType + 1) * sizeof(int));
memset(counts, 0, (lastResourceType + 1) * sizeof(int)); memset(counts, 0, (lastResourceType + 1) * sizeof(int));
...@@ -164,7 +164,7 @@ ProcXResQueryClientResources (ClientPtr client) ...@@ -164,7 +164,7 @@ ProcXResQueryClientResources (ClientPtr client)
} }
} }
DEALLOCATE_LOCAL(counts); free(counts);
return (client->noClientException); return (client->noClientException);
} }
......
...@@ -147,7 +147,7 @@ ProcXGetDeviceMotionEvents(client) ...@@ -147,7 +147,7 @@ ProcXGetDeviceMotionEvents(client)
{ {
size = sizeof(Time) + (axes * sizeof (INT32)); size = sizeof(Time) + (axes * sizeof (INT32));
tsize = num_events * size; tsize = num_events * size;
coords = (INT32 *) ALLOCATE_LOCAL(tsize); coords = (INT32 *) malloc(tsize);
if (!coords) if (!coords)
{ {
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
...@@ -179,7 +179,7 @@ ProcXGetDeviceMotionEvents(client) ...@@ -179,7 +179,7 @@ ProcXGetDeviceMotionEvents(client)
WriteToClient(client, length * 4, coords); WriteToClient(client, length * 4, coords);
} }
if (coords) if (coords)
DEALLOCATE_LOCAL(coords); free(coords);
return Success; return Success;
} }
......
...@@ -740,7 +740,7 @@ UpdateColors (ColormapPtr pmap) ...@@ -740,7 +740,7 @@ UpdateColors (ColormapPtr pmap)
pVisual = pmap->pVisual; pVisual = pmap->pVisual;
size = pVisual->ColormapEntries; size = pVisual->ColormapEntries;
defs = (xColorItem *)ALLOCATE_LOCAL(size * sizeof(xColorItem)); defs = (xColorItem *)malloc(size * sizeof(xColorItem));
if (!defs) if (!defs)
return; return;
n = 0; n = 0;
...@@ -790,7 +790,7 @@ UpdateColors (ColormapPtr pmap) ...@@ -790,7 +790,7 @@ UpdateColors (ColormapPtr pmap)
} }
if (n) if (n)
(*pmap->pScreen->StoreColors)(pmap, n, defs); (*pmap->pScreen->StoreColors)(pmap, n, defs);
DEALLOCATE_LOCAL(defs); free(defs);
} }
/* Get a read-only color from a ColorMap (probably slow for large maps) /* Get a read-only color from a ColorMap (probably slow for large maps)
...@@ -1741,14 +1741,14 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont ...@@ -1741,14 +1741,14 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
for(p = pixels; p < pixels + c; p++) for(p = pixels; p < pixels + c; p++)
*p = 0; *p = 0;
ppixRed = (Pixel *)ALLOCATE_LOCAL(npixR * sizeof(Pixel)); ppixRed = (Pixel *)malloc(npixR * sizeof(Pixel));
ppixGreen = (Pixel *)ALLOCATE_LOCAL(npixG * sizeof(Pixel)); ppixGreen = (Pixel *)malloc(npixG * sizeof(Pixel));
ppixBlue = (Pixel *)ALLOCATE_LOCAL(npixB * sizeof(Pixel)); ppixBlue = (Pixel *)malloc(npixB * sizeof(Pixel));
if (!ppixRed || !ppixGreen || !ppixBlue) if (!ppixRed || !ppixGreen || !ppixBlue)
{ {
if (ppixBlue) DEALLOCATE_LOCAL(ppixBlue); if (ppixBlue) free(ppixBlue);
if (ppixGreen) DEALLOCATE_LOCAL(ppixGreen); if (ppixGreen) free(ppixGreen);
if (ppixRed) DEALLOCATE_LOCAL(ppixRed); if (ppixRed) free(ppixRed);
return(BadAlloc); return(BadAlloc);
} }
...@@ -1786,9 +1786,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont ...@@ -1786,9 +1786,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
if (okB) if (okB)
for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++) for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
pmap->blue[*ppix].refcnt = 0; pmap->blue[*ppix].refcnt = 0;
DEALLOCATE_LOCAL(ppixBlue); free(ppixBlue);
DEALLOCATE_LOCAL(ppixGreen); free(ppixGreen);
DEALLOCATE_LOCAL(ppixRed); free(ppixRed);
return(BadAlloc); return(BadAlloc);
} }
...@@ -1830,9 +1830,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont ...@@ -1830,9 +1830,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
for (pDst = pixels; pDst < pixels + c; pDst++) for (pDst = pixels; pDst < pixels + c; pDst++)
*pDst |= ALPHAMASK(pmap->pVisual); *pDst |= ALPHAMASK(pmap->pVisual);
DEALLOCATE_LOCAL(ppixBlue); free(ppixBlue);
DEALLOCATE_LOCAL(ppixGreen); free(ppixGreen);
DEALLOCATE_LOCAL(ppixRed); free(ppixRed);
return (Success); return (Success);
} }
...@@ -1848,7 +1848,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, ...@@ -1848,7 +1848,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
npix = c << r; npix = c << r;
if ((r >= 32) || (npix > pmap->freeRed) || (npix < c)) if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
return(BadAlloc); return(BadAlloc);
if(!(ppixTemp = (Pixel *)ALLOCATE_LOCAL(npix * sizeof(Pixel)))) if(!(ppixTemp = (Pixel *)malloc(npix * sizeof(Pixel))))
return(BadAlloc); return(BadAlloc);
ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
...@@ -1878,7 +1878,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, ...@@ -1878,7 +1878,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
pmap->numPixelsRed[client] += npix; pmap->numPixelsRed[client] += npix;
pmap->freeRed -= npix; pmap->freeRed -= npix;
} }
DEALLOCATE_LOCAL(ppixTemp); free(ppixTemp);
return (ok ? Success : BadAlloc); return (ok ? Success : BadAlloc);
} }
...@@ -2078,7 +2078,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, ...@@ -2078,7 +2078,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
npixClientNew = c << (r + g + b); npixClientNew = c << (r + g + b);
npixShared = (c << r) + (c << g) + (c << b); npixShared = (c << r) + (c << g) + (c << b);
psharedList = (SHAREDCOLOR **)ALLOCATE_LOCAL(npixShared * psharedList = (SHAREDCOLOR **)malloc(npixShared *
sizeof(SHAREDCOLOR *)); sizeof(SHAREDCOLOR *));
if (!psharedList) if (!psharedList)
return FALSE; return FALSE;
...@@ -2193,7 +2193,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, ...@@ -2193,7 +2193,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
} }
} }
} }
DEALLOCATE_LOCAL(psharedList); free(psharedList);
return TRUE; return TRUE;
} }
...@@ -2667,7 +2667,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin) ...@@ -2667,7 +2667,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
Colormap *pmaps; Colormap *pmaps;
int imap, nummaps, found; int imap, nummaps, found;
pmaps = (Colormap *) ALLOCATE_LOCAL( pmaps = (Colormap *) malloc(
pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap));
if(!pmaps) if(!pmaps)
return(FALSE); return(FALSE);
...@@ -2682,7 +2682,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin) ...@@ -2682,7 +2682,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
break; break;
} }
} }
DEALLOCATE_LOCAL(pmaps); free(pmaps);
return (found); return (found);
} }
......
...@@ -1547,7 +1547,7 @@ ProcGetMotionEvents(ClientPtr client) ...@@ -1547,7 +1547,7 @@ ProcGetMotionEvents(ClientPtr client)
{ {
if (CompareTimeStamps(stop, currentTime) == LATER) if (CompareTimeStamps(stop, currentTime) == LATER)
stop = currentTime; stop = currentTime;
coords = (xTimecoord *)ALLOCATE_LOCAL(mouse->valuator->numMotionEvents coords = (xTimecoord *)malloc(mouse->valuator->numMotionEvents
* sizeof(xTimecoord)); * sizeof(xTimecoord));
if (!coords) if (!coords)
return BadAlloc; return BadAlloc;
...@@ -1581,7 +1581,7 @@ ProcGetMotionEvents(ClientPtr client) ...@@ -1581,7 +1581,7 @@ ProcGetMotionEvents(ClientPtr client)
(char *)coords); (char *)coords);
} }
if (coords) if (coords)
DEALLOCATE_LOCAL(coords); free(coords);
return Success; return Success;
} }
......
...@@ -334,7 +334,7 @@ Dispatch(void) ...@@ -334,7 +334,7 @@ Dispatch(void)
InitSelections(); InitSelections();
nClients = 0; nClients = 0;
clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients); clientReady = (int *) malloc(sizeof(int) * MaxClients);
if (!clientReady) if (!clientReady)
return; return;
...@@ -439,7 +439,7 @@ Dispatch(void) ...@@ -439,7 +439,7 @@ Dispatch(void)
ddxBeforeReset (); ddxBeforeReset ();
#endif #endif
KillAllClients(); KillAllClients();
DEALLOCATE_LOCAL(clientReady); free(clientReady);
dispatchException &= ~DE_RESET; dispatchException &= ~DE_RESET;
} }
...@@ -830,7 +830,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -830,7 +830,7 @@ ProcQueryTree(register ClientPtr client)
{ {
int curChild = 0; int curChild = 0;
childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window)); childIDs = (Window *) malloc(numChildren * sizeof(Window));
if (!childIDs) if (!childIDs)
return BadAlloc; return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
...@@ -845,7 +845,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -845,7 +845,7 @@ ProcQueryTree(register ClientPtr client)
{ {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
DEALLOCATE_LOCAL(childIDs); free(childIDs);
} }
return(client->noClientException); return(client->noClientException);
...@@ -1336,7 +1336,7 @@ ProcQueryFont(register ClientPtr client) ...@@ -1336,7 +1336,7 @@ ProcQueryFont(register ClientPtr client)
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
nprotoxcistructs * sizeof(xCharInfo); nprotoxcistructs * sizeof(xCharInfo);
reply = (xQueryFontReply *)ALLOCATE_LOCAL(rlength); reply = (xQueryFontReply *)malloc(rlength);
if(!reply) if(!reply)
{ {
return(BadAlloc); return(BadAlloc);
...@@ -1349,7 +1349,7 @@ ProcQueryFont(register ClientPtr client) ...@@ -1349,7 +1349,7 @@ ProcQueryFont(register ClientPtr client)
QueryFont( pFont, reply, nprotoxcistructs); QueryFont( pFont, reply, nprotoxcistructs);
WriteReplyToClient(client, rlength, reply); WriteReplyToClient(client, rlength, reply);
DEALLOCATE_LOCAL(reply); free(reply);
return(client->noClientException); return(client->noClientException);
} }
} }
...@@ -2182,7 +2182,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2182,7 +2182,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
length += widthBytesLine; length += widthBytesLine;
} }
} }
if(!(pBuf = (char *) ALLOCATE_LOCAL(length))) if(!(pBuf = (char *) malloc(length)))
return (BadAlloc); return (BadAlloc);
memset(pBuf, 0, length); memset(pBuf, 0, length);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
...@@ -2292,7 +2292,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ...@@ -2292,7 +2292,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
RegionDestroy(pVisibleRegion); RegionDestroy(pVisibleRegion);
#endif #endif
if (!im_return) if (!im_return)
DEALLOCATE_LOCAL(pBuf); free(pBuf);
return (client->noClientException); return (client->noClientException);
} }
...@@ -2552,7 +2552,7 @@ ProcListInstalledColormaps(register ClientPtr client) ...@@ -2552,7 +2552,7 @@ ProcListInstalledColormaps(register ClientPtr client)
return(BadWindow); return(BadWindow);
preply = (xListInstalledColormapsReply *) preply = (xListInstalledColormapsReply *)
ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) + malloc(sizeof(xListInstalledColormapsReply) +
pWin->drawable.pScreen->maxInstalledCmaps * pWin->drawable.pScreen->maxInstalledCmaps *
sizeof(Colormap)); sizeof(Colormap));
if(!preply) if(!preply)
...@@ -2567,7 +2567,7 @@ ProcListInstalledColormaps(register ClientPtr client) ...@@ -2567,7 +2567,7 @@ ProcListInstalledColormaps(register ClientPtr client)
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply); WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]); WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
DEALLOCATE_LOCAL(preply); free(preply);
return(client->noClientException); return(client->noClientException);
} }
...@@ -2695,7 +2695,7 @@ ProcAllocColorCells (register ClientPtr client) ...@@ -2695,7 +2695,7 @@ ProcAllocColorCells (register ClientPtr client)
} }
nmasks = stuff->planes; nmasks = stuff->planes;
length = ((long)npixels + (long)nmasks) * sizeof(Pixel); length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
ppixels = (Pixel *)ALLOCATE_LOCAL(length); ppixels = (Pixel *)malloc(length);
if(!ppixels) if(!ppixels)
return(BadAlloc); return(BadAlloc);
pmasks = ppixels + npixels; pmasks = ppixels + npixels;
...@@ -2703,7 +2703,7 @@ ProcAllocColorCells (register ClientPtr client) ...@@ -2703,7 +2703,7 @@ ProcAllocColorCells (register ClientPtr client)
if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks, if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks,
(Bool)stuff->contiguous, ppixels, pmasks)) ) (Bool)stuff->contiguous, ppixels, pmasks)) )
{ {
DEALLOCATE_LOCAL(ppixels); free(ppixels);
if (client->noClientException != Success) if (client->noClientException != Success)
return(client->noClientException); return(client->noClientException);
else else
...@@ -2722,7 +2722,7 @@ ProcAllocColorCells (register ClientPtr client) ...@@ -2722,7 +2722,7 @@ ProcAllocColorCells (register ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels); WriteSwappedDataToClient(client, length, ppixels);
} }
DEALLOCATE_LOCAL(ppixels); free(ppixels);
return (client->noClientException); return (client->noClientException);
} }
else else
...@@ -2763,7 +2763,7 @@ ProcAllocColorPlanes(register ClientPtr client) ...@@ -2763,7 +2763,7 @@ ProcAllocColorPlanes(register ClientPtr client)
acpr.sequenceNumber = client->sequence; acpr.sequenceNumber = client->sequence;
acpr.nPixels = npixels; acpr.nPixels = npixels;
length = (long)npixels * sizeof(Pixel); length = (long)npixels * sizeof(Pixel);
ppixels = (Pixel *)ALLOCATE_LOCAL(length); ppixels = (Pixel *)malloc(length);
if(!ppixels) if(!ppixels)
return(BadAlloc); return(BadAlloc);
if( (retval = AllocColorPlanes(client->index, pcmp, npixels, if( (retval = AllocColorPlanes(client->index, pcmp, npixels,
...@@ -2771,7 +2771,7 @@ ProcAllocColorPlanes(register ClientPtr client) ...@@ -2771,7 +2771,7 @@ ProcAllocColorPlanes(register ClientPtr client)
(Bool)stuff->contiguous, ppixels, (Bool)stuff->contiguous, ppixels,
&acpr.redMask, &acpr.greenMask, &acpr.blueMask)) ) &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
{ {
DEALLOCATE_LOCAL(ppixels); free(ppixels);
if (client->noClientException != Success) if (client->noClientException != Success)
return(client->noClientException); return(client->noClientException);
else else
...@@ -2786,7 +2786,7 @@ ProcAllocColorPlanes(register ClientPtr client) ...@@ -2786,7 +2786,7 @@ ProcAllocColorPlanes(register ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels); WriteSwappedDataToClient(client, length, ppixels);
} }
DEALLOCATE_LOCAL(ppixels); free(ppixels);
return (client->noClientException); return (client->noClientException);
} }
else else
...@@ -2915,13 +2915,13 @@ ProcQueryColors(register ClientPtr client) ...@@ -2915,13 +2915,13 @@ ProcQueryColors(register ClientPtr client)
xQueryColorsReply qcr; xQueryColorsReply qcr;
count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2; count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2;
prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb)); prgbs = (xrgb *)malloc(count * sizeof(xrgb));
if(!prgbs && count) if(!prgbs && count)
return(BadAlloc); return(BadAlloc);
memset(prgbs, 0, count * sizeof(xrgb)); memset(prgbs, 0, count * sizeof(xrgb));
if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
{ {
if (prgbs) DEALLOCATE_LOCAL(prgbs); if (prgbs) free(prgbs);
if (client->noClientException != Success) if (client->noClientException != Success)
return(client->noClientException); return(client->noClientException);
else else
...@@ -2942,7 +2942,7 @@ ProcQueryColors(register ClientPtr client) ...@@ -2942,7 +2942,7 @@ ProcQueryColors(register ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs); WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
} }
if (prgbs) DEALLOCATE_LOCAL(prgbs); if (prgbs) free(prgbs);
return(client->noClientException); return(client->noClientException);
} }
......
...@@ -793,7 +793,7 @@ finish: ...@@ -793,7 +793,7 @@ finish:
reply.nFonts = nnames; reply.nFonts = nnames;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
bufptr = bufferStart = (char *) ALLOCATE_LOCAL(reply.length << 2); bufptr = bufferStart = (char *) malloc(reply.length << 2);
if (!bufptr && reply.length) { if (!bufptr && reply.length) {
SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
...@@ -818,7 +818,7 @@ finish: ...@@ -818,7 +818,7 @@ finish:
client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
WriteToClient(client, stringLens + nnames, bufferStart); WriteToClient(client, stringLens + nnames, bufferStart);
DEALLOCATE_LOCAL(bufferStart); free(bufferStart);
bail: bail:
if (c->slept) if (c->slept)
...@@ -1861,7 +1861,7 @@ SetDefaultFontPath(char *path) ...@@ -1861,7 +1861,7 @@ SetDefaultFontPath(char *path)
/* get enough for string, plus values -- use up commas */ /* get enough for string, plus values -- use up commas */
len = strlen(temp_path) + 1; len = strlen(temp_path) + 1;
nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); nump = cp = newpath = (unsigned char *) malloc(len);
if (!newpath) { if (!newpath) {
free(temp_path); free(temp_path);
return BadAlloc; return BadAlloc;
...@@ -1884,7 +1884,7 @@ SetDefaultFontPath(char *path) ...@@ -1884,7 +1884,7 @@ SetDefaultFontPath(char *path)
err = SetFontPathElements(num, newpath, &bad, TRUE); err = SetFontPathElements(num, newpath, &bad, TRUE);
DEALLOCATE_LOCAL(newpath); free(newpath);
free(temp_path); free(temp_path);
return err; return err;
......
...@@ -358,7 +358,7 @@ ProcListExtensions(ClientPtr client) ...@@ -358,7 +358,7 @@ ProcListExtensions(ClientPtr client)
total_length += strlen(extensions[i]->aliases[j]) + 1; total_length += strlen(extensions[i]->aliases[j]) + 1;
} }
reply.length = (total_length + 3) >> 2; reply.length = (total_length + 3) >> 2;
buffer = bufptr = (char *)ALLOCATE_LOCAL(total_length); buffer = bufptr = (char *)malloc(total_length);
if (!buffer) if (!buffer)
return(BadAlloc); return(BadAlloc);
for (i=0; i<NumExtensions; i++) for (i=0; i<NumExtensions; i++)
...@@ -384,7 +384,7 @@ ProcListExtensions(ClientPtr client) ...@@ -384,7 +384,7 @@ ProcListExtensions(ClientPtr client)
if (reply.length) if (reply.length)
{ {
WriteToClient(client, total_length, buffer); WriteToClient(client, total_length, buffer);
DEALLOCATE_LOCAL(buffer); free(buffer);
} }
return(client->noClientException); return(client->noClientException);
} }
......
...@@ -321,16 +321,16 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) ...@@ -321,16 +321,16 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
i++; i++;
if (!i) if (!i)
return TRUE; return TRUE;
deletes = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr)); deletes = (GrabPtr *)malloc(i * sizeof(GrabPtr));
adds = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr)); adds = (GrabPtr *)malloc(i * sizeof(GrabPtr));
updates = (Mask ***)ALLOCATE_LOCAL(i * sizeof(Mask **)); updates = (Mask ***)malloc(i * sizeof(Mask **));
details = (Mask **)ALLOCATE_LOCAL(i * sizeof(Mask *)); details = (Mask **)malloc(i * sizeof(Mask *));
if (!deletes || !adds || !updates || !details) if (!deletes || !adds || !updates || !details)
{ {
if (details) DEALLOCATE_LOCAL(details); if (details) free(details);
if (updates) DEALLOCATE_LOCAL(updates); if (updates) free(updates);
if (adds) DEALLOCATE_LOCAL(adds); if (adds) free(adds);
if (deletes) DEALLOCATE_LOCAL(deletes); if (deletes) free(deletes);
return FALSE; return FALSE;
} }
ndels = nadds = nups = 0; ndels = nadds = nups = 0;
...@@ -425,10 +425,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) ...@@ -425,10 +425,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
*updates[i] = details[i]; *updates[i] = details[i];
} }
} }
DEALLOCATE_LOCAL(details); free(details);
DEALLOCATE_LOCAL(updates); free(updates);
DEALLOCATE_LOCAL(adds); free(adds);
DEALLOCATE_LOCAL(deletes); free(deletes);
return ok; return ok;
#undef UPDATE #undef UPDATE
......
...@@ -111,7 +111,7 @@ ProcRotateProperties(ClientPtr client) ...@@ -111,7 +111,7 @@ ProcRotateProperties(ClientPtr client)
if (!stuff->nAtoms) if (!stuff->nAtoms)
return(Success); return(Success);
atoms = (Atom *) & stuff[1]; atoms = (Atom *) & stuff[1];
props = (PropertyPtr *)ALLOCATE_LOCAL(stuff->nAtoms * sizeof(PropertyPtr)); props = (PropertyPtr *)malloc(stuff->nAtoms * sizeof(PropertyPtr));
if (!props) if (!props)
return(BadAlloc); return(BadAlloc);
for (i = 0; i < stuff->nAtoms; i++) for (i = 0; i < stuff->nAtoms; i++)
...@@ -126,21 +126,21 @@ ProcRotateProperties(ClientPtr client) ...@@ -126,21 +126,21 @@ ProcRotateProperties(ClientPtr client)
#endif #endif
) )
{ {
DEALLOCATE_LOCAL(props); free(props);
client->errorValue = atoms[i]; client->errorValue = atoms[i];
return BadAtom; return BadAtom;
} }
#ifdef XCSECURITY #ifdef XCSECURITY
if (SecurityIgnoreOperation == action) if (SecurityIgnoreOperation == action)
{ {
DEALLOCATE_LOCAL(props); free(props);
return Success; return Success;
} }
#endif #endif
for (j = i + 1; j < stuff->nAtoms; j++) for (j = i + 1; j < stuff->nAtoms; j++)
if (atoms[j] == atoms[i]) if (atoms[j] == atoms[i])
{ {
DEALLOCATE_LOCAL(props); free(props);
return BadMatch; return BadMatch;
} }
pProp = wUserProps (pWin); pProp = wUserProps (pWin);
...@@ -150,7 +150,7 @@ ProcRotateProperties(ClientPtr client) ...@@ -150,7 +150,7 @@ ProcRotateProperties(ClientPtr client)
goto found; goto found;
pProp = pProp->next; pProp = pProp->next;
} }
DEALLOCATE_LOCAL(props); free(props);
return BadMatch; return BadMatch;
found: found:
props[i] = pProp; props[i] = pProp;
...@@ -181,7 +181,7 @@ found: ...@@ -181,7 +181,7 @@ found:
props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms]; props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
} }
} }
DEALLOCATE_LOCAL(props); free(props);
return Success; return Success;
} }
...@@ -630,7 +630,7 @@ ProcListProperties(ClientPtr client) ...@@ -630,7 +630,7 @@ ProcListProperties(ClientPtr client)
numProps++; numProps++;
} }
if (numProps) if (numProps)
if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom)))) if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom))))
return(BadAlloc); return(BadAlloc);
memset(&xlpr, 0, sizeof(xListPropertiesReply)); memset(&xlpr, 0, sizeof(xListPropertiesReply));
...@@ -650,7 +650,7 @@ ProcListProperties(ClientPtr client) ...@@ -650,7 +650,7 @@ ProcListProperties(ClientPtr client)
{ {
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
DEALLOCATE_LOCAL(pAtoms); free(pAtoms);
} }
return(client->noClientException); return(client->noClientException);
} }
......
...@@ -470,13 +470,13 @@ RebuildTable(int client) ...@@ -470,13 +470,13 @@ RebuildTable(int client)
*/ */
j = 2 * clientTable[client].buckets; j = 2 * clientTable[client].buckets;
tails = (ResourcePtr **)ALLOCATE_LOCAL(j * sizeof(ResourcePtr *)); tails = (ResourcePtr **)malloc(j * sizeof(ResourcePtr *));
if (!tails) if (!tails)
return; return;
resources = (ResourcePtr *)malloc(j * sizeof(ResourcePtr)); resources = (ResourcePtr *)malloc(j * sizeof(ResourcePtr));
if (!resources) if (!resources)
{ {
DEALLOCATE_LOCAL(tails); free(tails);
return; return;
} }
for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
...@@ -499,7 +499,7 @@ RebuildTable(int client) ...@@ -499,7 +499,7 @@ RebuildTable(int client)
*tptr = &res->next; *tptr = &res->next;
} }
} }
DEALLOCATE_LOCAL(tails); free(tails);
clientTable[client].buckets *= 2; clientTable[client].buckets *= 2;
free(clientTable[client].resources); free(clientTable[client].resources);
clientTable[client].resources = resources; clientTable[client].resources = resources;
......
...@@ -98,7 +98,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) ...@@ -98,7 +98,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
CARD32 tmpbuf[1]; CARD32 tmpbuf[1];
/* Allocate as big a buffer as we can... */ /* Allocate as big a buffer as we can... */
while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize))) while (!(pbufT = (CARD32 *) malloc(bufsize)))
{ {
bufsize >>= 1; bufsize >>= 1;
if (bufsize == 4) if (bufsize == 4)
...@@ -130,7 +130,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) ...@@ -130,7 +130,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
} }
if (pbufT != tmpbuf) if (pbufT != tmpbuf)
DEALLOCATE_LOCAL ((char *) pbufT); free ((char *) pbufT);
} }
/** /**
...@@ -146,7 +146,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) ...@@ -146,7 +146,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
short tmpbuf[2]; short tmpbuf[2];
/* Allocate as big a buffer as we can... */ /* Allocate as big a buffer as we can... */
while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize))) while (!(pbufT = (short *) malloc(bufsize)))
{ {
bufsize >>= 1; bufsize >>= 1;
if (bufsize == 4) if (bufsize == 4)
...@@ -178,7 +178,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) ...@@ -178,7 +178,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
} }
if (pbufT != tmpbuf) if (pbufT != tmpbuf)
DEALLOCATE_LOCAL ((char *) pbufT); free ((char *) pbufT);
} }
...@@ -1137,7 +1137,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) ...@@ -1137,7 +1137,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
{ {
char *pInfoTBase; char *pInfoTBase;
pInfoTBase = (char *) ALLOCATE_LOCAL(size); pInfoTBase = (char *) malloc(size);
if (!pInfoTBase) if (!pInfoTBase)
{ {
pClient->noClientException = -1; pClient->noClientException = -1;
...@@ -1145,7 +1145,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) ...@@ -1145,7 +1145,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
} }
SwapConnSetupInfo(pInfo, pInfoTBase); SwapConnSetupInfo(pInfo, pInfoTBase);
WriteToClient(pClient, (int)size, pInfoTBase); WriteToClient(pClient, (int)size, pInfoTBase);
DEALLOCATE_LOCAL(pInfoTBase); free(pInfoTBase);
} }
void void
......
...@@ -298,7 +298,7 @@ fbCopyRegion (DrawablePtr pSrcDrawable, ...@@ -298,7 +298,7 @@ fbCopyRegion (DrawablePtr pSrcDrawable,
if (nbox > 1) if (nbox > 1)
{ {
/* keep ordering in each band, reverse order of bands */ /* keep ordering in each band, reverse order of bands */
pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
if(!pboxNew1) if(!pboxNew1)
return; return;
pboxBase = pboxNext = pbox+nbox-1; pboxBase = pboxNext = pbox+nbox-1;
...@@ -335,11 +335,11 @@ fbCopyRegion (DrawablePtr pSrcDrawable, ...@@ -335,11 +335,11 @@ fbCopyRegion (DrawablePtr pSrcDrawable,
if (nbox > 1) if (nbox > 1)
{ {
/* reverse order of rects in each band */ /* reverse order of rects in each band */
pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
if(!pboxNew2) if(!pboxNew2)
{ {
if (pboxNew1) if (pboxNew1)
DEALLOCATE_LOCAL(pboxNew1); free(pboxNew1);
return; return;
} }
pboxBase = pboxNext = pbox; pboxBase = pboxNext = pbox;
...@@ -374,9 +374,9 @@ fbCopyRegion (DrawablePtr pSrcDrawable, ...@@ -374,9 +374,9 @@ fbCopyRegion (DrawablePtr pSrcDrawable,
reverse, upsidedown, bitPlane, closure); reverse, upsidedown, bitPlane, closure);
if (pboxNew1) if (pboxNew1)
DEALLOCATE_LOCAL (pboxNew1); free (pboxNew1);
if (pboxNew2) if (pboxNew2)
DEALLOCATE_LOCAL (pboxNew2); free (pboxNew2);
} }
RegionPtr RegionPtr
......
...@@ -112,7 +112,7 @@ damageText (DrawablePtr pDrawable, ...@@ -112,7 +112,7 @@ damageText (DrawablePtr pDrawable,
imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
charinfo = (CharInfoPtr *) ALLOCATE_LOCAL(count * sizeof(CharInfoPtr)); charinfo = (CharInfoPtr *) malloc(count * sizeof(CharInfoPtr));
if (!charinfo) if (!charinfo)
return x; return x;
...@@ -139,7 +139,7 @@ damageText (DrawablePtr pDrawable, ...@@ -139,7 +139,7 @@ damageText (DrawablePtr pDrawable,
#endif #endif
} }
DEALLOCATE_LOCAL(charinfo); free(charinfo);
return x + w; return x + w;
} }
......
...@@ -274,7 +274,7 @@ Dispatch(void) ...@@ -274,7 +274,7 @@ Dispatch(void)
#endif #endif
clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients); clientReady = (int *) malloc(sizeof(int) * MaxClients);
if (!clientReady) if (!clientReady)
return; return;
...@@ -571,7 +571,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio ...@@ -571,7 +571,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
saveAgentState("TERMINATED"); saveAgentState("TERMINATED");
KillAllClients(); KillAllClients();
DEALLOCATE_LOCAL(clientReady); free(clientReady);
dispatchException &= ~DE_RESET; dispatchException &= ~DE_RESET;
} }
...@@ -653,7 +653,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -653,7 +653,7 @@ ProcQueryTree(register ClientPtr client)
{ {
int curChild = 0; int curChild = 0;
childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window)); childIDs = (Window *) malloc(numChildren * sizeof(Window));
if (!childIDs) if (!childIDs)
return BadAlloc; return BadAlloc;
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
...@@ -673,7 +673,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -673,7 +673,7 @@ ProcQueryTree(register ClientPtr client)
{ {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
DEALLOCATE_LOCAL(childIDs); free(childIDs);
} }
return(client->noClientException); return(client->noClientException);
......
...@@ -564,7 +564,7 @@ finish: ...@@ -564,7 +564,7 @@ finish:
reply.nFonts = nnames; reply.nFonts = nnames;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
bufptr = bufferStart = (char *) ALLOCATE_LOCAL(reply.length << 2); bufptr = bufferStart = (char *) malloc(reply.length << 2);
if (!bufptr && reply.length) { if (!bufptr && reply.length) {
SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
...@@ -607,7 +607,7 @@ finish: ...@@ -607,7 +607,7 @@ finish:
client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
WriteToClient(client, stringLens + nnames, bufferStart); WriteToClient(client, stringLens + nnames, bufferStart);
DEALLOCATE_LOCAL(bufferStart); free(bufferStart);
bail: bail:
if (c->slept) if (c->slept)
...@@ -968,7 +968,7 @@ SetDefaultFontPath(char *path) ...@@ -968,7 +968,7 @@ SetDefaultFontPath(char *path)
/* get enough for string, plus values -- use up commas */ /* get enough for string, plus values -- use up commas */
len = strlen(temp_path) + 1; len = strlen(temp_path) + 1;
nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); nump = cp = newpath = (unsigned char *) malloc(len);
if (!newpath) { if (!newpath) {
free(temp_path); free(temp_path);
return BadAlloc; return BadAlloc;
...@@ -991,7 +991,7 @@ SetDefaultFontPath(char *path) ...@@ -991,7 +991,7 @@ SetDefaultFontPath(char *path)
err = SetFontPathElements(num, newpath, &bad, TRUE); err = SetFontPathElements(num, newpath, &bad, TRUE);
DEALLOCATE_LOCAL(newpath); free(newpath);
free(temp_path); free(temp_path);
return err; return err;
......
...@@ -163,7 +163,7 @@ ProcListExtensions(ClientPtr client) ...@@ -163,7 +163,7 @@ ProcListExtensions(ClientPtr client)
total_length += strlen(extensions[i]->aliases[j]) + 1; total_length += strlen(extensions[i]->aliases[j]) + 1;
} }
reply.length = (total_length + 3) >> 2; reply.length = (total_length + 3) >> 2;
buffer = bufptr = (char *)ALLOCATE_LOCAL(total_length); buffer = bufptr = (char *)malloc(total_length);
if (!buffer) if (!buffer)
return(BadAlloc); return(BadAlloc);
for (i=0; i<NumExtensions; i++) for (i=0; i<NumExtensions; i++)
...@@ -189,7 +189,7 @@ ProcListExtensions(ClientPtr client) ...@@ -189,7 +189,7 @@ ProcListExtensions(ClientPtr client)
if (reply.length) if (reply.length)
{ {
WriteToClient(client, total_length, buffer); WriteToClient(client, total_length, buffer);
DEALLOCATE_LOCAL(buffer); free(buffer);
} }
return(client->noClientException); return(client->noClientException);
} }
...@@ -566,7 +566,7 @@ int what; ...@@ -566,7 +566,7 @@ int what;
} }
} }
prect = (xRectangle *)ALLOCATE_LOCAL(RegionNumRects(prgn) * prect = (xRectangle *)malloc(RegionNumRects(prgn) *
sizeof(xRectangle)); sizeof(xRectangle));
if (!prect) if (!prect)
return; return;
...@@ -591,7 +591,7 @@ int what; ...@@ -591,7 +591,7 @@ int what;
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
if (!pGC) if (!pGC)
{ {
DEALLOCATE_LOCAL(prect); free(prect);
return; return;
} }
/* /*
...@@ -723,7 +723,7 @@ int what; ...@@ -723,7 +723,7 @@ int what;
} }
prect -= numRects; prect -= numRects;
(*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);
DEALLOCATE_LOCAL(prect); free(prect);
if (pWin->backStorage) if (pWin->backStorage)
(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing);
......
...@@ -987,7 +987,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -987,7 +987,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
glyphsBase = glyphsLocal; glyphsBase = glyphsLocal;
else else
{ {
glyphsBase = (GlyphPtr *) ALLOCATE_LOCAL (nglyph * sizeof (GlyphPtr)); glyphsBase = (GlyphPtr *) malloc (nglyph * sizeof (GlyphPtr));
if (!glyphsBase) if (!glyphsBase)
return BadAlloc; return BadAlloc;
} }
...@@ -995,7 +995,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -995,7 +995,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
listsBase = listsLocal; listsBase = listsLocal;
else else
{ {
listsBase = (GlyphListPtr) ALLOCATE_LOCAL (nlist * sizeof (GlyphListRec)); listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec));
if (!listsBase) if (!listsBase)
return BadAlloc; return BadAlloc;
} }
...@@ -1031,9 +1031,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1031,9 +1031,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
{ {
client->errorValue = gs; client->errorValue = gs;
if (glyphsBase != glyphsLocal) if (glyphsBase != glyphsLocal)
DEALLOCATE_LOCAL (glyphsBase); free (glyphsBase);
if (listsBase != listsLocal) if (listsBase != listsLocal)
DEALLOCATE_LOCAL (listsBase); free (listsBase);
return RenderErrBase + BadGlyphSet; return RenderErrBase + BadGlyphSet;
} }
} }
...@@ -1140,9 +1140,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1140,9 +1140,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
nxagentGlyphsExtents = NullBox; nxagentGlyphsExtents = NullBox;
if (glyphsBase != glyphsLocal) if (glyphsBase != glyphsLocal)
DEALLOCATE_LOCAL (glyphsBase); free (glyphsBase);
if (listsBase != listsLocal) if (listsBase != listsLocal)
DEALLOCATE_LOCAL (listsBase); free (listsBase);
free(elementsBase); free(elementsBase);
......
...@@ -50,9 +50,6 @@ SOFTWARE. ...@@ -50,9 +50,6 @@ SOFTWARE.
#define OS_H #define OS_H
#include "misc.h" #include "misc.h"
#define ALLOCATE_LOCAL_FALLBACK(_size) malloc((unsigned long)(_size))
#define DEALLOCATE_LOCAL_FALLBACK(_ptr) free((void *)(_ptr))
#include <nx-X11/Xalloca.h>
#include <stdarg.h> #include <stdarg.h>
#define NullFID ((FID) 0) #define NullFID ((FID) 0)
......
...@@ -954,14 +954,14 @@ miFillWideEllipse( ...@@ -954,14 +954,14 @@ miFillWideEllipse(
yorgu = parc->height + pGC->lineWidth; yorgu = parc->height + pGC->lineWidth;
n = (sizeof(int) * 2) * yorgu; n = (sizeof(int) * 2) * yorgu;
widths = (int *)ALLOCATE_LOCAL(n + (sizeof(DDXPointRec) * 2) * yorgu); widths = (int *)malloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
if (!widths) if (!widths)
return; return;
points = (DDXPointPtr)((char *)widths + n); points = (DDXPointPtr)((char *)widths + n);
spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree); spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree);
if (!spdata) if (!spdata)
{ {
DEALLOCATE_LOCAL(widths); free(widths);
return; return;
} }
pts = points; pts = points;
...@@ -1054,7 +1054,7 @@ miFillWideEllipse( ...@@ -1054,7 +1054,7 @@ miFillWideEllipse(
free(spdata); free(spdata);
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); free(widths);
} }
/* /*
...@@ -1927,13 +1927,13 @@ miComputeArcs ( ...@@ -1927,13 +1927,13 @@ miComputeArcs (
isDoubleDash = (pGC->lineStyle == LineDoubleDash); isDoubleDash = (pGC->lineStyle == LineDoubleDash);
dashOffset = pGC->dashOffset; dashOffset = pGC->dashOffset;
data = (struct arcData *) ALLOCATE_LOCAL (narcs * sizeof (struct arcData)); data = (struct arcData *) malloc (narcs * sizeof (struct arcData));
if (!data) if (!data)
return (miPolyArcPtr)NULL; return (miPolyArcPtr)NULL;
arcs = (miPolyArcPtr) malloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1)); arcs = (miPolyArcPtr) malloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
if (!arcs) if (!arcs)
{ {
DEALLOCATE_LOCAL(data); free(data);
return (miPolyArcPtr)NULL; return (miPolyArcPtr)NULL;
} }
for (i = 0; i < narcs; i++) { for (i = 0; i < narcs; i++) {
...@@ -2282,11 +2282,11 @@ miComputeArcs ( ...@@ -2282,11 +2282,11 @@ miComputeArcs (
arcs[iphase].arcs[arcs[iphase].narcs-1].cap = arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
arcs[iphase].ncaps; arcs[iphase].ncaps;
} }
DEALLOCATE_LOCAL(data); free(data);
return arcs; return arcs;
arcfail: arcfail:
miFreeArcs(arcs, pGC); miFreeArcs(arcs, pGC);
DEALLOCATE_LOCAL(data); free(data);
return (miPolyArcPtr)NULL; return (miPolyArcPtr)NULL;
} }
...@@ -3190,8 +3190,8 @@ fillSpans ( ...@@ -3190,8 +3190,8 @@ fillSpans (
if (nspans == 0) if (nspans == 0)
return; return;
xSpan = xSpans = (DDXPointPtr) ALLOCATE_LOCAL (nspans * sizeof (DDXPointRec)); xSpan = xSpans = (DDXPointPtr) malloc (nspans * sizeof (DDXPointRec));
xWidth = xWidths = (int *) ALLOCATE_LOCAL (nspans * sizeof (int)); xWidth = xWidths = (int *) malloc (nspans * sizeof (int));
if (xSpans && xWidths) if (xSpans && xWidths)
{ {
i = 0; i = 0;
...@@ -3211,9 +3211,9 @@ fillSpans ( ...@@ -3211,9 +3211,9 @@ fillSpans (
} }
disposeFinalSpans (); disposeFinalSpans ();
if (xSpans) if (xSpans)
DEALLOCATE_LOCAL (xSpans); free (xSpans);
if (xWidths) if (xWidths)
DEALLOCATE_LOCAL (xWidths); free (xWidths);
finalMiny = 0; finalMiny = 0;
finalMaxy = -1; finalMaxy = -1;
finalSize = 0; finalSize = 0;
......
...@@ -143,21 +143,21 @@ miCopyArea(pSrcDrawable, pDstDrawable, ...@@ -143,21 +143,21 @@ miCopyArea(pSrcDrawable, pDstDrawable,
} }
pptFirst = ppt = (DDXPointPtr) pptFirst = ppt = (DDXPointPtr)
ALLOCATE_LOCAL(heightSrc * sizeof(DDXPointRec)); malloc(heightSrc * sizeof(DDXPointRec));
pwidthFirst = pwidth = (unsigned int *) pwidthFirst = pwidth = (unsigned int *)
ALLOCATE_LOCAL(heightSrc * sizeof(unsigned int)); malloc(heightSrc * sizeof(unsigned int));
numRects = RegionNumRects(prgnSrcClip); numRects = RegionNumRects(prgnSrcClip);
boxes = RegionRects(prgnSrcClip); boxes = RegionRects(prgnSrcClip);
ordering = (unsigned int *) ordering = (unsigned int *)
ALLOCATE_LOCAL(numRects * sizeof(unsigned int)); malloc(numRects * sizeof(unsigned int));
if(!pptFirst || !pwidthFirst || !ordering) if(!pptFirst || !pwidthFirst || !ordering)
{ {
if (ordering) if (ordering)
DEALLOCATE_LOCAL(ordering); free(ordering);
if (pwidthFirst) if (pwidthFirst)
DEALLOCATE_LOCAL(pwidthFirst); free(pwidthFirst);
if (pptFirst) if (pptFirst)
DEALLOCATE_LOCAL(pptFirst); free(pptFirst);
return (RegionPtr)NULL; return (RegionPtr)NULL;
} }
...@@ -264,9 +264,9 @@ miCopyArea(pSrcDrawable, pDstDrawable, ...@@ -264,9 +264,9 @@ miCopyArea(pSrcDrawable, pDstDrawable,
if(realSrcClip) if(realSrcClip)
RegionDestroy(prgnSrcClip); RegionDestroy(prgnSrcClip);
DEALLOCATE_LOCAL(ordering); free(ordering);
DEALLOCATE_LOCAL(pwidthFirst); free(pwidthFirst);
DEALLOCATE_LOCAL(pptFirst); free(pptFirst);
return prgnExposed; return prgnExposed;
} }
...@@ -436,12 +436,12 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) ...@@ -436,12 +436,12 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty)
dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv); dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv);
ValidateGC((DrawablePtr)pPixmap, pGCT); ValidateGC((DrawablePtr)pPixmap, pGCT);
miClearDrawable((DrawablePtr)pPixmap, pGCT); miClearDrawable((DrawablePtr)pPixmap, pGCT);
ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); ppt = pptFirst = (DDXPointPtr)malloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); pwidth = pwidthFirst = (int *)malloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst); if (pwidthFirst) free(pwidthFirst);
if (pptFirst) DEALLOCATE_LOCAL(pptFirst); if (pptFirst) free(pptFirst);
FreeScratchGC(pGCT); FreeScratchGC(pGCT);
return; return;
} }
...@@ -467,8 +467,8 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) ...@@ -467,8 +467,8 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty)
(*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits, (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits,
pptFirst, pwidthFirst, h, TRUE); pptFirst, pwidthFirst, h, TRUE);
DEALLOCATE_LOCAL(pwidthFirst); free(pwidthFirst);
DEALLOCATE_LOCAL(pptFirst); free(pptFirst);
/* Save current values from the client GC */ /* Save current values from the client GC */
...@@ -810,14 +810,14 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) ...@@ -810,14 +810,14 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
break; break;
case ZPixmap: case ZPixmap:
ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); ppt = pptFirst = (DDXPointPtr)malloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); pwidth = pwidthFirst = (int *)malloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst) if (pwidthFirst)
DEALLOCATE_LOCAL(pwidthFirst); free(pwidthFirst);
if (pptFirst) if (pptFirst)
DEALLOCATE_LOCAL(pptFirst); free(pptFirst);
return; return;
} }
if (pGC->miTranslate) if (pGC->miTranslate)
...@@ -836,8 +836,8 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) ...@@ -836,8 +836,8 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
(*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst, (*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst,
pwidthFirst, h, TRUE); pwidthFirst, h, TRUE);
DEALLOCATE_LOCAL(pwidthFirst); free(pwidthFirst);
DEALLOCATE_LOCAL(pptFirst); free(pptFirst);
break; break;
} }
} }
...@@ -963,8 +963,8 @@ miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ...@@ -963,8 +963,8 @@ miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
PROLOGUE(pGC); PROLOGUE(pGC);
pptCopy = (DDXPointPtr)ALLOCATE_LOCAL(nInit*sizeof(DDXPointRec)); pptCopy = (DDXPointPtr)malloc(nInit*sizeof(DDXPointRec));
pwidthCopy=(int *)ALLOCATE_LOCAL(nInit*sizeof(int)); pwidthCopy=(int *)malloc(nInit*sizeof(int));
if (pptCopy && pwidthCopy) if (pptCopy && pwidthCopy)
{ {
copyData(pptInit, pptCopy, nInit, MoreCopy0); copyData(pptInit, pptCopy, nInit, MoreCopy0);
...@@ -992,8 +992,8 @@ miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ...@@ -992,8 +992,8 @@ miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
pBackingGC, nInit, pptCopy, pwidthCopy, pBackingGC, nInit, pptCopy, pwidthCopy,
fSorted); fSorted);
} }
if (pwidthCopy) DEALLOCATE_LOCAL(pwidthCopy); if (pwidthCopy) free(pwidthCopy);
if (pptCopy) DEALLOCATE_LOCAL(pptCopy); if (pptCopy) free(pptCopy);
EPILOGUE (pGC); EPILOGUE (pGC);
} }
...@@ -1026,8 +1026,8 @@ miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) ...@@ -1026,8 +1026,8 @@ miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted)
PROLOGUE(pGC); PROLOGUE(pGC);
pptCopy = (DDXPointPtr)ALLOCATE_LOCAL(nspans*sizeof(DDXPointRec)); pptCopy = (DDXPointPtr)malloc(nspans*sizeof(DDXPointRec));
pwidthCopy=(int *)ALLOCATE_LOCAL(nspans*sizeof(int)); pwidthCopy=(int *)malloc(nspans*sizeof(int));
if (pptCopy && pwidthCopy) if (pptCopy && pwidthCopy)
{ {
copyData(ppt, pptCopy, nspans, MoreCopy0); copyData(ppt, pptCopy, nspans, MoreCopy0);
...@@ -1054,8 +1054,8 @@ miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) ...@@ -1054,8 +1054,8 @@ miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted)
(* pBackingGC->ops->SetSpans)(pBackingDrawable, pBackingGC, (* pBackingGC->ops->SetSpans)(pBackingDrawable, pBackingGC,
psrc, pptCopy, pwidthCopy, nspans, fSorted); psrc, pptCopy, pwidthCopy, nspans, fSorted);
} }
if (pwidthCopy) DEALLOCATE_LOCAL(pwidthCopy); if (pwidthCopy) free(pwidthCopy);
if (pptCopy) DEALLOCATE_LOCAL(pptCopy); if (pptCopy) free(pptCopy);
EPILOGUE (pGC); EPILOGUE (pGC);
} }
...@@ -1209,14 +1209,14 @@ miBSDoCopy( ...@@ -1209,14 +1209,14 @@ miBSDoCopy(
numRectsObs = RegionNumRects(pRgnObs); numRectsObs = RegionNumRects(pRgnObs);
nrects = numRectsExp + numRectsObs; nrects = numRectsExp + numRectsObs;
boxes = (struct BoxDraw *)ALLOCATE_LOCAL(nrects * sizeof(struct BoxDraw)); boxes = (struct BoxDraw *)malloc(nrects * sizeof(struct BoxDraw));
sequence = (int *) ALLOCATE_LOCAL(nrects * sizeof(int)); sequence = (int *) malloc(nrects * sizeof(int));
*ppRgn = NULL; *ppRgn = NULL;
if (!boxes || !sequence) if (!boxes || !sequence)
{ {
if (sequence) DEALLOCATE_LOCAL(sequence); if (sequence) free(sequence);
if (boxes) DEALLOCATE_LOCAL(boxes); if (boxes) free(boxes);
RegionDestroy(pRgnExp); RegionDestroy(pRgnExp);
RegionDestroy(pRgnObs); RegionDestroy(pRgnObs);
...@@ -1424,8 +1424,8 @@ miBSDoCopy( ...@@ -1424,8 +1424,8 @@ miBSDoCopy(
pBox->x1 + dx, pBox->y1 + dy, plane); pBox->x1 + dx, pBox->y1 + dy, plane);
} }
} }
DEALLOCATE_LOCAL(sequence); free(sequence);
DEALLOCATE_LOCAL(boxes); free(boxes);
pGC->graphicsExposures = graphicsExposures; pGC->graphicsExposures = graphicsExposures;
/* /*
...@@ -1720,7 +1720,7 @@ miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit) ...@@ -1720,7 +1720,7 @@ miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit)
PROLOGUE(pGC); PROLOGUE(pGC);
pptCopy = (xPoint *)ALLOCATE_LOCAL(npt*sizeof(xPoint)); pptCopy = (xPoint *)malloc(npt*sizeof(xPoint));
if (pptCopy) if (pptCopy)
{ {
copyPoints(pptInit, pptCopy, npt, mode); copyPoints(pptInit, pptCopy, npt, mode);
...@@ -1730,7 +1730,7 @@ miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit) ...@@ -1730,7 +1730,7 @@ miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit)
(* pBackingGC->ops->PolyPoint) (pBackingDrawable, (* pBackingGC->ops->PolyPoint) (pBackingDrawable,
pBackingGC, mode, npt, pptCopy); pBackingGC, mode, npt, pptCopy);
DEALLOCATE_LOCAL(pptCopy); free(pptCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -1760,7 +1760,7 @@ miBSPolylines (pDrawable, pGC, mode, npt, pptInit) ...@@ -1760,7 +1760,7 @@ miBSPolylines (pDrawable, pGC, mode, npt, pptInit)
PROLOGUE(pGC); PROLOGUE(pGC);
pptCopy = (DDXPointPtr)ALLOCATE_LOCAL(npt*sizeof(DDXPointRec)); pptCopy = (DDXPointPtr)malloc(npt*sizeof(DDXPointRec));
if (pptCopy) if (pptCopy)
{ {
copyPoints(pptInit, pptCopy, npt, mode); copyPoints(pptInit, pptCopy, npt, mode);
...@@ -1768,7 +1768,7 @@ miBSPolylines (pDrawable, pGC, mode, npt, pptInit) ...@@ -1768,7 +1768,7 @@ miBSPolylines (pDrawable, pGC, mode, npt, pptInit)
(* pGC->ops->Polylines)(pDrawable, pGC, mode, npt, pptInit); (* pGC->ops->Polylines)(pDrawable, pGC, mode, npt, pptInit);
(* pBackingGC->ops->Polylines)(pBackingDrawable, (* pBackingGC->ops->Polylines)(pBackingDrawable,
pBackingGC, mode, npt, pptCopy); pBackingGC, mode, npt, pptCopy);
DEALLOCATE_LOCAL(pptCopy); free(pptCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -1799,7 +1799,7 @@ miBSPolySegment(pDrawable, pGC, nseg, pSegs) ...@@ -1799,7 +1799,7 @@ miBSPolySegment(pDrawable, pGC, nseg, pSegs)
PROLOGUE(pGC); PROLOGUE(pGC);
pSegsCopy = (xSegment *)ALLOCATE_LOCAL(nseg*sizeof(xSegment)); pSegsCopy = (xSegment *)malloc(nseg*sizeof(xSegment));
if (pSegsCopy) if (pSegsCopy)
{ {
copyData(pSegs, pSegsCopy, nseg << 1, MoreCopy0); copyData(pSegs, pSegsCopy, nseg << 1, MoreCopy0);
...@@ -1808,7 +1808,7 @@ miBSPolySegment(pDrawable, pGC, nseg, pSegs) ...@@ -1808,7 +1808,7 @@ miBSPolySegment(pDrawable, pGC, nseg, pSegs)
(* pBackingGC->ops->PolySegment)(pBackingDrawable, (* pBackingGC->ops->PolySegment)(pBackingDrawable,
pBackingGC, nseg, pSegsCopy); pBackingGC, nseg, pSegsCopy);
DEALLOCATE_LOCAL(pSegsCopy); free(pSegsCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -1838,7 +1838,7 @@ miBSPolyRectangle(pDrawable, pGC, nrects, pRects) ...@@ -1838,7 +1838,7 @@ miBSPolyRectangle(pDrawable, pGC, nrects, pRects)
PROLOGUE(pGC); PROLOGUE(pGC);
pRectsCopy =(xRectangle *)ALLOCATE_LOCAL(nrects*sizeof(xRectangle)); pRectsCopy =(xRectangle *)malloc(nrects*sizeof(xRectangle));
if (pRectsCopy) if (pRectsCopy)
{ {
copyData(pRects, pRectsCopy, nrects, MoreCopy2); copyData(pRects, pRectsCopy, nrects, MoreCopy2);
...@@ -1847,7 +1847,7 @@ miBSPolyRectangle(pDrawable, pGC, nrects, pRects) ...@@ -1847,7 +1847,7 @@ miBSPolyRectangle(pDrawable, pGC, nrects, pRects)
(* pBackingGC->ops->PolyRectangle)(pBackingDrawable, (* pBackingGC->ops->PolyRectangle)(pBackingDrawable,
pBackingGC, nrects, pRectsCopy); pBackingGC, nrects, pRectsCopy);
DEALLOCATE_LOCAL(pRectsCopy); free(pRectsCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -1876,7 +1876,7 @@ miBSPolyArc(pDrawable, pGC, narcs, parcs) ...@@ -1876,7 +1876,7 @@ miBSPolyArc(pDrawable, pGC, narcs, parcs)
PROLOGUE(pGC); PROLOGUE(pGC);
pArcsCopy = (xArc *)ALLOCATE_LOCAL(narcs*sizeof(xArc)); pArcsCopy = (xArc *)malloc(narcs*sizeof(xArc));
if (pArcsCopy) if (pArcsCopy)
{ {
copyData(parcs, pArcsCopy, narcs, MoreCopy4); copyData(parcs, pArcsCopy, narcs, MoreCopy4);
...@@ -1885,7 +1885,7 @@ miBSPolyArc(pDrawable, pGC, narcs, parcs) ...@@ -1885,7 +1885,7 @@ miBSPolyArc(pDrawable, pGC, narcs, parcs)
(* pBackingGC->ops->PolyArc)(pBackingDrawable, pBackingGC, (* pBackingGC->ops->PolyArc)(pBackingDrawable, pBackingGC,
narcs, pArcsCopy); narcs, pArcsCopy);
DEALLOCATE_LOCAL(pArcsCopy); free(pArcsCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -1916,7 +1916,7 @@ miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts) ...@@ -1916,7 +1916,7 @@ miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts)
PROLOGUE(pGC); PROLOGUE(pGC);
pPtsCopy = (DDXPointPtr)ALLOCATE_LOCAL(count*sizeof(DDXPointRec)); pPtsCopy = (DDXPointPtr)malloc(count*sizeof(DDXPointRec));
if (pPtsCopy) if (pPtsCopy)
{ {
copyPoints(pPts, pPtsCopy, count, mode); copyPoints(pPts, pPtsCopy, count, mode);
...@@ -1925,7 +1925,7 @@ miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts) ...@@ -1925,7 +1925,7 @@ miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts)
pBackingGC, shape, mode, pBackingGC, shape, mode,
count, pPtsCopy); count, pPtsCopy);
DEALLOCATE_LOCAL(pPtsCopy); free(pPtsCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -1956,7 +1956,7 @@ miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit) ...@@ -1956,7 +1956,7 @@ miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
PROLOGUE(pGC); PROLOGUE(pGC);
pRectCopy = pRectCopy =
(xRectangle *)ALLOCATE_LOCAL(nrectFill*sizeof(xRectangle)); (xRectangle *)malloc(nrectFill*sizeof(xRectangle));
if (pRectCopy) if (pRectCopy)
{ {
copyData(prectInit, pRectCopy, nrectFill, MoreCopy2); copyData(prectInit, pRectCopy, nrectFill, MoreCopy2);
...@@ -1965,7 +1965,7 @@ miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit) ...@@ -1965,7 +1965,7 @@ miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
(* pBackingGC->ops->PolyFillRect)(pBackingDrawable, (* pBackingGC->ops->PolyFillRect)(pBackingDrawable,
pBackingGC, nrectFill, pRectCopy); pBackingGC, nrectFill, pRectCopy);
DEALLOCATE_LOCAL(pRectCopy); free(pRectCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -1995,14 +1995,14 @@ miBSPolyFillArc(pDrawable, pGC, narcs, parcs) ...@@ -1995,14 +1995,14 @@ miBSPolyFillArc(pDrawable, pGC, narcs, parcs)
PROLOGUE(pGC); PROLOGUE(pGC);
pArcsCopy = (xArc *)ALLOCATE_LOCAL(narcs*sizeof(xArc)); pArcsCopy = (xArc *)malloc(narcs*sizeof(xArc));
if (pArcsCopy) if (pArcsCopy)
{ {
copyData(parcs, pArcsCopy, narcs, MoreCopy4); copyData(parcs, pArcsCopy, narcs, MoreCopy4);
(* pGC->ops->PolyFillArc)(pDrawable, pGC, narcs, parcs); (* pGC->ops->PolyFillArc)(pDrawable, pGC, narcs, parcs);
(* pBackingGC->ops->PolyFillArc)(pBackingDrawable, (* pBackingGC->ops->PolyFillArc)(pBackingDrawable,
pBackingGC, narcs, pArcsCopy); pBackingGC, narcs, pArcsCopy);
DEALLOCATE_LOCAL(pArcsCopy); free(pArcsCopy);
} }
EPILOGUE (pGC); EPILOGUE (pGC);
...@@ -2391,7 +2391,7 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures) ...@@ -2391,7 +2391,7 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
* PolyFillRect in the proper mode, as set in the GC above. * PolyFillRect in the proper mode, as set in the GC above.
*/ */
numRects = RegionNumRects(pRgn); numRects = RegionNumRects(pRgn);
rects = (xRectangle *)ALLOCATE_LOCAL(numRects*sizeof(xRectangle)); rects = (xRectangle *)malloc(numRects*sizeof(xRectangle));
if (rects) if (rects)
{ {
...@@ -2407,7 +2407,7 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures) ...@@ -2407,7 +2407,7 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
(* pGC->ops->PolyFillRect) ( (* pGC->ops->PolyFillRect) (
(DrawablePtr)pBackingStore->pBackingPixmap, (DrawablePtr)pBackingStore->pBackingPixmap,
pGC, numRects, rects); pGC, numRects, rects);
DEALLOCATE_LOCAL(rects); free(rects);
} }
FreeScratchGC(pGC); FreeScratchGC(pGC);
} }
...@@ -2483,7 +2483,7 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask) ...@@ -2483,7 +2483,7 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask)
if (state == None) if (state == None)
return; return;
numRects = RegionNumRects(pRgn); numRects = RegionNumRects(pRgn);
pRect = (xRectangle *)ALLOCATE_LOCAL(numRects * sizeof(xRectangle)); pRect = (xRectangle *)malloc(numRects * sizeof(xRectangle));
if (!pRect) if (!pRect)
return; return;
pWin = 0; pWin = 0;
...@@ -2554,7 +2554,7 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask) ...@@ -2554,7 +2554,7 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask)
(*pGC->ops->PolyFillRect) (pDrawable, pGC, numRects, pRect); (*pGC->ops->PolyFillRect) (pDrawable, pGC, numRects, pRect);
if (pWin) if (pWin)
(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing);
DEALLOCATE_LOCAL (pRect); free (pRect);
} }
/*- /*-
......
...@@ -395,7 +395,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) ...@@ -395,7 +395,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
numRects = RegionNumRects(pRgn); numRects = RegionNumRects(pRgn);
pBox = RegionRects(pRgn); pBox = RegionRects(pRgn);
if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) if(!(pEvent = (xEvent *)malloc(numRects * sizeof(xEvent))))
return; return;
pe = pEvent; pe = pEvent;
...@@ -413,7 +413,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) ...@@ -413,7 +413,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
} }
TryClientEvents(client, pEvent, numRects, TryClientEvents(client, pEvent, numRects,
(Mask)0, NoEventMask, NullGrab); (Mask)0, NoEventMask, NullGrab);
DEALLOCATE_LOCAL(pEvent); free(pEvent);
} }
else else
{ {
...@@ -442,7 +442,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -442,7 +442,7 @@ miSendExposures(pWin, pRgn, dx, dy)
pBox = RegionRects(pRgn); pBox = RegionRects(pRgn);
numRects = RegionNumRects(pRgn); numRects = RegionNumRects(pRgn);
if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) if(!(pEvent = (xEvent *) malloc(numRects * sizeof(xEvent))))
return; return;
memset(pEvent, 0, numRects * sizeof(xEvent)); memset(pEvent, 0, numRects * sizeof(xEvent));
...@@ -473,7 +473,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -473,7 +473,7 @@ miSendExposures(pWin, pRgn, dx, dy)
win = PanoramiXFindIDByScrnum(XRT_WINDOW, win = PanoramiXFindIDByScrnum(XRT_WINDOW,
pWin->drawable.id, scrnum); pWin->drawable.id, scrnum);
if(!win) { if(!win) {
DEALLOCATE_LOCAL(pEvent); free(pEvent);
return; return;
} }
realWin = win->info[0].id; realWin = win->info[0].id;
...@@ -490,7 +490,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -490,7 +490,7 @@ miSendExposures(pWin, pRgn, dx, dy)
DeliverEvents(pWin, pEvent, numRects, NullWindow); DeliverEvents(pWin, pEvent, numRects, NullWindow);
DEALLOCATE_LOCAL(pEvent); free(pEvent);
} }
#ifndef NXAGENT_SERVER #ifndef NXAGENT_SERVER
...@@ -705,7 +705,7 @@ int what; ...@@ -705,7 +705,7 @@ int what;
} }
} }
prect = (xRectangle *)ALLOCATE_LOCAL(RegionNumRects(prgn) * prect = (xRectangle *)malloc(RegionNumRects(prgn) *
sizeof(xRectangle)); sizeof(xRectangle));
if (!prect) if (!prect)
return; return;
...@@ -730,7 +730,7 @@ int what; ...@@ -730,7 +730,7 @@ int what;
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
if (!pGC) if (!pGC)
{ {
DEALLOCATE_LOCAL(prect); free(prect);
return; return;
} }
/* /*
...@@ -862,7 +862,7 @@ int what; ...@@ -862,7 +862,7 @@ int what;
} }
prect -= numRects; prect -= numRects;
(*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);
DEALLOCATE_LOCAL(prect); free(prect);
if (pWin->backStorage) if (pWin->backStorage)
(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing);
......
...@@ -559,13 +559,13 @@ miFillEllipseI( ...@@ -559,13 +559,13 @@ miFillEllipseI(
int *widths; int *widths;
register int *wids; register int *wids;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height); points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * arc->height);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height); widths = (int *)malloc(sizeof(int) * arc->height);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); free(points);
return; return;
} }
miFillArcSetup(arc, &info); miFillArcSetup(arc, &info);
...@@ -583,8 +583,8 @@ miFillEllipseI( ...@@ -583,8 +583,8 @@ miFillEllipseI(
ADDSPANS(); ADDSPANS();
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); free(widths);
DEALLOCATE_LOCAL(points); free(points);
} }
static void static void
...@@ -602,13 +602,13 @@ miFillEllipseD( ...@@ -602,13 +602,13 @@ miFillEllipseD(
int *widths; int *widths;
register int *wids; register int *wids;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height); points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * arc->height);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height); widths = (int *)malloc(sizeof(int) * arc->height);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); free(points);
return; return;
} }
miFillArcDSetup(arc, &info); miFillArcDSetup(arc, &info);
...@@ -626,8 +626,8 @@ miFillEllipseD( ...@@ -626,8 +626,8 @@ miFillEllipseD(
ADDSPANS(); ADDSPANS();
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); free(widths);
DEALLOCATE_LOCAL(points); free(points);
} }
#define ADDSPAN(l,r) \ #define ADDSPAN(l,r) \
...@@ -674,13 +674,13 @@ miFillArcSliceI( ...@@ -674,13 +674,13 @@ miFillArcSliceI(
slw = arc->height; slw = arc->height;
if (slice.flip_top || slice.flip_bot) if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1; slw += (arc->height >> 1) + 1;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw); points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * slw);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw); widths = (int *)malloc(sizeof(int) * slw);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); free(points);
return; return;
} }
if (pGC->miTranslate) if (pGC->miTranslate)
...@@ -711,8 +711,8 @@ miFillArcSliceI( ...@@ -711,8 +711,8 @@ miFillArcSliceI(
} }
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); free(widths);
DEALLOCATE_LOCAL(points); free(points);
} }
static void static void
...@@ -738,13 +738,13 @@ miFillArcSliceD( ...@@ -738,13 +738,13 @@ miFillArcSliceD(
slw = arc->height; slw = arc->height;
if (slice.flip_top || slice.flip_bot) if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1; slw += (arc->height >> 1) + 1;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw); points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * slw);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw); widths = (int *)malloc(sizeof(int) * slw);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); free(points);
return; return;
} }
if (pGC->miTranslate) if (pGC->miTranslate)
...@@ -775,8 +775,8 @@ miFillArcSliceD( ...@@ -775,8 +775,8 @@ miFillArcSliceD(
} }
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); free(widths);
DEALLOCATE_LOCAL(points); free(points);
} }
/* MIPOLYFILLARC -- The public entry for the PolyFillArc request. /* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
......
...@@ -106,12 +106,12 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit) ...@@ -106,12 +106,12 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
maxheight = max(maxheight, prect->height); maxheight = max(maxheight, prect->height);
} }
pptFirst = (DDXPointPtr) ALLOCATE_LOCAL(maxheight * sizeof(DDXPointRec)); pptFirst = (DDXPointPtr) malloc(maxheight * sizeof(DDXPointRec));
pwFirst = (int *) ALLOCATE_LOCAL(maxheight * sizeof(int)); pwFirst = (int *) malloc(maxheight * sizeof(int));
if(!pptFirst || !pwFirst) if(!pptFirst || !pwFirst)
{ {
if (pwFirst) DEALLOCATE_LOCAL(pwFirst); if (pwFirst) free(pwFirst);
if (pptFirst) DEALLOCATE_LOCAL(pptFirst); if (pptFirst) free(pptFirst);
return; return;
} }
...@@ -137,6 +137,6 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit) ...@@ -137,6 +137,6 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
1); 1);
prect++; prect++;
} }
DEALLOCATE_LOCAL(pwFirst); free(pwFirst);
DEALLOCATE_LOCAL(pptFirst); free(pptFirst);
} }
...@@ -118,15 +118,15 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans) ...@@ -118,15 +118,15 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
y = ymax - ymin + 1; y = ymax - ymin + 1;
if ((count < 3) || (y <= 0)) if ((count < 3) || (y <= 0))
return; return;
ptsOut = FirstPoint = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * y); ptsOut = FirstPoint = (DDXPointPtr)malloc(sizeof(DDXPointRec) * y);
width = FirstWidth = (int *) ALLOCATE_LOCAL(sizeof(int) * y); width = FirstWidth = (int *) malloc(sizeof(int) * y);
Marked = (int *) ALLOCATE_LOCAL(sizeof(int) * count); Marked = (int *) malloc(sizeof(int) * count);
if(!ptsOut || !width || !Marked) if(!ptsOut || !width || !Marked)
{ {
if (Marked) DEALLOCATE_LOCAL(Marked); if (Marked) free(Marked);
if (width) DEALLOCATE_LOCAL(width); if (width) free(width);
if (ptsOut) DEALLOCATE_LOCAL(ptsOut); if (ptsOut) free(ptsOut);
return; return;
} }
...@@ -240,9 +240,9 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans) ...@@ -240,9 +240,9 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
/* Finally, fill the spans we've collected */ /* Finally, fill the spans we've collected */
(*pgc->ops->FillSpans)(dst, pgc, (*pgc->ops->FillSpans)(dst, pgc,
ptsOut-FirstPoint, FirstPoint, FirstWidth, 1); ptsOut-FirstPoint, FirstPoint, FirstWidth, 1);
DEALLOCATE_LOCAL(Marked); free(Marked);
DEALLOCATE_LOCAL(FirstWidth); free(FirstWidth);
DEALLOCATE_LOCAL(FirstPoint); free(FirstPoint);
} }
......
...@@ -138,7 +138,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) ...@@ -138,7 +138,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0); DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
nbyLine = BitmapBytePad(width); nbyLine = BitmapBytePad(width);
pbits = (unsigned char *)ALLOCATE_LOCAL(height*nbyLine); pbits = (unsigned char *)malloc(height*nbyLine);
if (!pbits) if (!pbits)
{ {
(*pDrawable->pScreen->DestroyPixmap)(pPixmap); (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
...@@ -189,7 +189,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) ...@@ -189,7 +189,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
x += pci->metrics.characterWidth; x += pci->metrics.characterWidth;
} }
(*pDrawable->pScreen->DestroyPixmap)(pPixmap); (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
DEALLOCATE_LOCAL(pbits); free(pbits);
FreeScratchGC(pGCtmp); FreeScratchGC(pGCtmp);
} }
......
...@@ -104,12 +104,12 @@ miFillConvexPoly(dst, pgc, count, ptsIn) ...@@ -104,12 +104,12 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
dy = ymax - ymin + 1; dy = ymax - ymin + 1;
if ((count < 3) || (dy < 0)) if ((count < 3) || (dy < 0))
return(TRUE); return(TRUE);
ptsOut = FirstPoint = (DDXPointPtr )ALLOCATE_LOCAL(sizeof(DDXPointRec)*dy); ptsOut = FirstPoint = (DDXPointPtr )malloc(sizeof(DDXPointRec)*dy);
width = FirstWidth = (int *)ALLOCATE_LOCAL(sizeof(int) * dy); width = FirstWidth = (int *)malloc(sizeof(int) * dy);
if(!FirstPoint || !FirstWidth) if(!FirstPoint || !FirstWidth)
{ {
if (FirstWidth) DEALLOCATE_LOCAL(FirstWidth); if (FirstWidth) free(FirstWidth);
if (FirstPoint) DEALLOCATE_LOCAL(FirstPoint); if (FirstPoint) free(FirstPoint);
return(FALSE); return(FALSE);
} }
...@@ -174,8 +174,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn) ...@@ -174,8 +174,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
/* in case we're called with non-convex polygon */ /* in case we're called with non-convex polygon */
if(i < 0) if(i < 0)
{ {
DEALLOCATE_LOCAL(FirstWidth); free(FirstWidth);
DEALLOCATE_LOCAL(FirstPoint); free(FirstPoint);
return(TRUE); return(TRUE);
} }
while (i-- > 0) while (i-- > 0)
...@@ -209,8 +209,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn) ...@@ -209,8 +209,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
(*pgc->ops->FillSpans)(dst, pgc, (*pgc->ops->FillSpans)(dst, pgc,
ptsOut-FirstPoint,FirstPoint,FirstWidth, ptsOut-FirstPoint,FirstPoint,FirstWidth,
1); 1);
DEALLOCATE_LOCAL(FirstWidth); free(FirstWidth);
DEALLOCATE_LOCAL(FirstPoint); free(FirstPoint);
return(TRUE); return(TRUE);
} }
......
...@@ -92,13 +92,13 @@ miFillGeneralPoly(dst, pgc, count, ptsIn) ...@@ -92,13 +92,13 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
return(TRUE); return(TRUE);
if(!(pETEs = (EdgeTableEntry *) if(!(pETEs = (EdgeTableEntry *)
ALLOCATE_LOCAL(sizeof(EdgeTableEntry) * count))) malloc(sizeof(EdgeTableEntry) * count)))
return(FALSE); return(FALSE);
ptsOut = FirstPoint; ptsOut = FirstPoint;
width = FirstWidth; width = FirstWidth;
if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
{ {
DEALLOCATE_LOCAL(pETEs); free(pETEs);
return(FALSE); return(FALSE);
} }
pSLL = ET.scanlines.next; pSLL = ET.scanlines.next;
...@@ -224,7 +224,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn) ...@@ -224,7 +224,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
* Get any spans that we missed by buffering * Get any spans that we missed by buffering
*/ */
(*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1);
DEALLOCATE_LOCAL(pETEs); free(pETEs);
miFreeStorage(SLLBlock.next); miFreeStorage(SLLBlock.next);
return(TRUE); return(TRUE);
} }
...@@ -106,7 +106,7 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit) ...@@ -106,7 +106,7 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
DoChangeGC(pGC, GCFillStyle, &fsNew, 0); DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
ValidateGC(pDrawable, pGC); ValidateGC(pDrawable, pGC);
} }
if(!(pwidthInit = (int *)ALLOCATE_LOCAL(npt * sizeof(int)))) if(!(pwidthInit = (int *)malloc(npt * sizeof(int))))
return; return;
pwidth = pwidthInit; pwidth = pwidthInit;
for(i = 0; i < npt; i++) for(i = 0; i < npt; i++)
...@@ -118,6 +118,6 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit) ...@@ -118,6 +118,6 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
DoChangeGC(pGC, GCFillStyle, &fsOld, 0); DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
ValidateGC(pDrawable, pGC); ValidateGC(pDrawable, pGC);
} }
DEALLOCATE_LOCAL(pwidthInit); free(pwidthInit);
} }
...@@ -94,7 +94,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects) ...@@ -94,7 +94,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
offset2 = pGC->lineWidth; offset2 = pGC->lineWidth;
offset1 = offset2 >> 1; offset1 = offset2 >> 1;
offset3 = offset2 - offset1; offset3 = offset2 - offset1;
tmp = (xRectangle *) ALLOCATE_LOCAL(ntmp * sizeof (xRectangle)); tmp = (xRectangle *) malloc(ntmp * sizeof (xRectangle));
if (!tmp) if (!tmp)
return; return;
t = tmp; t = tmp;
...@@ -162,7 +162,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects) ...@@ -162,7 +162,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
} }
} }
(*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp); (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
DEALLOCATE_LOCAL ((void *) tmp); free ((void *) tmp);
} }
else else
{ {
......
...@@ -531,7 +531,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) ...@@ -531,7 +531,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
free(points); free(points);
free(widths); free(widths);
free(yspans); free(yspans);
free(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */ free(ysizes);
} }
spanGroup->count = 0; spanGroup->count = 0;
......
...@@ -105,13 +105,13 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height, ...@@ -105,13 +105,13 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
if (!spanData) if (!spanData)
{ {
pptInit = (DDXPointPtr) ALLOCATE_LOCAL (overall_height * sizeof(*ppt)); pptInit = (DDXPointPtr) malloc (overall_height * sizeof(*ppt));
if (!pptInit) if (!pptInit)
return; return;
pwidthInit = (int *) ALLOCATE_LOCAL (overall_height * sizeof(*pwidth)); pwidthInit = (int *) malloc (overall_height * sizeof(*pwidth));
if (!pwidthInit) if (!pwidthInit)
{ {
DEALLOCATE_LOCAL (pptInit); free (pptInit);
return; return;
} }
ppt = pptInit; ppt = pptInit;
...@@ -176,8 +176,8 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height, ...@@ -176,8 +176,8 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
if (!spanData) if (!spanData)
{ {
(*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE); (*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE);
DEALLOCATE_LOCAL (pwidthInit); free (pwidthInit);
DEALLOCATE_LOCAL (pptInit); free (pptInit);
if (pixel != oldPixel) if (pixel != oldPixel)
{ {
DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
...@@ -1056,13 +1056,13 @@ miLineArc ( ...@@ -1056,13 +1056,13 @@ miLineArc (
} }
if (!spanData) if (!spanData)
{ {
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * pGC->lineWidth); points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * pGC->lineWidth);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * pGC->lineWidth); widths = (int *)malloc(sizeof(int) * pGC->lineWidth);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); free(points);
return; return;
} }
oldPixel = pGC->fgPixel; oldPixel = pGC->fgPixel;
...@@ -1096,8 +1096,8 @@ miLineArc ( ...@@ -1096,8 +1096,8 @@ miLineArc (
if (!spanData) if (!spanData)
{ {
(*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE); (*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE);
DEALLOCATE_LOCAL(widths); free(widths);
DEALLOCATE_LOCAL(points); free(points);
if (pixel != oldPixel) if (pixel != oldPixel)
{ {
DoChangeGC(pGC, GCForeground, &oldPixel, FALSE); DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);
......
...@@ -746,7 +746,7 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs) ...@@ -746,7 +746,7 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
dospans = (pGC->fillStyle != FillSolid); dospans = (pGC->fillStyle != FillSolid);
if (dospans) if (dospans)
{ {
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * numPts); widths = (int *)malloc(sizeof(int) * numPts);
if (!widths) if (!widths)
return; return;
maxw = 0; maxw = 0;
...@@ -763,12 +763,12 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs) ...@@ -763,12 +763,12 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
(unsigned char *) pGC->dash, (int)pGC->numInDashList, (unsigned char *) pGC->dash, (int)pGC->numInDashList,
&dinfo.dashOffsetInit); &dinfo.dashOffsetInit);
} }
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * numPts); points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * numPts);
if (!points) if (!points)
{ {
if (dospans) if (dospans)
{ {
DEALLOCATE_LOCAL(widths); free(widths);
} }
return; return;
} }
...@@ -845,9 +845,9 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs) ...@@ -845,9 +845,9 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
} }
} }
} }
DEALLOCATE_LOCAL(points); free(points);
if (dospans) if (dospans)
{ {
DEALLOCATE_LOCAL(widths); free(widths);
} }
} }
...@@ -155,8 +155,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit) ...@@ -155,8 +155,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
width = xright - xleft + 1; width = xright - xleft + 1;
height = ybottom - ytop + 1; height = ybottom - ytop + 1;
list_len = (height >= width) ? height : width; list_len = (height >= width) ? height : width;
pspanInit = (DDXPointPtr)ALLOCATE_LOCAL(list_len * sizeof(DDXPointRec)); pspanInit = (DDXPointPtr)malloc(list_len * sizeof(DDXPointRec));
pwidthInit = (int *)ALLOCATE_LOCAL(list_len * sizeof(int)); pwidthInit = (int *)malloc(list_len * sizeof(int));
if (!pspanInit || !pwidthInit) if (!pspanInit || !pwidthInit)
return; return;
...@@ -359,8 +359,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit) ...@@ -359,8 +359,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
(*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit, (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit,
pwidthInit, FALSE); pwidthInit, FALSE);
DEALLOCATE_LOCAL(pwidthInit); free(pwidthInit);
DEALLOCATE_LOCAL(pspanInit); free(pspanInit);
} }
void void
......
...@@ -1347,7 +1347,7 @@ damageText (DrawablePtr pDrawable, ...@@ -1347,7 +1347,7 @@ damageText (DrawablePtr pDrawable,
imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
charinfo = (CharInfoPtr *) ALLOCATE_LOCAL(count * sizeof(CharInfoPtr)); charinfo = (CharInfoPtr *) malloc(count * sizeof(CharInfoPtr));
if (!charinfo) if (!charinfo)
return x; return x;
...@@ -1369,7 +1369,7 @@ damageText (DrawablePtr pDrawable, ...@@ -1369,7 +1369,7 @@ damageText (DrawablePtr pDrawable,
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, n, charinfo, (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
FONTGLYPHS(pGC->font)); FONTGLYPHS(pGC->font));
} }
DEALLOCATE_LOCAL(charinfo); free(charinfo);
return x + w; return x + w;
} }
......
...@@ -1763,7 +1763,7 @@ RecordRegisterClients(pContext, client, stuff) ...@@ -1763,7 +1763,7 @@ RecordRegisterClients(pContext, client, stuff)
* range for extension replies. * range for extension replies.
*/ */
maxSets = PREDEFSETS + 2 * stuff->nRanges; maxSets = PREDEFSETS + 2 * stuff->nRanges;
si = (SetInfoPtr)ALLOCATE_LOCAL(sizeof(SetInfoRec) * maxSets); si = (SetInfoPtr)malloc(sizeof(SetInfoRec) * maxSets);
if (!si) if (!si)
{ {
err = BadAlloc; err = BadAlloc;
...@@ -1970,7 +1970,7 @@ bailout: ...@@ -1970,7 +1970,7 @@ bailout:
for (i = 0; i < maxSets; i++) for (i = 0; i < maxSets; i++)
if (si[i].intervals) if (si[i].intervals)
free(si[i].intervals); free(si[i].intervals);
DEALLOCATE_LOCAL(si); free(si);
} }
if (pCanonClients && pCanonClients != (XID *)&stuff[1]) if (pCanonClients && pCanonClients != (XID *)&stuff[1])
free(pCanonClients); free(pCanonClients);
...@@ -2343,7 +2343,7 @@ ProcRecordGetContext(client) ...@@ -2343,7 +2343,7 @@ ProcRecordGetContext(client)
/* allocate and initialize space for record range info */ /* allocate and initialize space for record range info */
pRangeInfo = (GetContextRangeInfoPtr)ALLOCATE_LOCAL( pRangeInfo = (GetContextRangeInfoPtr)malloc(
nRCAPs * sizeof(GetContextRangeInfoRec)); nRCAPs * sizeof(GetContextRangeInfoRec));
if (!pRangeInfo && nRCAPs > 0) if (!pRangeInfo && nRCAPs > 0)
return BadAlloc; return BadAlloc;
...@@ -2460,7 +2460,7 @@ bailout: ...@@ -2460,7 +2460,7 @@ bailout:
{ {
if (pRangeInfo[i].pRanges) free(pRangeInfo[i].pRanges); if (pRangeInfo[i].pRanges) free(pRangeInfo[i].pRanges);
} }
DEALLOCATE_LOCAL(pRangeInfo); free(pRangeInfo);
return err; return err;
} /* ProcRecordGetContext */ } /* ProcRecordGetContext */
...@@ -2882,14 +2882,14 @@ RecordConnectionSetupInfo(pContext, pci) ...@@ -2882,14 +2882,14 @@ RecordConnectionSetupInfo(pContext, pci)
if (pci->client->swapped) if (pci->client->swapped)
{ {
char * pConnSetup = (char *)ALLOCATE_LOCAL(prefixsize + restsize); char * pConnSetup = (char *)malloc(prefixsize + restsize);
if (!pConnSetup) if (!pConnSetup)
return; return;
SwapConnSetupPrefix(pci->prefix, pConnSetup); SwapConnSetupPrefix(pci->prefix, pConnSetup);
SwapConnSetupInfo(pci->setup, pConnSetup + prefixsize); SwapConnSetupInfo(pci->setup, pConnSetup + prefixsize);
RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
(void *)pConnSetup, prefixsize + restsize, 0); (void *)pConnSetup, prefixsize + restsize, 0);
DEALLOCATE_LOCAL(pConnSetup); free(pConnSetup);
} }
else else
{ {
......
...@@ -71,9 +71,6 @@ typedef int Bool; ...@@ -71,9 +71,6 @@ typedef int Bool;
typedef unsigned short CARD16; typedef unsigned short CARD16;
#define ALLOCATE_LOCAL malloc
#define DEALLOCATE_LOCAL free
#ifndef max #ifndef max
#define max(_a, _b) ( ((_a) > (_b)) ? (_a) : (_b) ) #define max(_a, _b) ( ((_a) > (_b)) ? (_a) : (_b) )
#endif #endif
...@@ -358,7 +355,7 @@ IntervalListCreateSet(pIntervals, nIntervals, pMem, memsize) ...@@ -358,7 +355,7 @@ IntervalListCreateSet(pIntervals, nIntervals, pMem, memsize)
if (nIntervals > 0) if (nIntervals > 0)
{ {
stackIntervals = (RecordSetInterval *)ALLOCATE_LOCAL( stackIntervals = (RecordSetInterval *)malloc(
sizeof(RecordSetInterval) * nIntervals); sizeof(RecordSetInterval) * nIntervals);
if (!stackIntervals) return NULL; if (!stackIntervals) return NULL;
...@@ -416,7 +413,7 @@ IntervalListCreateSet(pIntervals, nIntervals, pMem, memsize) ...@@ -416,7 +413,7 @@ IntervalListCreateSet(pIntervals, nIntervals, pMem, memsize)
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
prls->nIntervals = nIntervals; prls->nIntervals = nIntervals;
bailout: bailout:
if (stackIntervals) DEALLOCATE_LOCAL(stackIntervals); if (stackIntervals) free(stackIntervals);
return (RecordSetPtr)prls; return (RecordSetPtr)prls;
} }
......
...@@ -145,7 +145,7 @@ miTriStrip (CARD8 op, ...@@ -145,7 +145,7 @@ miTriStrip (CARD8 op,
if (npoint < 3) if (npoint < 3)
return; return;
ntri = npoint - 2; ntri = npoint - 2;
tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle)); tris = malloc (ntri * sizeof (xTriangle));
if (!tris) if (!tris)
return; return;
for (tri = tris; npoint >= 3; npoint--, points++, tri++) for (tri = tris; npoint >= 3; npoint--, points++, tri++)
...@@ -155,7 +155,7 @@ miTriStrip (CARD8 op, ...@@ -155,7 +155,7 @@ miTriStrip (CARD8 op,
tri->p3 = points[2]; tri->p3 = points[2];
} }
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
DEALLOCATE_LOCAL (tris); free (tris);
} }
void void
...@@ -177,7 +177,7 @@ miTriFan (CARD8 op, ...@@ -177,7 +177,7 @@ miTriFan (CARD8 op,
if (npoint < 3) if (npoint < 3)
return; return;
ntri = npoint - 2; ntri = npoint - 2;
tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle)); tris = malloc (ntri * sizeof (xTriangle));
if (!tris) if (!tris)
return; return;
first = points++; first = points++;
...@@ -188,5 +188,5 @@ miTriFan (CARD8 op, ...@@ -188,5 +188,5 @@ miTriFan (CARD8 op,
tri->p3 = points[1]; tri->p3 = points[1];
} }
(*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
DEALLOCATE_LOCAL (tris); free (tris);
} }
...@@ -1338,7 +1338,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1338,7 +1338,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
glyphsBase = glyphsLocal; glyphsBase = glyphsLocal;
else else
{ {
glyphsBase = (GlyphPtr *) ALLOCATE_LOCAL (nglyph * sizeof (GlyphPtr)); glyphsBase = (GlyphPtr *) malloc (nglyph * sizeof (GlyphPtr));
if (!glyphsBase) if (!glyphsBase)
return BadAlloc; return BadAlloc;
} }
...@@ -1346,7 +1346,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1346,7 +1346,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
listsBase = listsLocal; listsBase = listsLocal;
else else
{ {
listsBase = (GlyphListPtr) ALLOCATE_LOCAL (nlist * sizeof (GlyphListRec)); listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec));
if (!listsBase) if (!listsBase)
return BadAlloc; return BadAlloc;
} }
...@@ -1371,9 +1371,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1371,9 +1371,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
{ {
client->errorValue = gs; client->errorValue = gs;
if (glyphsBase != glyphsLocal) if (glyphsBase != glyphsLocal)
DEALLOCATE_LOCAL (glyphsBase); free (glyphsBase);
if (listsBase != listsLocal) if (listsBase != listsLocal)
DEALLOCATE_LOCAL (listsBase); free (listsBase);
return RenderErrBase + BadGlyphSet; return RenderErrBase + BadGlyphSet;
} }
} }
...@@ -1427,9 +1427,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) ...@@ -1427,9 +1427,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
glyphsBase); glyphsBase);
if (glyphsBase != glyphsLocal) if (glyphsBase != glyphsLocal)
DEALLOCATE_LOCAL (glyphsBase); free (glyphsBase);
if (listsBase != listsLocal) if (listsBase != listsLocal)
DEALLOCATE_LOCAL (listsBase); free (listsBase);
return client->noClientException; return client->noClientException;
} }
...@@ -2893,7 +2893,7 @@ PanoramiXRenderFillRectangles (ClientPtr client) ...@@ -2893,7 +2893,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
RenderErrBase + BadPicture); RenderErrBase + BadPicture);
extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq); extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) (extra = (char *) malloc (extra_len)))
{ {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
...@@ -2919,7 +2919,7 @@ PanoramiXRenderFillRectangles (ClientPtr client) ...@@ -2919,7 +2919,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client); result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
...@@ -2944,7 +2944,7 @@ PanoramiXRenderTrapezoids(ClientPtr client) ...@@ -2944,7 +2944,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) { (extra = (char *) malloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
...@@ -2981,7 +2981,7 @@ PanoramiXRenderTrapezoids(ClientPtr client) ...@@ -2981,7 +2981,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
...@@ -3006,7 +3006,7 @@ PanoramiXRenderTriangles(ClientPtr client) ...@@ -3006,7 +3006,7 @@ PanoramiXRenderTriangles(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq); extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) { (extra = (char *) malloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
...@@ -3039,7 +3039,7 @@ PanoramiXRenderTriangles(ClientPtr client) ...@@ -3039,7 +3039,7 @@ PanoramiXRenderTriangles(ClientPtr client)
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
...@@ -3064,7 +3064,7 @@ PanoramiXRenderTriStrip(ClientPtr client) ...@@ -3064,7 +3064,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq); extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) { (extra = (char *) malloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
...@@ -3093,7 +3093,7 @@ PanoramiXRenderTriStrip(ClientPtr client) ...@@ -3093,7 +3093,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
...@@ -3118,7 +3118,7 @@ PanoramiXRenderTriFan(ClientPtr client) ...@@ -3118,7 +3118,7 @@ PanoramiXRenderTriFan(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq); extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) { (extra = (char *) malloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
...@@ -3147,7 +3147,7 @@ PanoramiXRenderTriFan(ClientPtr client) ...@@ -3147,7 +3147,7 @@ PanoramiXRenderTriFan(ClientPtr client)
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
...@@ -3172,7 +3172,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client) ...@@ -3172,7 +3172,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) { (extra = (char *) malloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
...@@ -3193,7 +3193,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client) ...@@ -3193,7 +3193,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
...@@ -3216,7 +3216,7 @@ PanoramiXRenderColorTriangles(ClientPtr client) ...@@ -3216,7 +3216,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) { (extra = (char *) malloc (extra_len))) {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
...@@ -3237,7 +3237,7 @@ PanoramiXRenderColorTriangles(ClientPtr client) ...@@ -3237,7 +3237,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
...@@ -3260,7 +3260,7 @@ PanoramiXRenderAddTraps (ClientPtr client) ...@@ -3260,7 +3260,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
RenderErrBase + BadPicture); RenderErrBase + BadPicture);
extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq); extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
if (extra_len && if (extra_len &&
(extra = (char *) ALLOCATE_LOCAL (extra_len))) (extra = (char *) malloc (extra_len)))
{ {
memcpy (extra, stuff + 1, extra_len); memcpy (extra, stuff + 1, extra_len);
x_off = stuff->xOff; x_off = stuff->xOff;
...@@ -3277,7 +3277,7 @@ PanoramiXRenderAddTraps (ClientPtr client) ...@@ -3277,7 +3277,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client); result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
if(result != Success) break; if(result != Success) break;
} }
DEALLOCATE_LOCAL(extra); free(extra);
} }
return result; return result;
......
...@@ -1301,7 +1301,7 @@ unsigned i,len; ...@@ -1301,7 +1301,7 @@ unsigned i,len;
char *desc,*start; char *desc,*start;
len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply)); len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply));
start= desc= (char *)ALLOCATE_LOCAL(len); start= desc= (char *)malloc(len);
if (!start) if (!start)
return BadAlloc; return BadAlloc;
memset(start, 0, len); memset(start, 0, len);
...@@ -1342,7 +1342,7 @@ char *desc,*start; ...@@ -1342,7 +1342,7 @@ char *desc,*start;
} }
WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), rep); WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), rep);
WriteToClient(client, len, start); WriteToClient(client, len, start);
DEALLOCATE_LOCAL((char *)start); free((char *)start);
return client->noClientException; return client->noClientException;
} }
...@@ -2486,7 +2486,7 @@ int size; ...@@ -2486,7 +2486,7 @@ int size;
size= rep->length*4; size= rep->length*4;
if (size>0) { if (size>0) {
data = (char *)ALLOCATE_LOCAL(size); data = (char *)malloc(size);
if (data) { if (data) {
register unsigned i,bit; register unsigned i,bit;
xkbModsWireDesc * grp; xkbModsWireDesc * grp;
...@@ -2534,7 +2534,7 @@ int size; ...@@ -2534,7 +2534,7 @@ int size;
WriteToClient(client, SIZEOF(xkbGetCompatMapReply), rep); WriteToClient(client, SIZEOF(xkbGetCompatMapReply), rep);
if (data) { if (data) {
WriteToClient(client, size, data); WriteToClient(client, size, data);
DEALLOCATE_LOCAL((char *)data); free((char *)data);
} }
return client->noClientException; return client->noClientException;
} }
...@@ -2781,7 +2781,7 @@ register unsigned bit; ...@@ -2781,7 +2781,7 @@ register unsigned bit;
length = rep->length*4; length = rep->length*4;
if (length>0) { if (length>0) {
CARD8 *to; CARD8 *to;
to= map= (CARD8 *)ALLOCATE_LOCAL(length); to= map= (CARD8 *)malloc(length);
if (map) { if (map) {
xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to; xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to;
for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) { for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
...@@ -2819,7 +2819,7 @@ register unsigned bit; ...@@ -2819,7 +2819,7 @@ register unsigned bit;
WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), rep); WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), rep);
if (map) { if (map) {
WriteToClient(client, length, map); WriteToClient(client, length, map);
DEALLOCATE_LOCAL((char *)map); free((char *)map);
} }
return client->noClientException; return client->noClientException;
} }
...@@ -3308,7 +3308,7 @@ char * desc; ...@@ -3308,7 +3308,7 @@ char * desc;
swapl(&rep->indicators); swapl(&rep->indicators);
} }
start = desc = (char *)ALLOCATE_LOCAL(length); start = desc = (char *)malloc(length);
if ( !start ) if ( !start )
return BadAlloc; return BadAlloc;
if (which&XkbKeycodesNameMask) { if (which&XkbKeycodesNameMask) {
...@@ -3429,7 +3429,7 @@ char * desc; ...@@ -3429,7 +3429,7 @@ char * desc;
} }
WriteToClient(client, SIZEOF(xkbGetNamesReply), rep); WriteToClient(client, SIZEOF(xkbGetNamesReply), rep);
WriteToClient(client, length, start); WriteToClient(client, length, start);
DEALLOCATE_LOCAL((char *)start); free((char *)start);
return client->noClientException; return client->noClientException;
} }
...@@ -4315,7 +4315,7 @@ XkbSendGeometry( ClientPtr client, ...@@ -4315,7 +4315,7 @@ XkbSendGeometry( ClientPtr client,
if (geom!=NULL) { if (geom!=NULL) {
len= rep->length*4; len= rep->length*4;
start= desc= (char *)ALLOCATE_LOCAL(len); start= desc= (char *)malloc(len);
if (!start) if (!start)
return BadAlloc; return BadAlloc;
desc= XkbWriteCountedString(desc,geom->label_font,client->swapped); desc= XkbWriteCountedString(desc,geom->label_font,client->swapped);
...@@ -4358,7 +4358,7 @@ XkbSendGeometry( ClientPtr client, ...@@ -4358,7 +4358,7 @@ XkbSendGeometry( ClientPtr client,
if (len>0) if (len>0)
WriteToClient(client, len, start); WriteToClient(client, len, start);
if (start!=NULL) if (start!=NULL)
DEALLOCATE_LOCAL((char *)start); free((char *)start);
if (freeGeom) if (freeGeom)
XkbFreeGeometry(geom,XkbGeomAllMask,True); XkbFreeGeometry(geom,XkbGeomAllMask,True);
return client->noClientException; return client->noClientException;
...@@ -5753,12 +5753,12 @@ char * str; ...@@ -5753,12 +5753,12 @@ char * str;
} }
WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), &rep); WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), &rep);
str= (char*) ALLOCATE_LOCAL(nameLen); str= (char*) malloc(nameLen);
if (!str) if (!str)
return BadAlloc; return BadAlloc;
XkbWriteCountedString(str,dev->name,client->swapped); XkbWriteCountedString(str,dev->name,client->swapped);
WriteToClient(client,nameLen,str); WriteToClient(client,nameLen,str);
DEALLOCATE_LOCAL(str); free(str);
length-= nameLen; length-= nameLen;
if (rep.nBtnsRtrn>0) { if (rep.nBtnsRtrn>0) {
......
...@@ -179,7 +179,7 @@ char * pval; ...@@ -179,7 +179,7 @@ char * pval;
ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM); ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
return True; return True;
} }
pval= (char*) ALLOCATE_LOCAL(len); pval= (char*) malloc(len);
if (!pval) { if (!pval) {
ErrorF("Allocation error: %s proprerty not created\n", ErrorF("Allocation error: %s proprerty not created\n",
_XKB_RF_NAMES_PROP_ATOM); _XKB_RF_NAMES_PROP_ATOM);
...@@ -220,7 +220,7 @@ char * pval; ...@@ -220,7 +220,7 @@ char * pval;
} }
ChangeWindowProperty(screenInfo.screens[0]->root,name,XA_STRING,8,PropModeReplace, ChangeWindowProperty(screenInfo.screens[0]->root,name,XA_STRING,8,PropModeReplace,
len,pval,True); len,pval,True);
DEALLOCATE_LOCAL(pval); free(pval);
return True; return True;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment