xserver: Branch 'master' - 25 commits

Daniel Stone daniels at kemper.freedesktop.org
Mon Nov 5 07:42:37 PST 2007


 XTrap/xtrapdi.c                       |   12 +--
 Xext/mbuf.c                           |   40 ++++++------
 Xext/mbufbf.c                         |    4 -
 Xext/mbufpx.c                         |    4 -
 Xext/panoramiXprocs.c                 |   32 +++++-----
 Xext/saver.c                          |    4 -
 Xext/shape.c                          |    6 -
 Xext/sync.c                           |   12 +--
 Xext/xace.c                           |    4 -
 Xext/xf86bigfont.c                    |   18 ++---
 Xext/xres.c                           |    8 +-
 Xi/gtmotion.c                         |    4 -
 afb/afbbitblt.c                       |    4 -
 afb/afbblt.c                          |   26 ++++----
 afb/afbfillrct.c                      |    4 -
 afb/afbfillsp.c                       |   84 +++++++++++++-------------
 afb/afbimggblt.c                      |    4 -
 afb/afbpixmap.c                       |    4 -
 afb/afbplygblt.c                      |    4 -
 afb/afbwindow.c                       |    4 -
 cfb/cfbbitblt.c                       |    8 +-
 cfb/cfbblt.c                          |   26 ++++----
 cfb/cfbfillrct.c                      |    4 -
 cfb/cfbfillsp.c                       |   60 +++++++++---------
 cfb/cfbglblt8.c                       |    4 -
 cfb/cfbpixmap.c                       |    8 +-
 cfb/cfbsolid.c                        |   12 +--
 cfb/cfbtile32.c                       |   12 +--
 cfb/cfbwindow.c                       |    4 -
 dix/colormap.c                        |   40 ++++++------
 dix/devices.c                         |    4 -
 dix/dispatch.c                        |    4 -
 dix/dixfonts.c                        |    8 +-
 dix/extension.c                       |    4 -
 dix/grabs.c                           |   24 +++----
 dix/property.c                        |   16 ++---
 dix/resource.c                        |    6 -
 dix/swaprep.c                         |   12 +--
 exa/exa_accel.c                       |   18 ++---
 fb/fbcopy.c                           |   10 +--
 fb/fbpseudocolor.c                    |   16 ++---
 hw/dmx/dmx.c                          |   48 +++++++--------
 hw/dmx/dmxextension.c                 |   12 +--
 hw/dmx/dmxpict.c                      |   10 +--
 hw/kdrive/epson/epson13806.c          |    4 -
 hw/kdrive/fbdev/fbdev.c               |    4 -
 hw/kdrive/igs/igsdraw.c               |   12 +--
 hw/kdrive/nvidia/nvidiavideo.c        |    4 -
 hw/kdrive/savage/s3draw.c             |   32 +++++-----
 hw/kdrive/sis530/sisdraw.c            |   16 ++---
 hw/kdrive/smi/smivideo.c              |    4 -
 hw/kdrive/src/kxv.c                   |    4 -
 hw/vfb/InitOutput.c                   |   12 +--
 hw/xfree86/common/xf86Configure.c     |    2 
 hw/xfree86/common/xf86sbusBus.c       |    4 -
 hw/xfree86/common/xf86xv.c            |    4 -
 hw/xfree86/dixmods/extmod/xf86vmode.c |   16 ++---
 hw/xfree86/modes/xf86RandR12.c        |   26 ++++----
 hw/xfree86/shadowfb/shadow.c          |    6 -
 hw/xfree86/vgahw/vgaCmap.c            |   12 +--
 hw/xfree86/xaa/xaaBitBlt.c            |    4 -
 hw/xfree86/xaa/xaaCpyArea.c           |   26 ++++----
 hw/xfree86/xaa/xaaCpyWin.c            |    4 -
 hw/xfree86/xaa/xaaNonTEText.c         |    4 -
 hw/xfree86/xaa/xaaOverlay.c           |    4 -
 hw/xfree86/xaa/xaaOverlayDF.c         |    8 +-
 hw/xfree86/xaa/xaaPCache.c            |   16 ++---
 hw/xfree86/xaa/xaaPict.c              |    4 -
 hw/xfree86/xaa/xaaTEGlyph.c           |    8 +-
 hw/xfree86/xf4bpp/mfbimggblt.c        |    4 -
 hw/xfree86/xf4bpp/ppcCpArea.c         |   30 ++++-----
 hw/xfree86/xf4bpp/ppcFillRct.c        |    4 -
 hw/xfree86/xf4bpp/ppcImg.c            |    4 -
 hw/xfree86/xf4bpp/ppcPixFS.c          |   22 +++---
 hw/xfree86/xf4bpp/ppcWinFS.c          |   22 +++---
 hw/xfree86/xf4bpp/ppcWindow.c         |    6 -
 hw/xfree86/xf8_32bpp/cfbcpyarea.c     |   26 ++++----
 hw/xfree86/xf8_32bpp/cfbwindow.c      |    4 -
 hw/xprint/ps/PsText.c                 |    4 -
 hw/xwin/winwindow.c                   |    4 -
 include/os.h                          |    3 
 mfb/mfbbitblt.c                       |    4 -
 mfb/mfbblt.c                          |   26 ++++----
 mfb/mfbfillrct.c                      |    4 -
 mfb/mfbfillsp.c                       |  108 +++++++++++++++++-----------------
 mfb/mfbimggblt.c                      |    4 -
 mfb/mfbpixmap.c                       |    4 -
 mfb/mfbplygblt.c                      |    4 -
 mfb/mfbpushpxl.c                      |    4 -
 mfb/mfbwindow.c                       |    4 -
 mi/miarc.c                            |   22 +++---
 mi/mibank.c                           |   32 +++++-----
 mi/mibitblt.c                         |   42 ++++++-------
 mi/miexpose.c                         |   16 ++---
 mi/mifillarc.c                        |   40 ++++++------
 mi/mifillrct.c                        |   12 +--
 mi/mifpolycon.c                       |   18 ++---
 mi/miglblt.c                          |    4 -
 mi/mipolycon.c                        |   16 ++---
 mi/mipolygen.c                        |    6 -
 mi/mipolypnt.c                        |    4 -
 mi/mipolyrect.c                       |    4 -
 mi/mispans.c                          |    2 
 mi/miwideline.c                       |   20 +++---
 mi/mizerarc.c                         |   10 +--
 mi/mizerline.c                        |    8 +-
 miext/damage/damage.c                 |    4 -
 os/oscolor.c                          |   10 +--
 randr/rrproperty.c                    |    4 -
 record/record.c                       |   12 +--
 record/set.c                          |    4 -
 render/mitri.c                        |    8 +-
 render/render.c                       |   44 ++++++-------
 xkb/xkb.c                             |   24 +++----
 xkb/xkbInit.c                         |    4 -
 115 files changed, 777 insertions(+), 780 deletions(-)

New commits:
commit 5e363500c86042c394595e1a6633581eb8fcd1bb
Author: Daniel Stone <daniel at 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.

diff --git a/include/os.h b/include/os.h
index a87b739..c53a9ea 100644
--- a/include/os.h
+++ b/include/os.h
@@ -50,9 +50,6 @@ SOFTWARE.
 #define OS_H
 
 #include "misc.h"
-#define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size))
-#define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr))
-#include <X11/Xalloca.h>
 #include <stdarg.h>
 
 #define NullFID ((FID) 0)
commit 83e5d9e75d0fa1135e2c9d8b59caee98c3291681
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:36:54 2007 +0000

    DIX: Remove last alloca call
    
    Replace with heap allocations.

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 1a3b4ab..5c4f8e4 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -406,7 +406,7 @@ Dispatch(void)
     InitSelections();
     nClients = 0;
 
-    clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients);
+    clientReady = (int *) xalloc(sizeof(int) * MaxClients);
     if (!clientReady)
 	return;
 
@@ -535,7 +535,7 @@ Dispatch(void)
     ddxBeforeReset ();
 #endif
     KillAllClients();
-    DEALLOCATE_LOCAL(clientReady);
+    xfree(clientReady);
     dispatchException &= ~DE_RESET;
 #ifdef XSERVER_DTRACE
     FreeRequestNames();
commit 1179ddea94efae6606162e9a1b0f2bf752ae4dd0
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:36:36 2007 +0000

    EXA: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 6314b97..ae951ed 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -497,7 +497,7 @@ exaCopyNtoN (DrawablePtr    pSrcDrawable,
 
     if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
 				       pGC->fillStyle, pGC->alu)) {
-	xRectangle *rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle));
+	xRectangle *rects = xalloc(nbox * sizeof(xRectangle));
 
 	if (rects) {
 	    int i;
@@ -510,7 +510,7 @@ exaCopyNtoN (DrawablePtr    pSrcDrawable,
 	    }
 
 	    region  = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED);
-	    DEALLOCATE_LOCAL(rects);
+	    xfree(rects);
 	}
     }
 
commit 1eb6a1d0d2817cd0ce96fb27db3ceb2d0ff024af
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:18:35 2007 +0000

    XTrap: Remove usage of alloca
    
    Replace with xalloc/xfree.

diff --git a/XTrap/xtrapdi.c b/XTrap/xtrapdi.c
index 23d3bde..80124fa 100644
--- a/XTrap/xtrapdi.c
+++ b/XTrap/xtrapdi.c
@@ -2030,7 +2030,7 @@ static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req)
     }
     nmasks = creq->planes;
     length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
-    data = (XETrapDatum *)ALLOCATE_LOCAL(sizeof(XETrapDatum)+length);
+    data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length);
     if (!data)
     {
         SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
@@ -2048,7 +2048,7 @@ static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req)
     {
         SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
             req->reqType, 0L, retval);
-        DEALLOCATE_LOCAL(data);
+        xfree(data);
         return;
     }
     crep = (xAllocColorCellsReply *)&(data->u.reply);
@@ -2073,7 +2073,7 @@ static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req)
         SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
             req->reqType, 0L, XETrapErrorBase + BadIO);
     }
-    DEALLOCATE_LOCAL(data);
+    xfree(data);
 }
 static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req)
 {   /* adapted from ProcAllocColorPlanes() in dispatch.c */
@@ -2101,7 +2101,7 @@ static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req)
         return;
     }
     length = (long)npixels * sizeof(Pixel);
-    data = (XETrapDatum *)ALLOCATE_LOCAL(sizeof(XETrapDatum)+length);
+    data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length);
     if (!data)
     {
         SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
@@ -2121,7 +2121,7 @@ static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req)
     {
         SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
             req->reqType, 0L, retval);
-        DEALLOCATE_LOCAL(data);
+        xfree(data);
         return;
     }
     crep->nPixels = npixels;
@@ -2146,6 +2146,6 @@ static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req)
         SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
             req->reqType, 0L, XETrapErrorBase + BadIO);
     }
-    DEALLOCATE_LOCAL(data);
+    xfree(data);
 }
 #endif /* COLOR_REPLIES */
commit 934281126f6c602fa4bd0c2e29d8c9f44fe532b8
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:18:22 2007 +0000

    Xext: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/Xext/mbuf.c b/Xext/mbuf.c
index f9ff085..7296560 100644
--- a/Xext/mbuf.c
+++ b/Xext/mbuf.c
@@ -524,12 +524,12 @@ ProcDisplayImageBuffers (client)
 	return Success;
     minDelay = stuff->minDelay;
     ids = (XID *) &stuff[1];
-    ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr));
-    pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
+    ppMultibuffers = (MultibuffersPtr *) xalloc(nbuf * sizeof (MultibuffersPtr));
+    pMultibuffer = (MultibufferPtr *) xalloc(nbuf * sizeof (MultibufferPtr));
     if (!ppMultibuffers || !pMultibuffer)
     {
-	if (ppMultibuffers) DEALLOCATE_LOCAL(ppMultibuffers);
-	if (pMultibuffer)   DEALLOCATE_LOCAL(pMultibuffer);
+	if (ppMultibuffers) xfree(ppMultibuffers);
+	if (pMultibuffer)   xfree(pMultibuffer);
 	client->errorValue = 0;
 	return BadAlloc;
     }
@@ -541,8 +541,8 @@ ProcDisplayImageBuffers (client)
 MultibufferResType);
 	if (!pMultibuffer[i])
 	{
-	    DEALLOCATE_LOCAL(ppMultibuffers);
-	    DEALLOCATE_LOCAL(pMultibuffer);
+	    xfree(ppMultibuffers);
+	    xfree(pMultibuffer);
 	    client->errorValue = ids[i];
 	    return MultibufferErrorBase + MultibufferBadBuffer;
 	}
@@ -551,8 +551,8 @@ MultibufferResType);
 	{
 	    if (ppMultibuffers[i] == ppMultibuffers[j])
 	    {
-	    	DEALLOCATE_LOCAL(ppMultibuffers);
-	    	DEALLOCATE_LOCAL(pMultibuffer);
+	    	xfree(ppMultibuffers);
+	    	xfree(pMultibuffer);
 		client->errorValue = ids[i];
 	    	return BadMatch;
 	    }
@@ -571,8 +571,8 @@ MultibufferResType);
     else
 	PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
 
-    DEALLOCATE_LOCAL(ppMultibuffers);
-    DEALLOCATE_LOCAL(pMultibuffer);
+    xfree(ppMultibuffers);
+    xfree(pMultibuffer);
     return Success;
 }
 
@@ -665,7 +665,7 @@ ProcGetMBufferAttributes (client)
     pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
     if (!pMultibuffers)
 	return BadAccess;
-    ids = (XID *) ALLOCATE_LOCAL (pMultibuffers->numMultibuffer * sizeof (XID));
+    ids = (XID *) xalloc (pMultibuffers->numMultibuffer * sizeof (XID));
     if (!ids)
 	return BadAlloc;
     for (i = 0; i < pMultibuffers->numMultibuffer; i++)
@@ -688,7 +688,7 @@ ProcGetMBufferAttributes (client)
 		   (char *)&rep);
     WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)),
 		   (char *)ids);
-    DEALLOCATE_LOCAL((pointer) ids);
+    xfree((pointer) ids);
     return client->noClientException;
 }
 
@@ -803,7 +803,7 @@ ProcGetBufferInfo (client)
 	nInfo += pDepth->numVids;
     }
     pInfo = (xMbufBufferInfo *)
-		ALLOCATE_LOCAL (nInfo * sizeof (xMbufBufferInfo));
+		xalloc (nInfo * sizeof (xMbufBufferInfo));
     if (!pInfo)
 	return BadAlloc;
 
@@ -839,7 +839,7 @@ ProcGetBufferInfo (client)
     }
     WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (pointer) &rep);
     WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (pointer) pInfo);
-    DEALLOCATE_LOCAL ((pointer) pInfo);
+    xfree ((pointer) pInfo);
     return client->noClientException;
 }
 
@@ -1256,7 +1256,7 @@ DisplayImageBuffers (ids, nbuf)
     MultibuffersPtr *pMultibuffers;
     int		    i, j;
 
-    pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL (nbuf * sizeof *pMultibuffer +
+    pMultibuffer = (MultibufferPtr *) xalloc (nbuf * sizeof *pMultibuffer +
 				   nbuf * sizeof *pMultibuffers);
     if (!pMultibuffer)
 	return BadAlloc;
@@ -1266,19 +1266,19 @@ DisplayImageBuffers (ids, nbuf)
 	pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType);
 	if (!pMultibuffer[i])
 	{
-	    DEALLOCATE_LOCAL (pMultibuffer);
+	    xfree (pMultibuffer);
 	    return MultibufferErrorBase + MultibufferBadBuffer;
 	}
 	pMultibuffers[i] = pMultibuffer[i]->pMultibuffers;
 	for (j = 0; j < i; j++)
 	    if (pMultibuffers[i] == pMultibuffers[j])
 	    {
-		DEALLOCATE_LOCAL (pMultibuffer);
+		xfree (pMultibuffer);
 		return BadMatch;
 	    }
     }
     PerformDisplayRequest (pMultibuffers, pMultibuffer, nbuf);
-    DEALLOCATE_LOCAL (pMultibuffer);
+    xfree (pMultibuffer);
     return Success;
 }
 
@@ -1382,7 +1382,7 @@ MultibufferExpose (pMultibuffer, pRegion)
 	numRects = REGION_NUM_RECTS(pRegion);
 	pBox = REGION_RECTS(pRegion);
 
-	pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent));
+	pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent));
 	if (pEvent) {
 	    pe = pEvent;
 
@@ -1398,7 +1398,7 @@ MultibufferExpose (pMultibuffer, pRegion)
 	    }
 	    (void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects,
 					       ExposureMask);
-	    DEALLOCATE_LOCAL(pEvent);
+	    xfree(pEvent);
 	}
     }
 }
diff --git a/Xext/mbufbf.c b/Xext/mbufbf.c
index b879abc..a3b3de7 100644
--- a/Xext/mbufbf.c
+++ b/Xext/mbufbf.c
@@ -614,7 +614,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
     if (!pGC)
 	return;
 
-    prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) *
+    prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) *
 					 sizeof(xRectangle));
     if (!prect)
     {
@@ -638,7 +638,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum)
     prect -= numRects;
     (* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect);
 
-    DEALLOCATE_LOCAL(prect);
+    xfree(prect);
     FreeScratchGC (pGC);
 }
 
diff --git a/Xext/mbufpx.c b/Xext/mbufpx.c
index a04b97d..21d5259 100644
--- a/Xext/mbufpx.c
+++ b/Xext/mbufpx.c
@@ -263,7 +263,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
     int nrects  = REGION_NUM_RECTS(pRegion);
     BoxPtr pbox = REGION_RECTS(pRegion);
 
-    pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
+    pRects = (xRectangle *)xalloc(nrects * sizeof(xRectangle));
     if (pRects)
     {
 	int i;
@@ -275,7 +275,7 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
 	    pRects[i].height = pbox->y2 - pbox->y1;
 	}
 	MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects);
-	DEALLOCATE_LOCAL(pRects);
+	xfree(pRects);
     }
 }
 
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 1c53a1e..f51f656 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -1272,7 +1272,7 @@ int PanoramiXPolyPoint(ClientPtr client)
     isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
     npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
     if (npoint > 0) {
-        origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
+        origPts = (xPoint *) xalloc(npoint * sizeof(xPoint));
         memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1299,7 +1299,7 @@ int PanoramiXPolyPoint(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyPoint])(client);
 	    if(result != Success) break;
         }
-        DEALLOCATE_LOCAL(origPts);
+        xfree(origPts);
         return (result);
     } else
 	return (client->noClientException);
@@ -1330,7 +1330,7 @@ int PanoramiXPolyLine(ClientPtr client)
     isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
     npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
     if (npoint > 0){
-        origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
+        origPts = (xPoint *) xalloc(npoint * sizeof(xPoint));
         memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1357,7 +1357,7 @@ int PanoramiXPolyLine(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyLine])(client);
 	    if(result != Success) break;
         }
-        DEALLOCATE_LOCAL(origPts);
+        xfree(origPts);
         return (result);
    } else
 	return (client->noClientException);
@@ -1391,7 +1391,7 @@ int PanoramiXPolySegment(ClientPtr client)
     if(nsegs & 4) return BadLength;
     nsegs >>= 3;
     if (nsegs > 0) {
-	origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment));
+	origSegs = (xSegment *) xalloc(nsegs * sizeof(xSegment));
         memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1418,7 +1418,7 @@ int PanoramiXPolySegment(ClientPtr client)
 	    result = (* SavedProcVector[X_PolySegment])(client);
 	    if(result != Success) break;
     	}
-	DEALLOCATE_LOCAL(origSegs);
+	xfree(origSegs);
 	return (result);
     } else
 	  return (client->noClientException);
@@ -1453,7 +1453,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
     if(nrects & 4) return BadLength;
     nrects >>= 3;
     if (nrects > 0){
-	origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
+	origRecs = (xRectangle *) xalloc(nrects * sizeof(xRectangle));
 	memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1479,7 +1479,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyRectangle])(client);
 	    if(result != Success) break;
 	}
-	DEALLOCATE_LOCAL(origRecs);
+	xfree(origRecs);
 	return (result);
     } else
        return (client->noClientException);
@@ -1513,7 +1513,7 @@ int PanoramiXPolyArc(ClientPtr client)
     if(narcs % sizeof(xArc)) return BadLength;
     narcs /= sizeof(xArc);
     if (narcs > 0){
-	origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+	origArcs = (xArc *) xalloc(narcs * sizeof(xArc));
 	memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1537,7 +1537,7 @@ int PanoramiXPolyArc(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyArc])(client);
 	    if(result != Success) break;
         }
-	DEALLOCATE_LOCAL(origArcs);
+	xfree(origArcs);
 	return (result);
     } else
        return (client->noClientException);
@@ -1569,7 +1569,7 @@ int PanoramiXFillPoly(ClientPtr client)
 
     count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
     if (count > 0){
-	locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec));
+	locPts = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec));
 	memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1596,7 +1596,7 @@ int PanoramiXFillPoly(ClientPtr client)
 	    result = (* SavedProcVector[X_FillPoly])(client);
 	    if(result != Success) break;
 	}
-	DEALLOCATE_LOCAL(locPts);
+	xfree(locPts);
 	return (result);
     } else
        return (client->noClientException);
@@ -1630,7 +1630,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
     if(things & 4) return BadLength;
     things >>= 3;
     if (things > 0){
-	origRects = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle));
+	origRects = (xRectangle *) xalloc(things * sizeof(xRectangle));
 	memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1655,7 +1655,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyFillRectangle])(client);
 	    if(result != Success) break;
 	}
-	DEALLOCATE_LOCAL(origRects);
+	xfree(origRects);
 	return (result);
     } else
        return (client->noClientException);
@@ -1689,7 +1689,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
     IF_RETURN((narcs % sizeof(xArc)), BadLength);
     narcs /= sizeof(xArc);
     if (narcs > 0) {
-	origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+	origArcs = (xArc *) xalloc(narcs * sizeof(xArc));
 	memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1714,7 +1714,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyFillArc])(client);
 	    if(result != Success) break;
 	}
-	DEALLOCATE_LOCAL(origArcs);
+	xfree(origArcs);
 	return (result);
     } else
        return (client->noClientException);
diff --git a/Xext/saver.c b/Xext/saver.c
index a9f1dd3..a590583 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -673,7 +673,7 @@ CreateSaverWindow (pScreen)
     wantMap = wColormap (pWin);
     if (wantMap == None)
 	return TRUE;
-    installedMaps = (Colormap *) ALLOCATE_LOCAL (pScreen->maxInstalledCmaps *
+    installedMaps = (Colormap *) xalloc (pScreen->maxInstalledCmaps *
 						 sizeof (Colormap));
     numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
 						    (pScreen, installedMaps);
@@ -681,7 +681,7 @@ CreateSaverWindow (pScreen)
 	if (installedMaps[i] == wantMap)
 	    break;
 
-    DEALLOCATE_LOCAL ((char *) installedMaps);
+    xfree ((char *) installedMaps);
 
     if (i < numInstalled)
 	return TRUE;
diff --git a/Xext/shape.c b/Xext/shape.c
index 928eeee..6515a10 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -1060,7 +1060,7 @@ ProcShapeGetRectangles (client)
     }
     if (!region) {
 	nrects = 1;
-	rects = (xRectangle *) ALLOCATE_LOCAL (sizeof (xRectangle));
+	rects = (xRectangle *) xalloc (sizeof (xRectangle));
 	if (!rects)
 	    return BadAlloc;
 	switch (stuff->kind) {
@@ -1087,7 +1087,7 @@ ProcShapeGetRectangles (client)
 	BoxPtr box;
 	nrects = REGION_NUM_RECTS(region);
 	box = REGION_RECTS(region);
-	rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle));
+	rects = (xRectangle *) xalloc (nrects * sizeof (xRectangle));
 	if (!rects && nrects)
 	    return BadAlloc;
 	for (i = 0; i < nrects; i++, box++) {
@@ -1110,7 +1110,7 @@ ProcShapeGetRectangles (client)
     }
     WriteToClient (client, sizeof (rep), (char *) &rep);
     WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
-    DEALLOCATE_LOCAL (rects);
+    xfree (rects);
     return client->noClientException;
 }
 
diff --git a/Xext/sync.c b/Xext/sync.c
index d9b6a9f..e87e0bd 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -601,7 +601,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events)
     if (client->clientGone)
 	return;
     pev = pEvents = (xSyncCounterNotifyEvent *)
-		 ALLOCATE_LOCAL(num_events * sizeof(xSyncCounterNotifyEvent));
+		 xalloc(num_events * sizeof(xSyncCounterNotifyEvent));
     if (!pEvents) 
 	return;
     UpdateCurrentTime();
@@ -622,7 +622,7 @@ SyncSendCounterNotifyEvents(client, ppAwait, num_events)
     }
     /* swapping will be taken care of by this */
     WriteEventsToClient(client, num_events, (xEvent *)pEvents);
-    DEALLOCATE_LOCAL(pEvents);
+    xfree(pEvents);
 }
 
 
@@ -732,7 +732,7 @@ SyncAwaitTriggerFired(pTrigger)
 
     pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
     numwaits = pAwaitUnion->header.num_waitconditions;
-    ppAwait = (SyncAwait **)ALLOCATE_LOCAL(numwaits * sizeof(SyncAwait *));
+    ppAwait = (SyncAwait **)xalloc(numwaits * sizeof(SyncAwait *));
     if (!ppAwait)
 	goto bail;
 
@@ -801,7 +801,7 @@ SyncAwaitTriggerFired(pTrigger)
     if (num_events)
 	SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
 				    num_events);
-    DEALLOCATE_LOCAL(ppAwait);
+    xfree(ppAwait);
 
 bail:
     /* unblock the client */
@@ -1396,7 +1396,7 @@ ProcSyncListSystemCounters(client)
 
     if (len)
     {
-	walklist = list = (xSyncSystemCounter *) ALLOCATE_LOCAL(len);
+	walklist = list = (xSyncSystemCounter *) xalloc(len);
 	if (!list)
 	    return BadAlloc;
     }
@@ -1442,7 +1442,7 @@ ProcSyncListSystemCounters(client)
     if (len) 
     {
 	WriteToClient(client, len, (char *) list);
-	DEALLOCATE_LOCAL(list);
+	xfree(list);
     }
 
     return (client->noClientException);
diff --git a/Xext/xace.c b/Xext/xace.c
index 6385631..00c3b8f 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -437,7 +437,7 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
 
 	/* convert region to list-of-rectangles for PolyFillRect */
 
-	pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *));
+	pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle *));
 	if (!pRects)
 	{
 	    failed = TRUE;
@@ -489,7 +489,7 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
 	     */
 	    bzero(pBuf, (int)(widthBytesLine * h));
 	}
-	if (pRects)     DEALLOCATE_LOCAL(pRects);
+	if (pRects)     xfree(pRects);
 	if (pScratchGC) FreeScratchGC(pScratchGC);
 	if (pPix)       FreeScratchPixmapHeader(pPix);
     }
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index c2f891a..b20e82d 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -491,7 +491,7 @@ ProcXF86BigfontQueryFont(
 	    } else {
 #endif
 		pCI = (xCharInfo *)
-		      ALLOCATE_LOCAL(nCharInfos * sizeof(xCharInfo));
+		      xalloc(nCharInfos * sizeof(xCharInfo));
 		if (!pCI)
 		    return BadAlloc;
 #ifdef HAS_SHM
@@ -554,9 +554,9 @@ ProcXF86BigfontQueryFont(
 		hashModulus = nCharInfos+1;
 
 	    tmp = (CARD16*)
-		  ALLOCATE_LOCAL((4*nCharInfos+1) * sizeof(CARD16));
+		  xalloc((4*nCharInfos+1) * sizeof(CARD16));
 	    if (!tmp) {
-		if (!pDesc) DEALLOCATE_LOCAL(pCI);
+		if (!pDesc) xfree(pCI);
 		return BadAlloc;
 	    }
 	    pIndex2UniqIndex = tmp;
@@ -639,12 +639,12 @@ ProcXF86BigfontQueryFont(
 	        + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
 	      : 0);
 	xXF86BigfontQueryFontReply* reply =
-	   (xXF86BigfontQueryFontReply *) ALLOCATE_LOCAL(rlength);
+	   (xXF86BigfontQueryFontReply *) xalloc(rlength);
 	char* p;
 	if (!reply) {
 	    if (nCharInfos > 0) {
-		if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex);
-		if (!pDesc) DEALLOCATE_LOCAL(pCI);
+		if (shmid == -1) xfree(pIndex2UniqIndex);
+		if (!pDesc) xfree(pCI);
 	    }
 	    return BadAlloc;
 	}
@@ -722,10 +722,10 @@ ProcXF86BigfontQueryFont(
 	    }
 	}
 	WriteToClient(client, rlength, (char *)reply);
-	DEALLOCATE_LOCAL(reply);
+	xfree(reply);
 	if (nCharInfos > 0) {
-	    if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex);
-	    if (!pDesc) DEALLOCATE_LOCAL(pCI);
+	    if (shmid == -1) xfree(pIndex2UniqIndex);
+	    if (!pDesc) xfree(pCI);
 	}
 	return (client->noClientException);
     }
diff --git a/Xext/xres.c b/Xext/xres.c
index 1617337..32cc903 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -63,7 +63,7 @@ ProcXResQueryClients (ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXResQueryClientsReq);
 
-    current_clients = ALLOCATE_LOCAL((currentMaxClients - 1) * sizeof(int));
+    current_clients = xalloc((currentMaxClients - 1) * sizeof(int));
 
     num_clients = 0;
     for(i = 1; i < currentMaxClients; i++) {
@@ -101,7 +101,7 @@ ProcXResQueryClients (ClientPtr client)
         }
     }
 
-    DEALLOCATE_LOCAL(current_clients);
+    xfree(current_clients);
 
     return (client->noClientException);
 }
@@ -134,7 +134,7 @@ ProcXResQueryClientResources (ClientPtr client)
         return BadValue;
     }
 
-    counts = ALLOCATE_LOCAL((lastResourceType + 1) * sizeof(int));
+    counts = xalloc((lastResourceType + 1) * sizeof(int));
 
     memset(counts, 0, (lastResourceType + 1) * sizeof(int));
 
@@ -183,7 +183,7 @@ ProcXResQueryClientResources (ClientPtr client)
         }
     }
 
-    DEALLOCATE_LOCAL(counts);
+    xfree(counts);
     
     return (client->noClientException);
 }
commit fb32bb9839b615f7297fbfac2050bc216682f01c
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:17:54 2007 +0000

    Xi: Remove usage of alloca
    
    Replace with xalloc/xfree.

diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 51d4248..ad2bec3 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -135,7 +135,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
     if (num_events) {
 	size = sizeof(Time) + (axes * sizeof(INT32));
 	tsize = num_events * size;
-	coords = (INT32 *) ALLOCATE_LOCAL(tsize);
+	coords = (INT32 *) xalloc(tsize);
 	if (!coords)
 	    return BadAlloc;
 	rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords,	/* XXX */
@@ -161,7 +161,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
 	WriteToClient(client, length * 4, (char *)coords);
     }
     if (coords)
-	DEALLOCATE_LOCAL(coords);
+	xfree(coords);
     return Success;
 }
 
commit 683ee1776d172035c465aa8fc84ccd53bb8ba7fd
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:14:25 2007 +0000

    afb: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/afb/afbbitblt.c b/afb/afbbitblt.c
index 2e416e3..d8b2ccd 100644
--- a/afb/afbbitblt.c
+++ b/afb/afbbitblt.c
@@ -279,7 +279,7 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable,
 	/* Do bit blitting */
 	numRects = REGION_NUM_RECTS(&rgnDst);
 	if (numRects && width && height) {
-		if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+		if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
 												  sizeof(DDXPointRec)))) {
 			REGION_UNINIT(pGC->pScreen, &rgnDst);
 			if (freeSrcClip)
@@ -296,7 +296,7 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable,
 		(*doBitBlt)(pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc,
 					 planemask);
 
-		DEALLOCATE_LOCAL(pptSrc);
+		xfree(pptSrc);
 	}
 
 	prgnExposed = NULL;
diff --git a/afb/afbblt.c b/afb/afbblt.c
index 9eb4e47..4e1a49e 100644
--- a/afb/afbblt.c
+++ b/afb/afbblt.c
@@ -132,12 +132,12 @@ MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
 
 		if (nbox > 1) {
 			/* keep ordering in each band, reverse order of bands */
-			pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
+			pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
 			if(!pboxNew1)
 				return;
-			pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
+			pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
 			if(!pptNew1) {
-				DEALLOCATE_LOCAL(pboxNew1);
+				xfree(pboxNew1);
 				return;
 			}
 			pboxBase = pboxNext = pbox+nbox-1;
@@ -169,16 +169,16 @@ MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
 
 		if (nbox > 1) {
 			/* reverse order of rects in each band */
-			pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
-			pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+			pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+			pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 			if(!pboxNew2 || !pptNew2) {
 				if (pptNew2)
-					DEALLOCATE_LOCAL(pptNew2);
+					xfree(pptNew2);
 				if (pboxNew2)
-					DEALLOCATE_LOCAL(pboxNew2);
+					xfree(pboxNew2);
 				if (pboxNew1) {
-					DEALLOCATE_LOCAL(pptNew1);
-					DEALLOCATE_LOCAL(pboxNew1);
+					xfree(pptNew1);
+					xfree(pboxNew1);
 				}
 				return;
 			}
@@ -553,11 +553,11 @@ bits1 = *--psrc; --pdst; \
 		pptSrc++;
 	}
 	if (pboxNew2) {
-		DEALLOCATE_LOCAL(pptNew2);
-		DEALLOCATE_LOCAL(pboxNew2);
+		xfree(pptNew2);
+		xfree(pboxNew2);
 	}
 	if (pboxNew1) {
-		DEALLOCATE_LOCAL(pptNew1);
-		DEALLOCATE_LOCAL(pboxNew1);
+		xfree(pptNew1);
+		xfree(pboxNew1);
 	}
 }
diff --git a/afb/afbfillrct.c b/afb/afbfillrct.c
index 06fb373..1600dea 100644
--- a/afb/afbfillrct.c
+++ b/afb/afbfillrct.c
@@ -111,7 +111,7 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre
 
 	numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
 	if (numRects > NUM_STACK_RECTS) {
-		pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+		pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
 		if (!pboxClippedBase)
 			return;
 	}
@@ -287,5 +287,5 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre
 		}
 	}
 	if (pboxClippedBase != stackRects)
-			DEALLOCATE_LOCAL(pboxClippedBase);
+			xfree(pboxClippedBase);
 }
diff --git a/afb/afbfillsp.c b/afb/afbfillsp.c
index 539c345..b001859 100644
--- a/afb/afbfillsp.c
+++ b/afb/afbfillsp.c
@@ -109,11 +109,11 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	unsigned char *rrops;
 
 	n = nInit * miFindMaxBand(pGC->pCompositeClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(n * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree) {
-		if (pptFree) DEALLOCATE_LOCAL(pptFree);
-		if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+		if (pptFree) xfree(pptFree);
+		if (pwidthFree) xfree(pwidthFree);
 		return;
 	}
 	pwidth = pwidthFree;
@@ -183,8 +183,8 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 		pwidth++;
 		ppt++;
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
 }
 
 void 
@@ -219,11 +219,11 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	unsigned char *rrops;
 
 	n = nInit * miFindMaxBand(pGC->pCompositeClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(n * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree) {
-		if (pptFree) DEALLOCATE_LOCAL(pptFree);
-		if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+		if (pptFree) xfree(pptFree);
+		if (pwidthFree) xfree(pwidthFree);
 		return;
 	}
 	pwidth = pwidthFree;
@@ -297,8 +297,8 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 		pwidth++;
 		ppt++;
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
 }
 
 void
@@ -333,11 +333,11 @@ afbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	int d;
 
 	n = nInit * miFindMaxBand(pGC->pCompositeClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(n * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree) {
-		if (pptFree) DEALLOCATE_LOCAL(pptFree);
-		if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+		if (pptFree) xfree(pptFree);
+		if (pwidthFree) xfree(pwidthFree);
 		return;
 	}
 	pwidth = pwidthFree;
@@ -428,8 +428,8 @@ afbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 				break;
 			}
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
 }
 
 void
@@ -465,11 +465,11 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	int d;
 
 	n = nInit * miFindMaxBand(pGC->pCompositeClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(n * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree) {
-		if (pptFree) DEALLOCATE_LOCAL(pptFree);
-		if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+		if (pptFree) xfree(pptFree);
+		if (pwidthFree) xfree(pwidthFree);
 		return;
 	}
 	pwidth = pwidthFree;
@@ -587,8 +587,8 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 				break;
 			}
 	} /* switch (rop) */
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
 }
 
 /* Fill spans with tiles that aren't PPW bits wide */
@@ -626,11 +626,11 @@ afbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	register int d;
 
 	n = nInit * miFindMaxBand(pGC->pCompositeClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(n * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree) {
-		if (pptFree) DEALLOCATE_LOCAL(pptFree);
-		if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+		if (pptFree) xfree(pptFree);
+		if (pwidthFree) xfree(pwidthFree);
 		return;
 	}
 	pwidth = pwidthFree;
@@ -732,8 +732,8 @@ afbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 		ppt++;
 		pwidth++;
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
 }
 
 /* Fill spans with stipples that aren't PPW bits wide */
@@ -772,11 +772,11 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	int depthDst;
 
 	n = nInit * miFindMaxBand(pGC->pCompositeClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(n * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree) {
-		if (pptFree) DEALLOCATE_LOCAL(pptFree);
-		if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+		if (pptFree) xfree(pptFree);
+		if (pwidthFree) xfree(pwidthFree);
 		return;
 	}
 	pwidth = pwidthFree;
@@ -877,8 +877,8 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 		ppt++;
 		pwidth++;
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
 }
 
 /* Fill spans with OpaqueStipples that aren't PPW bits wide */
@@ -918,11 +918,11 @@ afbUnnaturalOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	int depthDst;
 
 	n = nInit * miFindMaxBand(pGC->pCompositeClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(n * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree) {
-		if (pptFree) DEALLOCATE_LOCAL(pptFree);
-		if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+		if (pptFree) xfree(pptFree);
+		if (pwidthFree) xfree(pwidthFree);
 		return;
 	}
 	pwidth = pwidthFree;
@@ -1124,6 +1124,6 @@ afbUnnaturalOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 		ppt++;
 		pwidth++;
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
 }
diff --git a/afb/afbimggblt.c b/afb/afbimggblt.c
index de02aa4..ca49ee3 100644
--- a/afb/afbimggblt.c
+++ b/afb/afbimggblt.c
@@ -298,7 +298,7 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 				int getWidth;				/* bits to get from glyph */
 #endif
 
-				if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS))))
+				if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS))))
 					return;
 
 				pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
@@ -462,7 +462,7 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 						} /* depth */
 					} /* for each glyph */
 				} /* while nbox-- */
-				DEALLOCATE_LOCAL(ppos);
+				xfree(ppos);
 				break;
 			}
 
diff --git a/afb/afbpixmap.c b/afb/afbpixmap.c
index b0ac801..d15d861 100644
--- a/afb/afbpixmap.c
+++ b/afb/afbpixmap.c
@@ -251,7 +251,7 @@ afbYRotatePixmap(pPix, rh)
 	nbyDown = rh * pPix->devKind;
 	nbyUp = (pPix->devKind * height) - nbyDown;
 
-	if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp)))
+	if(!(ptmp = (char *)xalloc(nbyUp)))
 		return;
 
 	for (d = 0; d < pPix->drawable.depth; d++) {
@@ -261,7 +261,7 @@ afbYRotatePixmap(pPix, rh)
 		memmove(pbase, pbase+nbyUp, nbyDown);		/* slide the top rows down */
 		memmove(pbase+nbyDown, ptmp, nbyUp);		/* move lower rows up to row rh */
 	}
-	DEALLOCATE_LOCAL(ptmp);
+	xfree(ptmp);
 }
 
 void
diff --git a/afb/afbplygblt.c b/afb/afbplygblt.c
index 289d50e..bcb08c7 100644
--- a/afb/afbplygblt.c
+++ b/afb/afbplygblt.c
@@ -278,7 +278,7 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 				int getWidth;				/* bits to get from glyph */
 #endif
 
-				if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS))))
+				if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS))))
 					return;
 
 				pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
@@ -453,7 +453,7 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 						} /* depth */
 					} /* for each glyph */
 				} /* while nbox-- */
-				DEALLOCATE_LOCAL(ppos);
+				xfree(ppos);
 				break;
 			}
 
diff --git a/afb/afbwindow.c b/afb/afbwindow.c
index 5c2f18a..61641ee 100644
--- a/afb/afbwindow.c
+++ b/afb/afbwindow.c
@@ -141,7 +141,7 @@ afbCopyWindow(pWin, ptOldOrg, prgnSrc)
 
 	pbox = REGION_RECTS(prgnDst);
 	nbox = REGION_NUM_RECTS(prgnDst);
-	if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+	if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
 		return;
 	ppt = pptSrc;
 
@@ -152,7 +152,7 @@ afbCopyWindow(pWin, ptOldOrg, prgnSrc)
 
 	afbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, prgnDst,
 					 pptSrc, ~0);
-	DEALLOCATE_LOCAL(pptSrc);
+	xfree(pptSrc);
 	REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
 }
 
commit ca75261beedc3e00767b3812a81b7dac4437f4a1
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:14:04 2007 +0000

    cfb: Remove usage of alloca
    
    Replace with xalloc/xfree.

diff --git a/cfb/cfbbitblt.c b/cfb/cfbbitblt.c
index d86f9df..00bf413 100644
--- a/cfb/cfbbitblt.c
+++ b/cfb/cfbbitblt.c
@@ -296,7 +296,7 @@ cfbBitBlt (
     numRects = REGION_NUM_RECTS(&rgnDst);
     if (numRects && width && height)
     {
-	if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
 						  sizeof(DDXPointRec))))
 	{
 	    REGION_UNINIT(pGC->pScreen, &rgnDst);
@@ -313,7 +313,7 @@ cfbBitBlt (
 	}
 
 	(*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask);
-	DEALLOCATE_LOCAL(pptSrc);
+	xfree(pptSrc);
     }
 
     prgnExposed = NULL;
@@ -559,7 +559,7 @@ cfbCopyPlaneReduce (
     numRects = REGION_NUM_RECTS(&rgnDst);
     if (numRects && width && height)
     {
-	if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
 						  sizeof(DDXPointRec))))
 	{
 	    REGION_UNINIT(pGC->pScreen, &rgnDst);
@@ -576,7 +576,7 @@ cfbCopyPlaneReduce (
 	}
 
 	(*doCopyPlane) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane);
-	DEALLOCATE_LOCAL(pptSrc);
+	xfree(pptSrc);
     }
 
     prgnExposed = NULL;
diff --git a/cfb/cfbblt.c b/cfb/cfbblt.c
index 1e577f5..ff34589 100644
--- a/cfb/cfbblt.c
+++ b/cfb/cfbblt.c
@@ -207,13 +207,13 @@ MROP_NAME(cfbDoBitblt)(
 	if (nbox > 1)
 	{
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
-	    pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pptNew1)
 	    {
-	        DEALLOCATE_LOCAL(pboxNew1);
+	        xfree(pboxNew1);
 	        return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -251,16 +251,16 @@ MROP_NAME(cfbDoBitblt)(
 	if (nbox > 1)
 	{
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pboxNew2 || !pptNew2)
 	    {
-		if (pptNew2) DEALLOCATE_LOCAL(pptNew2);
-		if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2);
+		if (pptNew2) xfree(pptNew2);
+		if (pboxNew2) xfree(pboxNew2);
 		if (pboxNew1)
 		{
-		    DEALLOCATE_LOCAL(pptNew1);
-		    DEALLOCATE_LOCAL(pboxNew1);
+		    xfree(pptNew1);
+		    xfree(pboxNew1);
 		}
 	        return;
 	    }
@@ -922,12 +922,12 @@ bits1 = *--psrc; --pdst; \
     }
     if (pboxNew2)
     {
-	DEALLOCATE_LOCAL(pptNew2);
-	DEALLOCATE_LOCAL(pboxNew2);
+	xfree(pptNew2);
+	xfree(pboxNew2);
     }
     if (pboxNew1)
     {
-	DEALLOCATE_LOCAL(pptNew1);
-	DEALLOCATE_LOCAL(pboxNew1);
+	xfree(pptNew1);
+	xfree(pboxNew1);
     }
 }
diff --git a/cfb/cfbfillrct.c b/cfb/cfbfillrct.c
index 4c78c24..fc2d31b 100644
--- a/cfb/cfbfillrct.c
+++ b/cfb/cfbfillrct.c
@@ -196,7 +196,7 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
     numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
     if (numRects > NUM_STACK_RECTS)
     {
-	pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
 	if (!pboxClippedBase)
 	    return;
     }
@@ -301,5 +301,5 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
 	(*BoxFill) (pDrawable, pGC,
 		    pboxClipped-pboxClippedBase, pboxClippedBase);
     if (pboxClippedBase != stackRects)
-    	DEALLOCATE_LOCAL(pboxClippedBase);
+    	xfree(pboxClippedBase);
 }
diff --git a/cfb/cfbfillsp.c b/cfb/cfbfillsp.c
index ddd4f14..36710b6 100644
--- a/cfb/cfbfillsp.c
+++ b/cfb/cfbfillsp.c
@@ -186,12 +186,12 @@ int fSorted;
     n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
     if ( n == 0 )
 	return;
-    pwidth = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    ppt = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidth = (int *)xalloc(n * sizeof(int));
+    ppt = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!ppt || !pwidth)
     {
-	if (ppt) DEALLOCATE_LOCAL(ppt);
-	if (pwidth) DEALLOCATE_LOCAL(pwidth);
+	if (ppt) xfree(ppt);
+	if (pwidth) xfree(pwidth);
 	return;
     }
     n = miClipSpans( cfbGetCompositeClip(pGC),
@@ -203,8 +203,8 @@ int fSorted;
 
     (*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
 
-    DEALLOCATE_LOCAL(ppt);
-    DEALLOCATE_LOCAL(pwidth);
+    xfree(ppt);
+    xfree(pwidth);
 }
 
 #if PSZ == 8
@@ -251,12 +251,12 @@ int fSorted;
     n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
     if ( n == 0 )
 	return;
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
 
@@ -392,8 +392,8 @@ int fSorted;
 	    }
 	}
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 #else /* PSZ != 8 */
@@ -434,12 +434,12 @@ int fSorted;
     n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
     if ( n == 0 )
 	return;
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -599,8 +599,8 @@ int fSorted;
 	ppt++;
 	pwidth++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 #endif /* PSZ == 8 */
@@ -648,12 +648,12 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
     if ( n == 0 )
 	return;
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -816,8 +816,8 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	    }
 	}
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 void
@@ -862,12 +862,12 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
     if ( n == 0 )
 	return;
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -997,8 +997,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	    }
 	}
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 #endif /* PSZ == 8 */
diff --git a/cfb/cfbglblt8.c b/cfb/cfbglblt8.c
index c4cba0e..4d964b3 100644
--- a/cfb/cfbglblt8.c
+++ b/cfb/cfbglblt8.c
@@ -355,7 +355,7 @@ cfbPolyGlyphBlt8Clipped(
     }
     if (!numRects)
 	return;
-    clips = (CARD32 *)ALLOCATE_LOCAL ((maxAscent + maxDescent) *
+    clips = (CARD32 *)xalloc ((maxAscent + maxDescent) *
 						sizeof (CARD32));
     while (nglyph--)
     {
@@ -471,7 +471,7 @@ cfbPolyGlyphBlt8Clipped(
 	    }
 	}
     }
-    DEALLOCATE_LOCAL (clips);
+    xfree (clips);
 }
 
 #endif /* FOUR_BIT_CODE */
diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c
index 36ed572..a7be7cc 100644
--- a/cfb/cfbpixmap.c
+++ b/cfb/cfbpixmap.c
@@ -270,7 +270,7 @@ cfbXRotatePixmap(pPix, rw)
 	int size, tsize;
 
 	tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth);
-	pwTmp = (CfbBits *) ALLOCATE_LOCAL(pPix->drawable.height * tsize);
+	pwTmp = (CfbBits *) xalloc(pPix->drawable.height * tsize);
 	if (!pwTmp)
 	    return;
 	/* divide pw (the pixmap) in two vertically at (w - rot) and swap */
@@ -288,7 +288,7 @@ cfbXRotatePixmap(pPix, rw)
 		    0, 0, rot, 0,
 		    (int)pPix->drawable.width - rot, (int)pPix->drawable.height,
 		    tsize, size);
-	DEALLOCATE_LOCAL(pwTmp);
+	xfree(pwTmp);
 #endif
     }
 }
@@ -328,13 +328,13 @@ cfbYRotatePixmap(pPix, rh)
 
     nbyDown = rot * pPix->devKind;
     nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown;
-    if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp)))
+    if(!(ptmp = (char *)xalloc(nbyUp)))
 	return;
 
     memmove(ptmp, pbase, nbyUp);		/* save the low rows */
     memmove(pbase, pbase+nbyUp, nbyDown);	/* slide the top rows down */
     memmove(pbase+nbyDown, ptmp, nbyUp);	/* move lower rows up to row rot */
-    DEALLOCATE_LOCAL(ptmp);
+    xfree(ptmp);
 }
 
 void
diff --git a/cfb/cfbsolid.c b/cfb/cfbsolid.c
index f0da05e..6b8238d 100644
--- a/cfb/cfbsolid.c
+++ b/cfb/cfbsolid.c
@@ -811,12 +811,12 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
     devPriv = cfbGetGCPrivate(pGC);
     RROP_FETCH_GCPRIV(devPriv)
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -1359,7 +1359,7 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	}
 #endif
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
     RROP_UNDECLARE
 }
diff --git a/cfb/cfbtile32.c b/cfb/cfbtile32.c
index 90439ad..be016a7 100644
--- a/cfb/cfbtile32.c
+++ b/cfb/cfbtile32.c
@@ -367,12 +367,12 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 #endif
 
     n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -512,6 +512,6 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	    }
     	}
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
diff --git a/cfb/cfbwindow.c b/cfb/cfbwindow.c
index c4f027b..2345012 100644
--- a/cfb/cfbwindow.c
+++ b/cfb/cfbwindow.c
@@ -133,7 +133,7 @@ cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
 
     pbox = REGION_RECTS(&rgnDst);
     nbox = REGION_NUM_RECTS(&rgnDst);
-    if(!nbox || !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+    if(!nbox || !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
     {
 	REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
 	return;
@@ -148,7 +148,7 @@ cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
 
     cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
 		GXcopy, &rgnDst, pptSrc, ~0L);
-    DEALLOCATE_LOCAL(pptSrc);
+    xfree(pptSrc);
     REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
 }
 
commit 914922fd6100a409a3dfd1c64511ed6bdc344bef
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:12:59 2007 +0000

    DIX: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/dix/colormap.c b/dix/colormap.c
index 73b6669..b27b8bc 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -751,7 +751,7 @@ UpdateColors (ColormapPtr pmap)
 
     pVisual = pmap->pVisual;
     size = pVisual->ColormapEntries;
-    defs = (xColorItem *)ALLOCATE_LOCAL(size * sizeof(xColorItem));
+    defs = (xColorItem *)xalloc(size * sizeof(xColorItem));
     if (!defs)
 	return;
     n = 0;
@@ -801,7 +801,7 @@ UpdateColors (ColormapPtr pmap)
     }
     if (n)
 	(*pmap->pScreen->StoreColors)(pmap, n, defs);
-    DEALLOCATE_LOCAL(defs);
+    xfree(defs);
 }
 
 /* Get a read-only color from a ColorMap (probably slow for large maps)
@@ -1752,14 +1752,14 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
     for(p = pixels; p < pixels + c; p++)
 	*p = 0;
 
-    ppixRed = (Pixel *)ALLOCATE_LOCAL(npixR * sizeof(Pixel));
-    ppixGreen = (Pixel *)ALLOCATE_LOCAL(npixG * sizeof(Pixel));
-    ppixBlue = (Pixel *)ALLOCATE_LOCAL(npixB * sizeof(Pixel));
+    ppixRed = (Pixel *)xalloc(npixR * sizeof(Pixel));
+    ppixGreen = (Pixel *)xalloc(npixG * sizeof(Pixel));
+    ppixBlue = (Pixel *)xalloc(npixB * sizeof(Pixel));
     if (!ppixRed || !ppixGreen || !ppixBlue)
     {
-	if (ppixBlue) DEALLOCATE_LOCAL(ppixBlue);
-	if (ppixGreen) DEALLOCATE_LOCAL(ppixGreen);
-	if (ppixRed) DEALLOCATE_LOCAL(ppixRed);
+	if (ppixBlue) xfree(ppixBlue);
+	if (ppixGreen) xfree(ppixGreen);
+	if (ppixRed) xfree(ppixRed);
 	return(BadAlloc);
     }
 
@@ -1797,9 +1797,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
 	if (okB)
 	    for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
 		pmap->blue[*ppix].refcnt = 0;
-	DEALLOCATE_LOCAL(ppixBlue);
-	DEALLOCATE_LOCAL(ppixGreen);
-	DEALLOCATE_LOCAL(ppixRed);
+	xfree(ppixBlue);
+	xfree(ppixGreen);
+	xfree(ppixRed);
 	return(BadAlloc);
     }
 
@@ -1841,9 +1841,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
     for (pDst = pixels; pDst < pixels + c; pDst++)
 	*pDst |= ALPHAMASK(pmap->pVisual);
 
-    DEALLOCATE_LOCAL(ppixBlue);
-    DEALLOCATE_LOCAL(ppixGreen);
-    DEALLOCATE_LOCAL(ppixRed);
+    xfree(ppixBlue);
+    xfree(ppixGreen);
+    xfree(ppixRed);
 
     return (Success);
 }
@@ -1859,7 +1859,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
     npix = c << r;
     if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
 	return(BadAlloc);
-    if(!(ppixTemp = (Pixel *)ALLOCATE_LOCAL(npix * sizeof(Pixel))))
+    if(!(ppixTemp = (Pixel *)xalloc(npix * sizeof(Pixel))))
 	return(BadAlloc);
     ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
 
@@ -1889,7 +1889,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
 	pmap->numPixelsRed[client] += npix;
 	pmap->freeRed -= npix;
     }
-    DEALLOCATE_LOCAL(ppixTemp);
+    xfree(ppixTemp);
     return (ok ? Success : BadAlloc);
 }
 
@@ -2089,7 +2089,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
 
     npixClientNew = c << (r + g + b);
     npixShared = (c << r) + (c << g) + (c << b);
-    psharedList = (SHAREDCOLOR **)ALLOCATE_LOCAL(npixShared *
+    psharedList = (SHAREDCOLOR **)xalloc(npixShared *
 						 sizeof(SHAREDCOLOR *));
     if (!psharedList)
 	return FALSE;
@@ -2204,7 +2204,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
 	    }
 	}
     }
-    DEALLOCATE_LOCAL(psharedList);
+    xfree(psharedList);
     return TRUE;
 }
 
@@ -2679,7 +2679,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
     Colormap	*pmaps;
     int		imap, nummaps, found;
 
-    pmaps = (Colormap *) ALLOCATE_LOCAL( 
+    pmaps = (Colormap *) xalloc( 
              pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap));
     if(!pmaps)
 	return(FALSE);
@@ -2694,6 +2694,6 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
 	    break;
 	}
     }
-    DEALLOCATE_LOCAL(pmaps);
+    xfree(pmaps);
     return (found);
 }
diff --git a/dix/devices.c b/dix/devices.c
index e05444e..9798b97 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1997,7 +1997,7 @@ ProcGetMotionEvents(ClientPtr client)
     {
 	if (CompareTimeStamps(stop, currentTime) == LATER)
 	    stop = currentTime;
-	coords = (xTimecoord *)ALLOCATE_LOCAL(mouse->valuator->numMotionEvents
+	coords = (xTimecoord *)xalloc(mouse->valuator->numMotionEvents
 					      * sizeof(xTimecoord));
 	if (!coords)
 	    return BadAlloc;
@@ -2031,7 +2031,7 @@ ProcGetMotionEvents(ClientPtr client)
 				 (char *)coords);
     }
     if (coords)
-	DEALLOCATE_LOCAL(coords);
+	xfree(coords);
     return Success;
 }
 
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index c21b3ec..f214ef5 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -777,7 +777,7 @@ finish:
     reply.nFonts = nnames;
     reply.sequenceNumber = client->sequence;
 
-    bufptr = bufferStart = (char *) ALLOCATE_LOCAL(reply.length << 2);
+    bufptr = bufferStart = (char *) xalloc(reply.length << 2);
 
     if (!bufptr && reply.length) {
 	SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
@@ -802,7 +802,7 @@ finish:
     client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
     WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
     (void) WriteToClient(client, stringLens + nnames, bufferStart);
-    DEALLOCATE_LOCAL(bufferStart);
+    xfree(bufferStart);
 
 bail:
     if (c->slept)
@@ -1797,7 +1797,7 @@ SetDefaultFontPath(char *path)
 
     /* get enough for string, plus values -- use up commas */
     len = strlen(path) + 1;
-    nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
+    nump = cp = newpath = (unsigned char *) xalloc(len);
     if (!newpath)
 	return BadAlloc;
     pp = (unsigned char *) path;
@@ -1818,7 +1818,7 @@ SetDefaultFontPath(char *path)
 
     err = SetFontPathElements(num, newpath, &bad, TRUE);
 
-    DEALLOCATE_LOCAL(newpath);
+    xfree(newpath);
 
     return err;
 }
diff --git a/dix/extension.c b/dix/extension.c
index 4c0c3d2..282d60a 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -364,7 +364,7 @@ ProcListExtensions(ClientPtr client)
 		total_length += strlen(extensions[i]->aliases[j]) + 1;
 	}
         reply.length = (total_length + 3) >> 2;
-	buffer = bufptr = (char *)ALLOCATE_LOCAL(total_length);
+	buffer = bufptr = (char *)xalloc(total_length);
 	if (!buffer)
 	    return(BadAlloc);
         for (i=0;  i<NumExtensions; i++)
@@ -388,7 +388,7 @@ ProcListExtensions(ClientPtr client)
     if (reply.length)
     {
         WriteToClient(client, total_length, buffer);
-    	DEALLOCATE_LOCAL(buffer);
+    	xfree(buffer);
     }
     return(client->noClientException);
 }
diff --git a/dix/grabs.c b/dix/grabs.c
index 2210cd0..70d2348 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -369,16 +369,16 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
 	i++;
     if (!i)
 	return TRUE;
-    deletes = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr));
-    adds = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr));
-    updates = (Mask ***)ALLOCATE_LOCAL(i * sizeof(Mask **));
-    details = (Mask **)ALLOCATE_LOCAL(i * sizeof(Mask *));
+    deletes = (GrabPtr *)xalloc(i * sizeof(GrabPtr));
+    adds = (GrabPtr *)xalloc(i * sizeof(GrabPtr));
+    updates = (Mask ***)xalloc(i * sizeof(Mask **));
+    details = (Mask **)xalloc(i * sizeof(Mask *));
     if (!deletes || !adds || !updates || !details)
     {
-	if (details) DEALLOCATE_LOCAL(details);
-	if (updates) DEALLOCATE_LOCAL(updates);
-	if (adds) DEALLOCATE_LOCAL(adds);
-	if (deletes) DEALLOCATE_LOCAL(deletes);
+	if (details) xfree(details);
+	if (updates) xfree(updates);
+	if (adds) xfree(adds);
+	if (deletes) xfree(deletes);
 	return FALSE;
     }
     ndels = nadds = nups = 0;
@@ -473,10 +473,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
 	    *updates[i] = details[i];
 	}
     }
-    DEALLOCATE_LOCAL(details);
-    DEALLOCATE_LOCAL(updates);
-    DEALLOCATE_LOCAL(adds);
-    DEALLOCATE_LOCAL(deletes);
+    xfree(details);
+    xfree(updates);
+    xfree(adds);
+    xfree(deletes);
     return ok;
 
 #undef UPDATE
diff --git a/dix/property.c b/dix/property.c
index e281dd7..994d3a7 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -122,7 +122,7 @@ ProcRotateProperties(ClientPtr client)
     if (!stuff->nAtoms)
 	return(Success);
     atoms = (Atom *) & stuff[1];
-    props = (PropertyPtr *)ALLOCATE_LOCAL(stuff->nAtoms * sizeof(PropertyPtr));
+    props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr));
     if (!props)
 	return(BadAlloc);
     for (i = 0; i < stuff->nAtoms; i++)
@@ -131,19 +131,19 @@ ProcRotateProperties(ClientPtr client)
 				DixReadAccess|DixWriteAccess);
 
         if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) {
-            DEALLOCATE_LOCAL(props);
+            xfree(props);
 	    client->errorValue = atoms[i];
             return BadAtom;
         }
 	if (XaceIgnoreOperation == action) {
-            DEALLOCATE_LOCAL(props);
+            xfree(props);
 	    return Success;
 	}
 
         for (j = i + 1; j < stuff->nAtoms; j++)
             if (atoms[j] == atoms[i])
             {
-                DEALLOCATE_LOCAL(props);
+                xfree(props);
                 return BadMatch;
             }
         pProp = wUserProps (pWin);
@@ -153,7 +153,7 @@ ProcRotateProperties(ClientPtr client)
                 goto found;
 	    pProp = pProp->next;
         }
-        DEALLOCATE_LOCAL(props);
+        xfree(props);
         return BadMatch;
 found: 
         props[i] = pProp;
@@ -175,7 +175,7 @@ found:
             props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
 	}
     }
-    DEALLOCATE_LOCAL(props);
+    xfree(props);
     return Success;
 }
 
@@ -575,7 +575,7 @@ ProcListProperties(ClientPtr client)
 	numProps++;
     }
     if (numProps)
-        if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom))))
+        if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
             return(BadAlloc);
 
     xlpr.type = X_Reply;
@@ -594,7 +594,7 @@ ProcListProperties(ClientPtr client)
     {
         client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
         WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
-        DEALLOCATE_LOCAL(pAtoms);
+        xfree(pAtoms);
     }
     return(client->noClientException);
 }
diff --git a/dix/resource.c b/dix/resource.c
index e83c529..c8297fb 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -507,13 +507,13 @@ RebuildTable(int client)
      */
 
     j = 2 * clientTable[client].buckets;
-    tails = (ResourcePtr **)ALLOCATE_LOCAL(j * sizeof(ResourcePtr *));
+    tails = (ResourcePtr **)xalloc(j * sizeof(ResourcePtr *));
     if (!tails)
 	return;
     resources = (ResourcePtr *)xalloc(j * sizeof(ResourcePtr));
     if (!resources)
     {
-	DEALLOCATE_LOCAL(tails);
+	xfree(tails);
 	return;
     }
     for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
@@ -536,7 +536,7 @@ RebuildTable(int client)
 	    *tptr = &res->next;
 	}
     }
-    DEALLOCATE_LOCAL(tails);
+    xfree(tails);
     clientTable[client].buckets *= 2;
     xfree(clientTable[client].resources);
     clientTable[client].resources = resources;
diff --git a/dix/swaprep.c b/dix/swaprep.c
index 7d3251a..91469e1 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -101,7 +101,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
     CARD32 tmpbuf[1];
     
     /* Allocate as big a buffer as we can... */
-    while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize)))
+    while (!(pbufT = (CARD32 *) xalloc(bufsize)))
     {
         bufsize >>= 1;
 	if (bufsize == 4)
@@ -133,7 +133,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
 	}
 
     if (pbufT != tmpbuf)
-	DEALLOCATE_LOCAL ((char *) pbufT);
+	xfree ((char *) pbufT);
 }
 
 /**
@@ -149,7 +149,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
     short tmpbuf[2];
     
     /* Allocate as big a buffer as we can... */
-    while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize)))
+    while (!(pbufT = (short *) xalloc(bufsize)))
     {
         bufsize >>= 1;
 	if (bufsize == 4)
@@ -181,7 +181,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
 	}
 
     if (pbufT != tmpbuf)
-	DEALLOCATE_LOCAL ((char *) pbufT);
+	xfree ((char *) pbufT);
 }
 
 
@@ -1267,7 +1267,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
 {
     char	*pInfoTBase;
 
-    pInfoTBase = (char *) ALLOCATE_LOCAL(size);
+    pInfoTBase = (char *) xalloc(size);
     if (!pInfoTBase)
     {
 	pClient->noClientException = -1;
@@ -1275,7 +1275,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
     }
     SwapConnSetupInfo(pInfo, pInfoTBase);
     (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
-    DEALLOCATE_LOCAL(pInfoTBase);
+    xfree(pInfoTBase);
 }
 
 _X_EXPORT void
commit 3b77689266e729411229ec83d2a90578ebc1d82f
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:12:34 2007 +0000

    EXA: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 5fb72d7..6314b97 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -619,7 +619,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	return;
     }
 
-    prect = ALLOCATE_LOCAL(sizeof(xRectangle) * npt);
+    prect = xalloc(sizeof(xRectangle) * npt);
     for (i = 0; i < npt; i++) {
 	prect[i].x = ppt[i].x;
 	prect[i].y = ppt[i].y;
@@ -631,7 +631,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	prect[i].height = 1;
     }
     pGC->ops->PolyFillRect(pDrawable, pGC, npt, prect);
-    DEALLOCATE_LOCAL(prect);
+    xfree(prect);
 }
 
 /**
@@ -654,7 +654,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	return;
     }
 
-    prect = ALLOCATE_LOCAL(sizeof(xRectangle) * (npt - 1));
+    prect = xalloc(sizeof(xRectangle) * (npt - 1));
     x1 = ppt[0].x;
     y1 = ppt[0].y;
     /* If we have any non-horizontal/vertical, fall back. */
@@ -668,7 +668,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	}
 
 	if (x1 != x2 && y1 != y2) {
-	    DEALLOCATE_LOCAL(prect);
+	    xfree(prect);
 	    ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
 	    return;
 	}
@@ -692,7 +692,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	y1 = y2;
     }
     pGC->ops->PolyFillRect(pDrawable, pGC, npt - 1, prect);
-    DEALLOCATE_LOCAL(prect);
+    xfree(prect);
 }
 
 /**
@@ -723,7 +723,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
 	}
     }
 
-    prect = ALLOCATE_LOCAL(sizeof(xRectangle) * nseg);
+    prect = xalloc(sizeof(xRectangle) * nseg);
     for (i = 0; i < nseg; i++) {
 	if (pSeg[i].x1 < pSeg[i].x2) {
 	    prect[i].x = pSeg[i].x1;
@@ -741,7 +741,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
 	}
     }
     pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
-    DEALLOCATE_LOCAL(prect);
+    xfree(prect);
 }
 
 static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
commit 34cdf06e4ccb243664005cc33009d8759a7f6e4d
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:12:22 2007 +0000

    fb: Remove usage of alloca
    
    Replace with heap storage.

diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 68f403f..b8b0b6a 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -326,7 +326,7 @@ fbCopyRegion (DrawablePtr   pSrcDrawable,
 	if (nbox > 1)
 	{
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -363,11 +363,11 @@ fbCopyRegion (DrawablePtr   pSrcDrawable,
 	if (nbox > 1)
 	{
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew2)
 	    {
 		if (pboxNew1)
-		    DEALLOCATE_LOCAL(pboxNew1);
+		    xfree(pboxNew1);
 		return;
 	    }
 	    pboxBase = pboxNext = pbox;
@@ -402,9 +402,9 @@ fbCopyRegion (DrawablePtr   pSrcDrawable,
 		 reverse, upsidedown, bitPlane, closure);
     
     if (pboxNew1)
-	DEALLOCATE_LOCAL (pboxNew1);
+	xfree (pboxNew1);
     if (pboxNew2)
-	DEALLOCATE_LOCAL (pboxNew2);
+	xfree (pboxNew2);
 }
 
 RegionPtr
diff --git a/fb/fbpseudocolor.c b/fb/fbpseudocolor.c
index a15697d..8a48c38 100644
--- a/fb/fbpseudocolor.c
+++ b/fb/fbpseudocolor.c
@@ -500,7 +500,7 @@ xxStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors)
 
 	DBG("StoreColors\n");
 	
-	expanddefs = ALLOCATE_LOCAL(sizeof(xColorItem)
+	expanddefs = xalloc(sizeof(xColorItem)
 				    * (1 <<  pScrPriv->myDepth));
 	if (!expanddefs) return;
 	
@@ -527,7 +527,7 @@ xxStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors)
 	    pColors++;
 	}
 
-	DEALLOCATE_LOCAL(expanddefs);
+	xfree(expanddefs);
 
 	pCmapPriv->dirty = TRUE;
 	pScrPriv->colormapDirty = TRUE;
@@ -565,9 +565,9 @@ xxInstallColormap(ColormapPtr pmap)
 	    wrap(pScrPriv,pmap->pScreen,InstallColormap,xxInstallColormap);
 	}
 	    
-	pixels = ALLOCATE_LOCAL(sizeof(Pixel) * (1 <<  pScrPriv->myDepth));
-	colors = ALLOCATE_LOCAL(sizeof(xrgb) * (1 <<  pScrPriv->myDepth));
-	defs = ALLOCATE_LOCAL(sizeof(xColorItem) * (1 << pScrPriv->myDepth));
+	pixels = xalloc(sizeof(Pixel) * (1 <<  pScrPriv->myDepth));
+	colors = xalloc(sizeof(xrgb) * (1 <<  pScrPriv->myDepth));
+	defs = xalloc(sizeof(xColorItem) * (1 << pScrPriv->myDepth));
 	
 	if (!pixels || !colors)
 	    return;
@@ -595,9 +595,9 @@ xxInstallColormap(ColormapPtr pmap)
         }
 	xxStoreColors(pmap,(1 <<  pScrPriv->myDepth),defs);
 
-	DEALLOCATE_LOCAL(pixels);
-	DEALLOCATE_LOCAL(colors);
-	DEALLOCATE_LOCAL(defs);
+	xfree(pixels);
+	xfree(colors);
+	xfree(defs);
 
 	return;
     } 
commit 733d42065f2c24505b3874ce51c18f6063c2b67e
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:11:59 2007 +0000

    XFree86: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 4c980a2..f896c29 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -823,7 +823,7 @@ DoConfigure()
     	homebuf[PATH_MAX-1] = '\0';
     	home = homebuf;
     	if (!(filename =
-	     (char *)ALLOCATE_LOCAL(strlen(home) + 
+	     (char *)xalloc(strlen(home) + 
 	  			 strlen(configfile) + 3)))
 
       	if (home[0] == '/' && home[1] == '\0')
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index 2e06ffa..af2cd4a 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -622,7 +622,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
     int i, index;
     sbusCmapPtr cmap;
     struct fbcmap fbcmap;
-    unsigned char *data = ALLOCATE_LOCAL(numColors*3);
+    unsigned char *data = xalloc(numColors*3);
                              
     cmap = SBUSCMAPPTR(pScrn->pScreen);
     if (!cmap) return;
@@ -643,7 +643,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
 	fbcmap.blue[fbcmap.count++] = colors[index].blue;
     }
     ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
-    DEALLOCATE_LOCAL(data);
+    xfree(data);
 }
 
 static Bool
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 6abe31c..eac0d7e 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1856,7 +1856,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
 
    REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y);
 
-   rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle));
+   rects = xalloc(nbox * sizeof(xRectangle));
 
    for(i = 0; i < nbox; i++, pbox++) {
       rects[i].x = pbox->x1;
@@ -1869,7 +1869,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
 
    if (!pPriv) FreeGC(pGC, 0);
 
-   DEALLOCATE_LOCAL(rects);
+   xfree(rects);
 }
 
 _X_EXPORT void
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 44ec9f1..3b054a8 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1323,14 +1323,14 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.nhsync = nHsync;
     rep.nvsync = nVrefresh;
-    hsyncdata = ALLOCATE_LOCAL(nHsync * sizeof(CARD32));
+    hsyncdata = xalloc(nHsync * sizeof(CARD32));
     if (!hsyncdata) {
 	return BadAlloc;
     }
 
-    vsyncdata = ALLOCATE_LOCAL(nVrefresh * sizeof(CARD32));
+    vsyncdata = xalloc(nVrefresh * sizeof(CARD32));
     if (!vsyncdata) {
-	DEALLOCATE_LOCAL(hsyncdata);
+	xfree(hsyncdata);
 	return BadAlloc;
     }
 
@@ -1363,8 +1363,8 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
     if (rep.modelLength)
 	WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
 
-    DEALLOCATE_LOCAL(hsyncdata);
-    DEALLOCATE_LOCAL(vsyncdata);
+    xfree(hsyncdata);
+    xfree(vsyncdata);
 
     return (client->noClientException);
 }
@@ -1448,11 +1448,11 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
     rep.flags = 0;
 
     if (!ClockProg) {
-	Clocks = ALLOCATE_LOCAL(numClocks * sizeof(int));
+	Clocks = xalloc(numClocks * sizeof(int));
 	if (!Clocks)
 	    return BadValue;
 	if (!VidModeGetClocks(stuff->screen, Clocks)) {
-	    DEALLOCATE_LOCAL(Clocks);
+	    xfree(Clocks);
 	    return BadValue;
 	}
     }
@@ -1479,7 +1479,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
 	}
     }
 
-    DEALLOCATE_LOCAL(Clocks);
+    xfree(Clocks);
     return (client->noClientException);
 }
 
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 7169f74..fe21717 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -636,7 +636,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr	randr_crtc)
     DisplayModePtr	mode = &crtc->mode;
     Bool		ret;
 
-    randr_outputs = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr));
+    randr_outputs = xalloc(config->num_output * sizeof (RROutputPtr));
     if (!randr_outputs)
 	return FALSE;
     x = crtc->x;
@@ -671,7 +671,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr	randr_crtc)
     }
     ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
 			rotation, numOutputs, randr_outputs);
-    DEALLOCATE_LOCAL(randr_outputs);
+    xfree(randr_outputs);
     return ret;
 }
 
@@ -726,7 +726,7 @@ xf86RandR12CrtcSet (ScreenPtr	pScreen,
     xf86CrtcPtr		*save_crtcs;
     Bool		save_enabled = crtc->enabled;
 
-    save_crtcs = ALLOCATE_LOCAL(config->num_output * sizeof (xf86CrtcPtr));
+    save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr));
     if ((randr_mode != NULL) != crtc->enabled)
 	changed = TRUE;
     else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
@@ -782,7 +782,7 @@ xf86RandR12CrtcSet (ScreenPtr	pScreen,
 		    xf86OutputPtr	output = config->output[o];
 		    output->crtc = save_crtcs[o];
 		}
-		DEALLOCATE_LOCAL(save_crtcs);
+		xfree(save_crtcs);
 		return FALSE;
 	    }
 	    /*
@@ -795,7 +795,7 @@ xf86RandR12CrtcSet (ScreenPtr	pScreen,
 	}
 	xf86DisableUnusedFunctions (pScrn);
     }
-    DEALLOCATE_LOCAL(save_crtcs);
+    xfree(save_crtcs);
     return xf86RandR12CrtcNotify (randr_crtc);
 }
 
@@ -938,8 +938,8 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen)
     RRCrtcPtr		randr_crtc;
     int			nclone;
     
-    clones = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr));
-    crtcs = ALLOCATE_LOCAL (config->num_crtc * sizeof (RRCrtcPtr));
+    clones = xalloc(config->num_output * sizeof (RROutputPtr));
+    crtcs = xalloc (config->num_crtc * sizeof (RRCrtcPtr));
     for (o = 0; o < config->num_output; o++)
     {
 	xf86OutputPtr	output = config->output[o];
@@ -956,8 +956,8 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen)
 
 	if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
 	{
-	    DEALLOCATE_LOCAL (crtcs);
-	    DEALLOCATE_LOCAL (clones);
+	    xfree (crtcs);
+	    xfree (clones);
 	    return FALSE;
 	}
 
@@ -993,13 +993,13 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen)
 	}
 	if (!RROutputSetClones (output->randr_output, clones, nclone))
 	{
-	    DEALLOCATE_LOCAL (crtcs);
-	    DEALLOCATE_LOCAL (clones);
+	    xfree (crtcs);
+	    xfree (clones);
 	    return FALSE;
 	}
     }
-    DEALLOCATE_LOCAL (crtcs);
-    DEALLOCATE_LOCAL (clones);
+    xfree (crtcs);
+    xfree (clones);
     return TRUE;
 }
 
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 3511a63..52fdcbe 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -1035,7 +1035,7 @@ ShadowPolyRectangle(
 	    offset1 = offset2 >> 1;
 	    offset3 = offset2 - offset1;
 
-	    pBoxInit = (BoxPtr)ALLOCATE_LOCAL(nRects * 4 * sizeof(BoxRec));
+	    pBoxInit = (BoxPtr)xalloc(nRects * 4 * sizeof(BoxRec));
 	    pbox = pBoxInit;
 
 	    while(nRects--) {
@@ -1086,7 +1086,7 @@ ShadowPolyRectangle(
                 if(pPriv->preRefresh)
                     (*pPriv->preRefresh)(pPriv->pScrn, num, pBoxInit);
             } else {
-                DEALLOCATE_LOCAL(pBoxInit);
+                xfree(pBoxInit);
             }                
 	}
     }
@@ -1098,7 +1098,7 @@ ShadowPolyRectangle(
     } else if(num) {
        if(pPriv->postRefresh)
           (*pPriv->postRefresh)(pPriv->pScrn, num, pBoxInit);
-       DEALLOCATE_LOCAL(pBoxInit);
+       xfree(pBoxInit);
     }
     
     SHADOW_GC_OP_EPILOGUE(pGC);
diff --git a/hw/xfree86/vgahw/vgaCmap.c b/hw/xfree86/vgahw/vgaCmap.c
index 609376a..44043c6 100644
--- a/hw/xfree86/vgahw/vgaCmap.c
+++ b/hw/xfree86/vgahw/vgaCmap.c
@@ -236,9 +236,9 @@ vgaInstallColormap(pmap)
   else
     entries = pmap->pVisual->ColormapEntries;
 
-  ppix = (Pixel *)ALLOCATE_LOCAL( entries * sizeof(Pixel));
-  prgb = (xrgb *)ALLOCATE_LOCAL( entries * sizeof(xrgb));
-  defs = (xColorItem *)ALLOCATE_LOCAL(entries * sizeof(xColorItem));
+  ppix = (Pixel *)xalloc( entries * sizeof(Pixel));
+  prgb = (xrgb *)xalloc( entries * sizeof(xrgb));
+  defs = (xColorItem *)xalloc(entries * sizeof(xColorItem));
 
   if ( oldmap != NOMAPYET)
     WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid);
@@ -261,9 +261,9 @@ vgaInstallColormap(pmap)
 
   WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid);
   
-  DEALLOCATE_LOCAL(ppix);
-  DEALLOCATE_LOCAL(prgb);
-  DEALLOCATE_LOCAL(defs);
+  xfree(ppix);
+  xfree(prgb);
+  xfree(defs);
 }
 
 
diff --git a/hw/xfree86/xaa/xaaBitBlt.c b/hw/xfree86/xaa/xaaBitBlt.c
index 6c81f64..ebba74e 100644
--- a/hw/xfree86/xaa/xaaBitBlt.c
+++ b/hw/xfree86/xaa/xaaBitBlt.c
@@ -186,7 +186,7 @@ XAABitBlt(
     /* Do bit blitting */
     numRects = REGION_NUM_RECTS(&rgnDst);
     if (numRects && width && height) {
-	if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
 						  sizeof(DDXPointRec)))) {
 	    REGION_UNINIT(pGC->pScreen, &rgnDst);
 	    if (freeSrcClip)
@@ -201,7 +201,7 @@ XAABitBlt(
 	}
 
 	(*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
-	DEALLOCATE_LOCAL(pptSrc);
+	xfree(pptSrc);
     }
 
     prgnExposed = NULL;
diff --git a/hw/xfree86/xaa/xaaCpyArea.c b/hw/xfree86/xaa/xaaCpyArea.c
index 89b4441..6c991e1 100644
--- a/hw/xfree86/xaa/xaaCpyArea.c
+++ b/hw/xfree86/xaa/xaaCpyArea.c
@@ -108,12 +108,12 @@ XAADoBitBlt(
 
 	if (nbox > 1) {
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
-	    pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pptNew1) {
-	        DEALLOCATE_LOCAL(pboxNew1);
+	        xfree(pboxNew1);
 	        return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -145,14 +145,14 @@ XAADoBitBlt(
 
 	if (nbox > 1) {
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pboxNew2 || !pptNew2) {
-		if (pptNew2) DEALLOCATE_LOCAL(pptNew2);
-		if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2);
+		if (pptNew2) xfree(pptNew2);
+		if (pboxNew2) xfree(pboxNew2);
 		if (pboxNew1) {
-		    DEALLOCATE_LOCAL(pptNew1);
-		    DEALLOCATE_LOCAL(pboxNew1);
+		    xfree(pptNew1);
+		    xfree(pboxNew1);
 		}
 	        return;
 	    }
@@ -183,12 +183,12 @@ XAADoBitBlt(
 	xdir, ydir, pGC->alu, pGC->planemask);
  
     if (pboxNew2) {
-	DEALLOCATE_LOCAL(pptNew2);
-	DEALLOCATE_LOCAL(pboxNew2);
+	xfree(pptNew2);
+	xfree(pboxNew2);
     }
     if (pboxNew1) {
-	DEALLOCATE_LOCAL(pptNew1);
-	DEALLOCATE_LOCAL(pboxNew1);
+	xfree(pptNew1);
+	xfree(pboxNew1);
     }
 
 }
diff --git a/hw/xfree86/xaa/xaaCpyWin.c b/hw/xfree86/xaa/xaaCpyWin.c
index 1ff955c..ecdc9a3 100644
--- a/hw/xfree86/xaa/xaaCpyWin.c
+++ b/hw/xfree86/xaa/xaaCpyWin.c
@@ -59,7 +59,7 @@ XAACopyWindow(
     pbox = REGION_RECTS(&rgnDst);
     nbox = REGION_NUM_RECTS(&rgnDst);
     if(!nbox || 
-      !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
+      !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
 	REGION_UNINIT(pScreen, &rgnDst);
 	return;
     }
@@ -77,6 +77,6 @@ XAACopyWindow(
     XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
 
-    DEALLOCATE_LOCAL(pptSrc);
+    xfree(pptSrc);
     REGION_UNINIT(pScreen, &rgnDst);
 }
diff --git a/hw/xfree86/xaa/xaaNonTEText.c b/hw/xfree86/xaa/xaaNonTEText.c
index a5608c9..d4661e8 100644
--- a/hw/xfree86/xaa/xaaNonTEText.c
+++ b/hw/xfree86/xaa/xaaNonTEText.c
@@ -291,7 +291,7 @@ PolyGlyphBltAsSingleBitmap (
 
     pitch = (Right - Left + 31) >> 5;
     size = (pitch << 2) * (Bottom - Top);
-    block = (CARD32*)ALLOCATE_LOCAL(size);
+    block = (CARD32*)xalloc(size);
     bzero(block, size);
 
     topLine = 10000; botLine = -10000;
@@ -350,7 +350,7 @@ PolyGlyphBltAsSingleBitmap (
 	nbox--; pbox++;
     }
 
-    DEALLOCATE_LOCAL(block);
+    xfree(block);
 }
 
 static void
diff --git a/hw/xfree86/xaa/xaaOverlay.c b/hw/xfree86/xaa/xaaOverlay.c
index 86b30ff..273183e 100644
--- a/hw/xfree86/xaa/xaaOverlay.c
+++ b/hw/xfree86/xaa/xaaOverlay.c
@@ -69,7 +69,7 @@ XAACopyWindow8_32(
     pbox = REGION_RECTS(&rgnDst);
     nbox = REGION_NUM_RECTS(&rgnDst);
     if(!nbox || 
-      !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
+      !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
 	REGION_UNINIT(pScreen, &rgnDst);
 	return;
     }
@@ -87,7 +87,7 @@ XAACopyWindow8_32(
     XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
 
-    DEALLOCATE_LOCAL(pptSrc);
+    xfree(pptSrc);
     REGION_UNINIT(pScreen, &rgnDst);
     if(freeReg) 
 	REGION_DESTROY(pScreen, borderClip);
diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c
index bf91098..47599d7 100644
--- a/hw/xfree86/xaa/xaaOverlayDF.c
+++ b/hw/xfree86/xaa/xaaOverlayDF.c
@@ -358,7 +358,7 @@ XAAOverCopyWindow(
 
     nbox = REGION_NUM_RECTS(&rgnDst);
     if(nbox &&
-	(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
+	(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
 
 	pbox = REGION_RECTS(&rgnDst);
 	for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
@@ -376,7 +376,7 @@ XAAOverCopyWindow(
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
 	}
 
-	DEALLOCATE_LOCAL(pptSrc);
+	xfree(pptSrc);
     }
 
     REGION_UNINIT(pScreen, &rgnDst);
@@ -388,7 +388,7 @@ XAAOverCopyWindow(
 	REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
 	nbox = REGION_NUM_RECTS(&rgnDst);
 	if(nbox &&
-	  (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))){
+	  (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))){
 
 	    pbox = REGION_RECTS(&rgnDst);
 	    for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
@@ -399,7 +399,7 @@ XAAOverCopyWindow(
 	    SWITCH_DEPTH(pScrn->depth);
 	    XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
-	    DEALLOCATE_LOCAL(pptSrc);
+	    xfree(pptSrc);
 	}
       }
       REGION_UNINIT(pScreen, &rgnDst);
diff --git a/hw/xfree86/xaa/xaaPCache.c b/hw/xfree86/xaa/xaaPCache.c
index 441788c..d05aaf2 100644
--- a/hw/xfree86/xaa/xaaPCache.c
+++ b/hw/xfree86/xaa/xaaPCache.c
@@ -1557,7 +1557,7 @@ XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
 
    pad = BitmapBytePad(pCache->w * bpp);
    dwords = pad >> 2;
-   dstPtr = data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h);
+   dstPtr = data = (unsigned char*)xalloc(pad * pCache->h);
    srcPtr = (unsigned char*)pPix->devPrivate.ptr;
 
    if(infoRec->ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
@@ -1588,7 +1588,7 @@ XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
 	pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data,
 	pad, bpp, pScrn->depth);
 
-   DEALLOCATE_LOCAL(data);
+   xfree(data);
 
    return pCache;
 }
@@ -1967,7 +1967,7 @@ XAAWriteMono8x8PatternToCache(
 
    pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
 
-   data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h);
+   data = (unsigned char*)xalloc(pad * pCache->h);
    if(!data) return;
 
    if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
@@ -1991,7 +1991,7 @@ XAAWriteMono8x8PatternToCache(
    (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y, 
 	pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
 
-   DEALLOCATE_LOCAL(data);
+   xfree(data);
 }
 
 void 
@@ -2012,7 +2012,7 @@ XAAWriteColor8x8PatternToCache(
    if(pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
 	CARD32* ptr;
 	pad = BitmapBytePad(pCache->w);
-	data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h);
+	data = (unsigned char*)xalloc(pad * pCache->h);
 	if(!data) return;
 
 	if(infoRec->Color8x8PatternFillFlags & 
@@ -2037,7 +2037,7 @@ XAAWriteColor8x8PatternToCache(
 	(*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y, 
 		pCache->w, pCache->h, data, pad, pCache->fg, pCache->bg);
 
-   	DEALLOCATE_LOCAL(data);
+   	xfree(data);
 	return;
    } 
 
@@ -2046,7 +2046,7 @@ XAAWriteColor8x8PatternToCache(
    w = min(8,pPix->drawable.width);
    pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
 
-   data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h);
+   data = (unsigned char*)xalloc(pad * pCache->h);
    if(!data) return;
 
    /* Write and expand horizontally. */
@@ -2085,7 +2085,7 @@ XAAWriteColor8x8PatternToCache(
    (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y, 
 	pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
 
-   DEALLOCATE_LOCAL(data);   
+   xfree(data);   
 }
 
 
diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c
index 55f0f6e..74e90e3 100644
--- a/hw/xfree86/xaa/xaaPict.c
+++ b/hw/xfree86/xaa/xaaPict.c
@@ -471,7 +471,7 @@ XAACompositeSrcCopy (PicturePtr pSrc,
 	REGION_UNINIT(pScreen, &region);
 	return;
     }
-    pptSrc = ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+    pptSrc = xalloc(sizeof(DDXPointRec) * nbox);
     if (!pptSrc) {
 	REGION_UNINIT(pScreen, &region);
 	return;
@@ -489,7 +489,7 @@ XAACompositeSrcCopy (PicturePtr pSrc,
     XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
 		pptSrc);
 
-    DEALLOCATE_LOCAL(pptSrc);
+    xfree(pptSrc);
     REGION_UNINIT(pScreen, &region);
     return;
 }
diff --git a/hw/xfree86/xaa/xaaTEGlyph.c b/hw/xfree86/xaa/xaaTEGlyph.c
index c8d6596..cb60266 100644
--- a/hw/xfree86/xaa/xaaTEGlyph.c
+++ b/hw/xfree86/xaa/xaaTEGlyph.c
@@ -301,7 +301,7 @@ EXPNAME(XAATEGlyphRenderer3)(
     } 
 
     dwords = ((3 * w + 31) >> 5) * h;
-    mem = (CARD32*)ALLOCATE_LOCAL(((w + 31) >> 3) * sizeof(char));
+    mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
     if (!mem) return;
 
     (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0);
@@ -321,7 +321,7 @@ EXPNAME(XAATEGlyphRenderer3)(
 	    DrawTextScanline3(base, mem, w);
 	}
 
-    DEALLOCATE_LOCAL(mem);
+    xfree(mem);
 
     if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
 			(dwords & 1)) {
@@ -478,7 +478,7 @@ EXPNAME(XAATEGlyphRendererScanline3)(
 
     w += skipleft;
     x -= skipleft;
-    mem = (CARD32*)ALLOCATE_LOCAL(((w + 31) >> 3) * sizeof(char));
+    mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
     if (!mem) return;
 
    (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(	
@@ -495,7 +495,7 @@ EXPNAME(XAATEGlyphRendererScanline3)(
 	    bufferNo = 0;
     }
 
-    DEALLOCATE_LOCAL(mem);
+    xfree(mem);
     
 THE_END:
 
diff --git a/hw/xfree86/xf4bpp/mfbimggblt.c b/hw/xfree86/xf4bpp/mfbimggblt.c
index bf53f4c..73e7ce0 100644
--- a/hw/xfree86/xf4bpp/mfbimggblt.c
+++ b/hw/xfree86/xf4bpp/mfbimggblt.c
@@ -355,7 +355,7 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
 	int getWidth;		/* bits to get from glyph */
 #endif
 
-	if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS))))
+	if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
 	    return;
 
         pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
@@ -494,7 +494,7 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
 		}
 	    } /* for each glyph */
 	} /* while nbox-- */
-	DEALLOCATE_LOCAL(ppos);
+	xfree(ppos);
 	break;
       }
       default:
diff --git a/hw/xfree86/xf4bpp/ppcCpArea.c b/hw/xfree86/xf4bpp/ppcCpArea.c
index 891ba4b..9bdaf89 100644
--- a/hw/xfree86/xf4bpp/ppcCpArea.c
+++ b/hw/xfree86/xf4bpp/ppcCpArea.c
@@ -110,13 +110,13 @@ vga16DoBitblt
 	if (nbox > 1)
 	{
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
-	    pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pptNew1)
 	    {
-	        DEALLOCATE_LOCAL(pboxNew1);
+	        xfree(pboxNew1);
 	        return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -146,16 +146,16 @@ vga16DoBitblt
 	if (nbox > 1)
 	{
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pboxNew2 || !pptNew2)
 	    {
-		if (pptNew2) DEALLOCATE_LOCAL(pptNew2);
-		if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2);
+		if (pptNew2) xfree(pptNew2);
+		if (pboxNew2) xfree(pboxNew2);
 		if (pboxNew1)
 		{
-		    DEALLOCATE_LOCAL(pptNew1);
-		    DEALLOCATE_LOCAL(pboxNew1);
+		    xfree(pptNew1);
+		    xfree(pboxNew1);
 		}
 	        return;
 	    }
@@ -207,13 +207,13 @@ vga16DoBitblt
     }
     if (pboxNew2)
     {
-	DEALLOCATE_LOCAL(pptNew2);
-	DEALLOCATE_LOCAL(pboxNew2);
+	xfree(pptNew2);
+	xfree(pboxNew2);
     }
     if (pboxNew1)
     {
-	DEALLOCATE_LOCAL(pptNew1);
-	DEALLOCATE_LOCAL(pboxNew1);
+	xfree(pptNew1);
+	xfree(pboxNew1);
     }
 }
 
@@ -430,7 +430,7 @@ int dstx, dsty;
     numRects = REGION_NUM_RECTS(&rgnDst);
     if (numRects && width && height)
     {
-	if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
 						  sizeof(DDXPointRec))))
 	{
 	    REGION_UNINIT(pGC->pScreen, &rgnDst);
@@ -448,7 +448,7 @@ int dstx, dsty;
 
 	vga16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu,
 			&rgnDst, pptSrc, pGC->planemask );
-	DEALLOCATE_LOCAL(pptSrc);
+	xfree(pptSrc);
     }
 
     prgnExposed = NULL;
diff --git a/hw/xfree86/xf4bpp/ppcFillRct.c b/hw/xfree86/xf4bpp/ppcFillRct.c
index 4be732f..3422c80 100644
--- a/hw/xfree86/xf4bpp/ppcFillRct.c
+++ b/hw/xfree86/xf4bpp/ppcFillRct.c
@@ -106,7 +106,7 @@ xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
     numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
     if (numRects > NUM_STACK_RECTS)
     {
-	pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
 	if (!pboxClippedBase)
 	    return;
     }
@@ -211,5 +211,5 @@ xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
 	xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase,
 		       pboxClippedBase, pGC);
     if (pboxClippedBase != stackRects)
-    	DEALLOCATE_LOCAL(pboxClippedBase);
+    	xfree(pboxClippedBase);
 }
diff --git a/hw/xfree86/xf4bpp/ppcImg.c b/hw/xfree86/xf4bpp/ppcImg.c
index 39d39c4..33c6b89 100644
--- a/hw/xfree86/xf4bpp/ppcImg.c
+++ b/hw/xfree86/xf4bpp/ppcImg.c
@@ -86,7 +86,7 @@ xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine )
 	    DoChangeGC( pGC, GCPlaneMask | GCFunction, gcv, 0 ) ;
 	    ValidateGC( (DrawablePtr)pPixmap, pGC ) ;
 
-	    pbits = (char *)ALLOCATE_LOCAL(w);
+	    pbits = (char *)xalloc(w);
 
 	    for ( i = 0 ; i < h ; i++ ) {
 		pt.x = sx ;
@@ -102,7 +102,7 @@ xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine )
 		pDst += linelength ;
 	    }
 
-	    DEALLOCATE_LOCAL(pbits) ;
+	    xfree(pbits) ;
 	    (* pGC->pScreen->DestroyPixmap)( pPixmap ) ;
 	    FreeScratchGC( pGC ) ;
 	    return ;
diff --git a/hw/xfree86/xf4bpp/ppcPixFS.c b/hw/xfree86/xf4bpp/ppcPixFS.c
index f24168b..dfc6486 100644
--- a/hw/xfree86/xf4bpp/ppcPixFS.c
+++ b/hw/xfree86/xf4bpp/ppcPixFS.c
@@ -128,13 +128,13 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
 	return ;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip) ;
-    if ( !( pwidthFree = (int *) ALLOCATE_LOCAL( n * sizeof( int ) ) ) )
+    if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
 	return ;
     pwidth = pwidthFree ;
 
     if ( !( pptFree = (DDXPointRec *)
-	    ALLOCATE_LOCAL( n * sizeof( DDXPointRec ) ) ) ) {
-	DEALLOCATE_LOCAL( pwidth ) ;
+	    xalloc( n * sizeof( DDXPointRec ) ) ) ) {
+	xfree( pwidth ) ;
 	return ;
     }
     ppt = pptFree ;
@@ -160,8 +160,8 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
 	    *addrl = ( *addrl & npm ) | ( pm & DoRop( alu, fg, *addrl ) ) ;
 #endif /* PURDUE */
     }
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
     return ;
 }
 
@@ -316,8 +316,8 @@ int fSorted ;
 	ppt++ ;
 	pwidth++ ;
     }
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
     return ;
 }
 
@@ -416,8 +416,8 @@ int fSorted ;
 #endif /* PURDUE */
 	}
     }
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
     return ;
 }
 
@@ -496,7 +496,7 @@ int fSorted ;
 #endif /* PURDUE */
 	}
     }
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
     return ;
 }
diff --git a/hw/xfree86/xf4bpp/ppcWinFS.c b/hw/xfree86/xf4bpp/ppcWinFS.c
index e19ce0d..78001d7 100644
--- a/hw/xfree86/xf4bpp/ppcWinFS.c
+++ b/hw/xfree86/xf4bpp/ppcWinFS.c
@@ -100,13 +100,13 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
 	return ;
 
     n = nInit * miFindMaxBand( pGC->pCompositeClip ) ;
-    if ( !( pwidthFree = (int *) ALLOCATE_LOCAL( n * sizeof( int ) ) ) )
+    if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
 	return ;
     pwidth = pwidthFree ;
 
     if ( !( pptFree = (DDXPointRec *)
-			ALLOCATE_LOCAL( n * sizeof( DDXPointRec ) ) ) ) {
-	DEALLOCATE_LOCAL( pwidth ) ;
+			xalloc( n * sizeof( DDXPointRec ) ) ) ) {
+	xfree( pwidth ) ;
 	return ;
     }
     ppt = pptFree ;
@@ -122,8 +122,8 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
 	    xf4bppFillSolid( (WindowPtr)pDrawable,
 		           fg, alu, pm, ppt->x, ppt->y, *pwidth, 1 ) ;
 
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
     return ;
 }
 
@@ -180,8 +180,8 @@ int fSorted ;
 	xf4bppFillStipple( (WindowPtr)pDrawable, pTile, fg, alu, pm,
 			ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
 
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
 
     return ;
 }
@@ -232,8 +232,8 @@ int fSorted ;
 	xf4bppOpaqueStipple( (WindowPtr)pDrawable, pGC->stipple, fg, bg, alu, pm,
 		ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
 
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
     return ;
 }
 
@@ -274,7 +274,7 @@ int fSorted ;
 	    xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm,
 		     ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
 
-    DEALLOCATE_LOCAL( pptFree ) ;
-    DEALLOCATE_LOCAL( pwidthFree ) ;
+    xfree( pptFree ) ;
+    xfree( pwidthFree ) ;
     return ;
 }
diff --git a/hw/xfree86/xf4bpp/ppcWindow.c b/hw/xfree86/xf4bpp/ppcWindow.c
index 8261af1..6165e04 100644
--- a/hw/xfree86/xf4bpp/ppcWindow.c
+++ b/hw/xfree86/xf4bpp/ppcWindow.c
@@ -123,7 +123,7 @@ xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
 		/* walk source bottom to top */
 		/* keep ordering in each band, reverse order of bands */
 		if ( !( pboxNew =
-			(BoxPtr) ALLOCATE_LOCAL( sizeof( BoxRec ) * nbox ) ) )
+			(BoxPtr) xalloc( sizeof( BoxRec ) * nbox ) ) )
 			return ;
 		pboxBase = pboxNext = pbox+nbox - 1 ;
 		while ( pboxBase >= pbox ) {
@@ -158,7 +158,7 @@ xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
         else if ( dx < 0 ) {
 	/* walk source right to left */
 	    /* reverse order of rects in each band */
-	    if ( !( pboxNew = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox) ) )
+	    if ( !( pboxNew = (BoxPtr)xalloc(sizeof(BoxRec) * nbox) ) )
 		return ;
 	    pboxBase = pboxNext = pbox ;
 	    while (pboxBase < pbox+nbox)
@@ -190,7 +190,7 @@ xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
 
     /* free up stuff */
     if ( pboxNew )
-	DEALLOCATE_LOCAL( pboxNew ) ;
+	xfree( pboxNew ) ;
 
     REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
 }
diff --git a/hw/xfree86/xf8_32bpp/cfbcpyarea.c b/hw/xfree86/xf8_32bpp/cfbcpyarea.c
index c2eb1a0..d8f0c6d 100644
--- a/hw/xfree86/xf8_32bpp/cfbcpyarea.c
+++ b/hw/xfree86/xf8_32bpp/cfbcpyarea.c
@@ -433,12 +433,12 @@ cfb8_32DoBitBlt(
 
 	if (nbox > 1) {
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
-	    pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pptNew1) {
-	        DEALLOCATE_LOCAL(pboxNew1);
+	        xfree(pboxNew1);
 	        return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -470,14 +470,14 @@ cfb8_32DoBitBlt(
 
 	if (nbox > 1) {
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pboxNew2 || !pptNew2) {
-		if (pptNew2) DEALLOCATE_LOCAL(pptNew2);
-		if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2);
+		if (pptNew2) xfree(pptNew2);
+		if (pboxNew2) xfree(pboxNew2);
 		if (pboxNew1) {
-		    DEALLOCATE_LOCAL(pptNew1);
-		    DEALLOCATE_LOCAL(pboxNew1);
+		    xfree(pptNew1);
+		    xfree(pboxNew1);
 		}
 	        return;
 	    }
@@ -510,12 +510,12 @@ cfb8_32DoBitBlt(
     (*DoBlt)(SrcPtr,SrcPitch,DstPtr,DstPitch,nbox,pptSrc,pbox,xdir,ydir);
  
     if (pboxNew2) {
-	DEALLOCATE_LOCAL(pptNew2);
-	DEALLOCATE_LOCAL(pboxNew2);
+	xfree(pptNew2);
+	xfree(pboxNew2);
     }
     if (pboxNew1) {
-	DEALLOCATE_LOCAL(pptNew1);
-	DEALLOCATE_LOCAL(pboxNew1);
+	xfree(pptNew1);
+	xfree(pboxNew1);
     }
 
 }
diff --git a/hw/xfree86/xf8_32bpp/cfbwindow.c b/hw/xfree86/xf8_32bpp/cfbwindow.c
index 787cbde..2e6057f 100644
--- a/hw/xfree86/xf8_32bpp/cfbwindow.c
+++ b/hw/xfree86/xf8_32bpp/cfbwindow.c
@@ -77,7 +77,7 @@ cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc)
     pbox = REGION_RECTS(&rgnDst);
     nbox = REGION_NUM_RECTS(&rgnDst);
     if(!nbox || 
-       !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+       !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
     {
 	REGION_UNINIT(pScreen, &rgnDst);
 	return;
@@ -97,7 +97,7 @@ cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc)
 	cfbDoBitblt8To8GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
 			GXcopy, &rgnDst, pptSrc, ~0);
 
-    DEALLOCATE_LOCAL(pptSrc);
+    xfree(pptSrc);
     REGION_UNINIT(pScreen, &rgnDst);
     if(freeReg) 
 	REGION_DESTROY(pScreen, borderClip);
commit caf545063457591f88e1f7bcd25dbd0342f44343
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:10:55 2007 +0000

    KDrive: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/hw/kdrive/epson/epson13806.c b/hw/kdrive/epson/epson13806.c
index cb00890..6cf8c9a 100644
--- a/hw/kdrive/epson/epson13806.c
+++ b/hw/kdrive/epson/epson13806.c
@@ -331,7 +331,7 @@ epsonCreateColormap (ColormapPtr pmap)
         case FB_VISUAL_STATIC_PSEUDOCOLOR:
             pVisual = pmap->pVisual;
             nent = pVisual->ColormapEntries;
-            pdefs = ALLOCATE_LOCAL (nent * sizeof (xColorItem));
+            pdefs = xalloc (nent * sizeof (xColorItem));
             if (!pdefs)
                 return FALSE;
             for (i = 0; i < nent; i++)
@@ -343,7 +343,7 @@ epsonCreateColormap (ColormapPtr pmap)
                 pmap->red[i].co.local.green = pdefs[i].green;
                 pmap->red[i].co.local.blue = pdefs[i].blue;
             }
-            DEALLOCATE_LOCAL (pdefs);
+            xfree (pdefs);
             return TRUE;
 
         default:
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index 6e8b3ff..177be0b 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -598,7 +598,7 @@ fbdevCreateColormap (ColormapPtr pmap)
     case FB_VISUAL_STATIC_PSEUDOCOLOR:
 	pVisual = pmap->pVisual;
 	nent = pVisual->ColormapEntries;
-	pdefs = ALLOCATE_LOCAL (nent * sizeof (xColorItem));
+	pdefs = xalloc (nent * sizeof (xColorItem));
 	if (!pdefs)
 	    return FALSE;
 	for (i = 0; i < nent; i++)
@@ -610,7 +610,7 @@ fbdevCreateColormap (ColormapPtr pmap)
 	    pmap->red[i].co.local.green = pdefs[i].green;
 	    pmap->red[i].co.local.blue = pdefs[i].blue;
 	}
-	DEALLOCATE_LOCAL (pdefs);
+	xfree (pdefs);
 	return TRUE;
     default:
 	return fbInitializeColormap (pmap);
diff --git a/hw/kdrive/igs/igsdraw.c b/hw/kdrive/igs/igsdraw.c
index e1ff2be..677436b 100644
--- a/hw/kdrive/igs/igsdraw.c
+++ b/hw/kdrive/igs/igsdraw.c
@@ -553,12 +553,12 @@ igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
 	return;
     }
     nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC));
-    pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(nTmp * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     n = miClipSpans(fbGetCompositeClip(pGC),
@@ -607,8 +607,8 @@ igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
 	    _igsPatRect(cop,x,y,width,1,cmd);
 	}
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
     KdMarkSync (pDrawable->pScreen);
 }
 
diff --git a/hw/kdrive/nvidia/nvidiavideo.c b/hw/kdrive/nvidia/nvidiavideo.c
index ad7147d..2ab41ed 100644
--- a/hw/kdrive/nvidia/nvidiavideo.c
+++ b/hw/kdrive/nvidia/nvidiavideo.c
@@ -343,7 +343,7 @@ nvidiaPaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
     BoxPtr	pBox = REGION_RECTS (pRgn);
     int		nBox = REGION_NUM_RECTS (pRgn);
     
-    rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle));
+    rects = xalloc (nBox * sizeof (xRectangle));
     if (!rects)
 	goto bail0;
     r = rects;
@@ -372,7 +372,7 @@ nvidiaPaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
 
     FreeScratchGC (pGC);
 bail1:
-    DEALLOCATE_LOCAL (rects);
+    xfree (rects);
 bail0:
     ;
 }
diff --git a/hw/kdrive/savage/s3draw.c b/hw/kdrive/savage/s3draw.c
index 7b6543b..e2766df 100644
--- a/hw/kdrive/savage/s3draw.c
+++ b/hw/kdrive/savage/s3draw.c
@@ -519,7 +519,7 @@ s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
     numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
     if (numRects > NUM_STACK_RECTS)
     {
-	pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
 	if (!pboxClippedBase)
 	    return;
     }
@@ -637,7 +637,7 @@ s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
 				   pboxClippedBase);
     }
     if (pboxClippedBase != stackRects)
-    	DEALLOCATE_LOCAL(pboxClippedBase);
+    	xfree(pboxClippedBase);
 }
 
 void
@@ -771,12 +771,12 @@ s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
     else
     {
 	nTmp = n * miFindMaxBand(pClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(nTmp * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree)
 	{
-	    if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	    if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	    if (pptFree) xfree(pptFree);
+	    if (pwidthFree) xfree(pwidthFree);
 	    return;
 	}
 	n = miClipSpans(fbGetCompositeClip(pGC),
@@ -820,8 +820,8 @@ s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
 	{
 	    _s3FillSpanLargeStipple (pDrawable, pGC, n, ppt, pwidth);
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
     }
     MarkSyncS3 (pDrawable->pScreen);
 }
@@ -2449,12 +2449,12 @@ s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
     else
     {
 	nTmp = n * miFindMaxBand(pClip);
-	pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
-	pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
+	pwidthFree = (int *)xalloc(nTmp * sizeof(int));
+	pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
 	if(!pptFree || !pwidthFree)
 	{
-	    if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	    if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	    if (pptFree) xfree(pptFree);
+	    if (pwidthFree) xfree(pwidthFree);
 	    return;
 	}
 	n = miClipSpans(fbGetCompositeClip(pGC),
@@ -2474,8 +2474,8 @@ s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
 		_s3SolidRect(s3,x*3,y,width*3,1);
 	    }
 	}
-	DEALLOCATE_LOCAL(pptFree);
-	DEALLOCATE_LOCAL(pwidthFree);
+	xfree(pptFree);
+	xfree(pwidthFree);
     }
     MarkSyncS3 (pDrawable->pScreen);
 }
@@ -2610,7 +2610,7 @@ s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
     numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
     if (numRects > NUM_STACK_RECTS)
     {
-	pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
 	if (!pboxClippedBase)
 	    return;
     }
@@ -2718,7 +2718,7 @@ s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
 			  pGC->fgPixel, pGC->alu, pGC->planemask);
     }
     if (pboxClippedBase != stackRects)
-    	DEALLOCATE_LOCAL(pboxClippedBase);
+    	xfree(pboxClippedBase);
 }
 
 void
diff --git a/hw/kdrive/sis530/sisdraw.c b/hw/kdrive/sis530/sisdraw.c
index f2b39a4..5955443 100644
--- a/hw/kdrive/sis530/sisdraw.c
+++ b/hw/kdrive/sis530/sisdraw.c
@@ -1234,12 +1234,12 @@ sisFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
 	return;
     }
     nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC));
-    pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(nTmp * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     n = miClipSpans(fbGetCompositeClip(pGC),
@@ -1273,8 +1273,8 @@ sisFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
 	}
     }
     KdMarkSync (pDrawable->pScreen);
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 #define NUM_STACK_RECTS	1024
@@ -1323,7 +1323,7 @@ sisPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
     numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
     if (numRects > NUM_STACK_RECTS)
     {
-	pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
 	if (!pboxClippedBase)
 	    return;
     }
@@ -1448,7 +1448,7 @@ sisPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
 	}
     }
     if (pboxClippedBase != stackRects)
-    	DEALLOCATE_LOCAL(pboxClippedBase);
+    	xfree(pboxClippedBase);
 }
 
 static const GCOps sisOps = {
diff --git a/hw/kdrive/smi/smivideo.c b/hw/kdrive/smi/smivideo.c
index 46593a0..f372498 100644
--- a/hw/kdrive/smi/smivideo.c
+++ b/hw/kdrive/smi/smivideo.c
@@ -342,7 +342,7 @@ mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
     BoxPtr	pBox = REGION_RECTS (pRgn);
     int		nBox = REGION_NUM_RECTS (pRgn);
     
-    rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle));
+    rects = xalloc (nBox * sizeof (xRectangle));
     if (!rects)
 	goto bail0;
     r = rects;
@@ -371,7 +371,7 @@ mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
 
     FreeScratchGC (pGC);
 bail1:
-    DEALLOCATE_LOCAL (rects);
+    xfree (rects);
 bail0:
     ;
 }
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index b8fbd73..046ab27 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -1927,7 +1927,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
     BoxPtr	pBox = REGION_RECTS (pRgn);
     int		nBox = REGION_NUM_RECTS (pRgn);
     
-    rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle));
+    rects = xalloc (nBox * sizeof (xRectangle));
     if (!rects)
 	goto bail0;
     r = rects;
@@ -1956,7 +1956,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
 
     FreeScratchGC (pGC);
 bail1:
-    DEALLOCATE_LOCAL (rects);
+    xfree (rects);
 bail0:
     ;
 }
commit d57060f16714f5667722001bd1a4500059dd59e1
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:10:21 2007 +0000

    DMX: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 24d1620..5f1fc05 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -424,7 +424,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
     
     if (!_DMXXineramaActive()) goto noxinerama;
 
-    if (!(attribs = ALLOCATE_LOCAL(stuff->screenCount * sizeof(*attribs))))
+    if (!(attribs = xalloc(stuff->screenCount * sizeof(*attribs))))
         return BadAlloc;
 
     for (i = 0; i < stuff->screenCount; i++) {
@@ -443,7 +443,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
 				       &errorScreen);
 #endif
 
-    DEALLOCATE_LOCAL(attribs);
+    xfree(attribs);
 
     if (status == BadValue) return status;
 
@@ -489,7 +489,7 @@ static int ProcDMXAddScreen(ClientPtr client)
     value_list = (CARD32 *)(stuff + 1);
     count      = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
     
-    if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
+    if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
         return BadAlloc;
     memcpy(name, &value_list[count], stuff->displayNameLength);
     name[stuff->displayNameLength] = '\0';
@@ -497,7 +497,7 @@ static int ProcDMXAddScreen(ClientPtr client)
 
     status = dmxAttachScreen(stuff->physicalScreen, &attr);
 
-    DEALLOCATE_LOCAL(name);
+    xfree(name);
 
     rep.type           = X_Reply;
     rep.sequenceNumber = client->sequence;
@@ -617,30 +617,30 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
 
-    if (!(screens = ALLOCATE_LOCAL(count * sizeof(*screens))))
+    if (!(screens = xalloc(count * sizeof(*screens))))
         return BadAlloc;
-    if (!(windows = ALLOCATE_LOCAL(count * sizeof(*windows)))) {
-        DEALLOCATE_LOCAL(screens);
+    if (!(windows = xalloc(count * sizeof(*windows)))) {
+        xfree(screens);
         return BadAlloc;
     }
-    if (!(pos = ALLOCATE_LOCAL(count * sizeof(*pos)))) {
-        DEALLOCATE_LOCAL(windows);
-        DEALLOCATE_LOCAL(screens);
+    if (!(pos = xalloc(count * sizeof(*pos)))) {
+        xfree(windows);
+        xfree(screens);
         return BadAlloc;
     }
-    if (!(vis = ALLOCATE_LOCAL(count * sizeof(*vis)))) {
-        DEALLOCATE_LOCAL(pos);
-        DEALLOCATE_LOCAL(windows);
-        DEALLOCATE_LOCAL(screens);
+    if (!(vis = xalloc(count * sizeof(*vis)))) {
+        xfree(pos);
+        xfree(windows);
+        xfree(screens);
         return BadAlloc;
     }
 
     if ((count = dmxPopulate(client, stuff->window, screens, windows,
                              pos, vis)) < 0) {
-        DEALLOCATE_LOCAL(vis);
-        DEALLOCATE_LOCAL(pos);
-        DEALLOCATE_LOCAL(windows);
-        DEALLOCATE_LOCAL(screens);
+        xfree(vis);
+        xfree(pos);
+        xfree(windows);
+        xfree(screens);
         return BadWindow;
     }
 
@@ -678,10 +678,10 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
         WriteToClient(client, count * sizeof(*vis),     (char *)vis);
     }
 
-    DEALLOCATE_LOCAL(vis);
-    DEALLOCATE_LOCAL(pos);
-    DEALLOCATE_LOCAL(windows);
-    DEALLOCATE_LOCAL(screens);
+    xfree(vis);
+    xfree(pos);
+    xfree(windows);
+    xfree(screens);
 
     return client->noClientException;
 }
@@ -842,7 +842,7 @@ static int ProcDMXAddInput(ClientPtr client)
     value_list = (CARD32 *)(stuff + 1);
     count      = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
     
-    if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4)))
+    if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
         return BadAlloc;
     memcpy(name, &value_list[count], stuff->displayNameLength);
     name[stuff->displayNameLength] = '\0';
@@ -850,7 +850,7 @@ static int ProcDMXAddInput(ClientPtr client)
 
     status = dmxAddInput(&attr, &id);
 
-    DEALLOCATE_LOCAL(name);
+    xfree(name);
 
     if (status) return status;
 
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 1033644..560468c 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -1121,9 +1121,9 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
     }
 
     /* Now allocate the memory we need */
-    images = ALLOCATE_LOCAL(len_images*sizeof(char));
-    gids   = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(Glyph));
-    glyphs = ALLOCATE_LOCAL(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
+    images = xalloc(len_images*sizeof(char));
+    gids   = xalloc(glyphSet->hash.tableEntries*sizeof(Glyph));
+    glyphs = xalloc(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
 
     memset(images, 0, len_images * sizeof(char));
     pos = images;
@@ -1159,9 +1159,9 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
 		     len_images);
 
     /* Clean up */
-    DEALLOCATE_LOCAL(len_images);
-    DEALLOCATE_LOCAL(gids);
-    DEALLOCATE_LOCAL(glyphs);    
+    xfree(len_images);
+    xfree(gids);
+    xfree(glyphs);    
 }
 #endif
 
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 478542a..bbb744c 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -531,13 +531,13 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
 	/* The following only works for Render version > 0.2 */
 
 	/* All of the XGlyphElt* structure sizes are identical */
-	elts = ALLOCATE_LOCAL(nelt * sizeof(XGlyphElt8));
+	elts = xalloc(nelt * sizeof(XGlyphElt8));
 	if (!elts)
 	    return BadAlloc;
 
-	glyphs = ALLOCATE_LOCAL(nglyph * size);
+	glyphs = xalloc(nglyph * size);
 	if (!glyphs) {
-	    DEALLOCATE_LOCAL(elts);
+	    xfree(elts);
 	    return BadAlloc;
 	}
 
@@ -605,8 +605,8 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
 
 	dmxSync(dmxScreen, FALSE);
 
-	DEALLOCATE_LOCAL(elts);
-	DEALLOCATE_LOCAL(glyphs);
+	xfree(elts);
+	xfree(glyphs);
     }
 
     return ret;
commit def6f74f2d7342f85f3df2053e0b9c1ac483b51d
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:10:03 2007 +0000

    Xvfb: Remove usage of alloca
    
    Replace with heap allocations

diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 812326a..0d4ca57 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -482,9 +482,9 @@ vfbInstallColormap(ColormapPtr pmap)
 	swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
 	swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
 
-	ppix = (Pixel *)ALLOCATE_LOCAL(entries * sizeof(Pixel));
-	prgb = (xrgb *)ALLOCATE_LOCAL(entries * sizeof(xrgb));
-	defs = (xColorItem *)ALLOCATE_LOCAL(entries * sizeof(xColorItem));
+	ppix = (Pixel *)xalloc(entries * sizeof(Pixel));
+	prgb = (xrgb *)xalloc(entries * sizeof(xrgb));
+	defs = (xColorItem *)xalloc(entries * sizeof(xColorItem));
 
 	for (i = 0; i < entries; i++)  ppix[i] = i;
 	/* XXX truecolor */
@@ -499,9 +499,9 @@ vfbInstallColormap(ColormapPtr pmap)
 	}
 	(*pmap->pScreen->StoreColors)(pmap, entries, defs);
 
-	DEALLOCATE_LOCAL(ppix);
-	DEALLOCATE_LOCAL(prgb);
-	DEALLOCATE_LOCAL(defs);
+	xfree(ppix);
+	xfree(prgb);
+	xfree(defs);
     }
 }
 
commit 259f4c36d581896ce605741b9e557a589013a9b8
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:09:49 2007 +0000

    Xprint: Remove usage of alloca
    
    Replace with heap-based allocations.

diff --git a/hw/xprint/ps/PsText.c b/hw/xprint/ps/PsText.c
index 98cf153..872c0f4 100644
--- a/hw/xprint/ps/PsText.c
+++ b/hw/xprint/ps/PsText.c
@@ -535,7 +535,7 @@ PsPolyGlyphBlt(
 
     
     nbyLine = BitmapBytePad(width);
-    pbits = (unsigned char *)ALLOCATE_LOCAL(height*nbyLine);
+    pbits = (unsigned char *)xalloc(height*nbyLine);
     if (!pbits){
         PsDestroyPixmap(pPixmap);
         return;
@@ -576,6 +576,6 @@ PsPolyGlyphBlt(
         
         x  += pci->metrics.characterWidth;
     }
-    DEALLOCATE_LOCAL(pbits);
+    xfree(pbits);
     FreeScratchGC(pGCtmp);
 }
commit 1c84337af0ac40498a53aa36289e2f6f5ff8b1c6
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:09:32 2007 +0000

    Xwin: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c
index e844dbf..1600996 100644
--- a/hw/xwin/winwindow.c
+++ b/hw/xwin/winwindow.c
@@ -167,7 +167,7 @@ winCopyWindowNativeGDI (WindowPtr pWin,
   nbox = REGION_NUM_RECTS(prgnDst);
 
   /* Allocate source points for each box */
-  if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+  if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
     return;
 
   /* Set an iterator pointer */
@@ -206,7 +206,7 @@ winCopyWindowNativeGDI (WindowPtr pWin,
     }
 
   /* Cleanup the regions, etc. */
-  DEALLOCATE_LOCAL(pptSrc);
+  xfree(pptSrc);
   REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
 }
 
commit f7d5c292e44113ea8eb32e67e91cd02e520df5e3
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:09:14 2007 +0000

    mfb: Remove usage of alloca
    
    Replace with heap-based allocations.

diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c
index 0f84df3..153cf6a 100644
--- a/mfb/mfbbitblt.c
+++ b/mfb/mfbbitblt.c
@@ -351,7 +351,7 @@ int dstx, dsty;
     numRects = REGION_NUM_RECTS(&rgnDst);
     if (numRects && width && height)
     {
-	if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects *
+	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
 						  sizeof(DDXPointRec))))
 	{
 	    REGION_UNINIT(pGC->pScreen, &rgnDst);
@@ -370,7 +370,7 @@ int dstx, dsty;
 	if (pGC->planemask & 1)
 	    (*localDoBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc);
 
-	DEALLOCATE_LOCAL(pptSrc);
+	xfree(pptSrc);
     }
 
     prgnExposed = NULL;
diff --git a/mfb/mfbblt.c b/mfb/mfbblt.c
index 4c30281..b87a697 100644
--- a/mfb/mfbblt.c
+++ b/mfb/mfbblt.c
@@ -119,13 +119,13 @@ MROP_NAME(mfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc)
 	if (nbox > 1)
 	{
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
-	    pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pptNew1)
 	    {
-	        DEALLOCATE_LOCAL(pboxNew1);
+	        xfree(pboxNew1);
 	        return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -163,16 +163,16 @@ MROP_NAME(mfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc)
 	if (nbox > 1)
 	{
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
+	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
 	    if(!pboxNew2 || !pptNew2)
 	    {
-		if (pptNew2) DEALLOCATE_LOCAL(pptNew2);
-		if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2);
+		if (pptNew2) xfree(pptNew2);
+		if (pboxNew2) xfree(pboxNew2);
 		if (pboxNew1)
 		{
-		    DEALLOCATE_LOCAL(pptNew1);
-		    DEALLOCATE_LOCAL(pboxNew1);
+		    xfree(pptNew1);
+		    xfree(pboxNew1);
 		}
 	        return;
 	    }
@@ -578,12 +578,12 @@ bits1 = *--psrc; --pdst; \
     }
     if (pboxNew2)
     {
-	DEALLOCATE_LOCAL(pptNew2);
-	DEALLOCATE_LOCAL(pboxNew2);
+	xfree(pptNew2);
+	xfree(pboxNew2);
     }
     if (pboxNew1)
     {
-	DEALLOCATE_LOCAL(pptNew1);
-	DEALLOCATE_LOCAL(pboxNew1);
+	xfree(pptNew1);
+	xfree(pboxNew1);
     }
 }
diff --git a/mfb/mfbfillrct.c b/mfb/mfbfillrct.c
index f9209d0..594c7f0 100644
--- a/mfb/mfbfillrct.c
+++ b/mfb/mfbfillrct.c
@@ -118,7 +118,7 @@ mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
     numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
     if (numRects > NUM_STACK_RECTS)
     {
-	pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec));
+	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
 	if (!pboxClippedBase)
 	    return;
     }
@@ -222,5 +222,5 @@ mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
     if (pboxClipped != pboxClippedBase)
 	(*pfn) (pDrawable,pboxClipped-pboxClippedBase, pboxClippedBase, alu, ppix);
     if (pboxClippedBase != stackRects)
-    	DEALLOCATE_LOCAL(pboxClippedBase);
+    	xfree(pboxClippedBase);
 }
diff --git a/mfb/mfbfillsp.c b/mfb/mfbfillsp.c
index 112f532..f83ca6a 100644
--- a/mfb/mfbfillsp.c
+++ b/mfb/mfbfillsp.c
@@ -111,12 +111,12 @@ mfbBlackSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -151,8 +151,8 @@ mfbBlackSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	pwidth++;
 	ppt++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -183,12 +183,12 @@ mfbWhiteSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -223,8 +223,8 @@ mfbWhiteSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	pwidth++;
 	ppt++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -255,12 +255,12 @@ mfbInvertSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -295,8 +295,8 @@ mfbInvertSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	pwidth++;
 	ppt++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -330,12 +330,12 @@ mfbWhiteStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -372,8 +372,8 @@ mfbWhiteStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	pwidth++;
 	ppt++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -407,12 +407,12 @@ mfbBlackStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -449,8 +449,8 @@ mfbBlackStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	pwidth++;
 	ppt++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -484,12 +484,12 @@ mfbInvertStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -526,8 +526,8 @@ mfbInvertStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	pwidth++;
 	ppt++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -603,12 +603,12 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -708,8 +708,8 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	}
 	break;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -746,12 +746,12 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -873,8 +873,8 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	ppt++;
 	pwidth++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
 
 
@@ -912,12 +912,12 @@ mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	return;
 
     n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
-    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
+    pwidthFree = (int *)xalloc(n * sizeof(int));
+    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
     if(!pptFree || !pwidthFree)
     {
-	if (pptFree) DEALLOCATE_LOCAL(pptFree);
-	if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
+	if (pptFree) xfree(pptFree);
+	if (pwidthFree) xfree(pwidthFree);
 	return;
     }
     pwidth = pwidthFree;
@@ -1021,6 +1021,6 @@ mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
 	ppt++;
 	pwidth++;
     }
-    DEALLOCATE_LOCAL(pptFree);
-    DEALLOCATE_LOCAL(pwidthFree);
+    xfree(pptFree);
+    xfree(pwidthFree);
 }
diff --git a/mfb/mfbimggblt.c b/mfb/mfbimggblt.c
index e5c186b..c21e826 100644
--- a/mfb/mfbimggblt.c
+++ b/mfb/mfbimggblt.c
@@ -293,7 +293,7 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 	int getWidth;		/* bits to get from glyph */
 #endif
 
-	if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS))))
+	if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
 	    return;
 
 	pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
@@ -434,7 +434,7 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 		}
 	    } /* for each glyph */
 	} /* while nbox-- */
-	DEALLOCATE_LOCAL(ppos);
+	xfree(ppos);
 	break;
       }
       default:
diff --git a/mfb/mfbpixmap.c b/mfb/mfbpixmap.c
index 1472b44..438e9ab 100644
--- a/mfb/mfbpixmap.c
+++ b/mfb/mfbpixmap.c
@@ -253,13 +253,13 @@ mfbYRotatePixmap(pPix, rh)
 
     nbyDown = rh * pPix->devKind;
     nbyUp = (pPix->devKind * height) - nbyDown;
-    if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp)))
+    if(!(ptmp = (char *)xalloc(nbyUp)))
 	return;
 
     memmove(ptmp, pbase, nbyUp);		/* save the low rows */
     memmove(pbase, pbase+nbyUp, nbyDown);	/* slide the top rows down */
     memmove(pbase+nbyDown, ptmp, nbyUp);	/* move lower rows up to row rh */
-    DEALLOCATE_LOCAL(ptmp);
+    xfree(ptmp);
 }
 
 void
diff --git a/mfb/mfbplygblt.c b/mfb/mfbplygblt.c
index 997e4a3..1bd56e1 100644
--- a/mfb/mfbplygblt.c
+++ b/mfb/mfbplygblt.c
@@ -254,7 +254,7 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 	int getWidth;		/* bits to get from glyph */
 #endif
 
-	if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS))))
+	if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
 	    return;
 
         pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
@@ -388,7 +388,7 @@ MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 		}
 	    } /* for each glyph */
 	} /* while nbox-- */
-	DEALLOCATE_LOCAL(ppos);
+	xfree(ppos);
 	break;
       }
       default:
diff --git a/mfb/mfbpushpxl.c b/mfb/mfbpushpxl.c
index ddf7b3c..de96992 100644
--- a/mfb/mfbpushpxl.c
+++ b/mfb/mfbpushpxl.c
@@ -132,7 +132,7 @@ mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
     if (!REGION_NIL(&rgnDst))
     {
 	i = REGION_NUM_RECTS(&rgnDst);
-	pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
+	pptSrc = (DDXPointPtr)xalloc(i * sizeof(DDXPointRec));
         if(pptSrc)
         {
 	    for (pbox = REGION_RECTS(&rgnDst), ppt = pptSrc;
@@ -143,7 +143,7 @@ mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
 		ppt->y = pbox->y1 - yOrg;
 	    }
 	    mfbDoBitblt((DrawablePtr)pBitMap, pDrawable, alu, &rgnDst, pptSrc);
-	    DEALLOCATE_LOCAL(pptSrc);
+	    xfree(pptSrc);
 	}
     }
     REGION_UNINIT(pGC->pScreen, &rgnDst);
diff --git a/mfb/mfbwindow.c b/mfb/mfbwindow.c
index 4cbf59f..30b8857 100644
--- a/mfb/mfbwindow.c
+++ b/mfb/mfbwindow.c
@@ -150,7 +150,7 @@ mfbCopyWindow(pWin, ptOldOrg, prgnSrc)
 
     pbox = REGION_RECTS(prgnDst);
     nbox = REGION_NUM_RECTS(prgnDst);
-    if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
+    if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
 	return;
     ppt = pptSrc;
 
@@ -162,6 +162,6 @@ mfbCopyWindow(pWin, ptOldOrg, prgnSrc)
 
     mfbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
 		GXcopy, prgnDst, pptSrc);
-    DEALLOCATE_LOCAL(pptSrc);
+    xfree(pptSrc);
     REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
 }
commit be9ee17f960cc3d8a8f999cab1579e83d9aea520
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:08:51 2007 +0000

    mi: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/mi/miarc.c b/mi/miarc.c
index 7088815..5ccd111 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -925,14 +925,14 @@ miFillWideEllipse(
 
     yorgu = parc->height + pGC->lineWidth;
     n = (sizeof(int) * 2) * yorgu;
-    widths = (int *)ALLOCATE_LOCAL(n + (sizeof(DDXPointRec) * 2) * yorgu);
+    widths = (int *)xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
     if (!widths)
 	return;
     points = (DDXPointPtr)((char *)widths + n);
     spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree);
     if (!spdata)
     {
-	DEALLOCATE_LOCAL(widths);
+	xfree(widths);
 	return;
     }
     pts = points;
@@ -1025,7 +1025,7 @@ miFillWideEllipse(
 	xfree(spdata);
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
 
-    DEALLOCATE_LOCAL(widths);
+    xfree(widths);
 }
 
 /*
@@ -1899,13 +1899,13 @@ miComputeArcs (
 	isDoubleDash = (pGC->lineStyle == LineDoubleDash);
 	dashOffset = pGC->dashOffset;
 
-	data = (struct arcData *) ALLOCATE_LOCAL (narcs * sizeof (struct arcData));
+	data = (struct arcData *) xalloc (narcs * sizeof (struct arcData));
 	if (!data)
 	    return (miPolyArcPtr)NULL;
 	arcs = (miPolyArcPtr) xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
 	if (!arcs)
 	{
-	    DEALLOCATE_LOCAL(data);
+	    xfree(data);
 	    return (miPolyArcPtr)NULL;
 	}
 	for (i = 0; i < narcs; i++) {
@@ -2254,11 +2254,11 @@ miComputeArcs (
 			arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
 			         arcs[iphase].ncaps;
 		}
-	DEALLOCATE_LOCAL(data);
+	xfree(data);
 	return arcs;
 arcfail:
 	miFreeArcs(arcs, pGC);
-	DEALLOCATE_LOCAL(data);
+	xfree(data);
 	return (miPolyArcPtr)NULL;
 }
 
@@ -3162,8 +3162,8 @@ fillSpans (
 
 	if (nspans == 0)
 		return;
-	xSpan = xSpans = (DDXPointPtr) ALLOCATE_LOCAL (nspans * sizeof (DDXPointRec));
-	xWidth = xWidths = (int *) ALLOCATE_LOCAL (nspans * sizeof (int));
+	xSpan = xSpans = (DDXPointPtr) xalloc (nspans * sizeof (DDXPointRec));
+	xWidth = xWidths = (int *) xalloc (nspans * sizeof (int));
 	if (xSpans && xWidths)
 	{
 	    i = 0;
@@ -3183,9 +3183,9 @@ fillSpans (
 	}
 	disposeFinalSpans ();
 	if (xSpans)
-	    DEALLOCATE_LOCAL (xSpans);
+	    xfree (xSpans);
 	if (xWidths)
-	    DEALLOCATE_LOCAL (xWidths);
+	    xfree (xWidths);
 	finalMiny = 0;
 	finalMaxy = -1;
 	finalSize = 0;
diff --git a/mi/mibank.c b/mi/mibank.c
index d693f26..859770c 100644
--- a/mi/mibank.c
+++ b/mi/mibank.c
@@ -172,8 +172,8 @@ typedef struct _miBankQueue
         (*pScreenPriv->BankInfo.SetDestinationBank)(pScreen, (_no)) - \
         (pScreenPriv->BankInfo.BankSize * (_no)))
 
-#define ALLOCATE_LOCAL_ARRAY(atype, ntype) \
-    (atype *)ALLOCATE_LOCAL((ntype) * sizeof(atype))
+#define xalloc_ARRAY(atype, ntype) \
+    (atype *)xalloc((ntype) * sizeof(atype))
 
 static int           miBankScreenIndex;
 static int           miBankGCIndex;
@@ -318,14 +318,14 @@ static unsigned long miBankGeneration = 0;
             atype *aarg = pArray, *acopy; \
             int   i; \
             CLIP_SAVE; \
-            if ((acopy = ALLOCATE_LOCAL_ARRAY(atype, nArray))) \
+            if ((acopy = xalloc_ARRAY(atype, nArray))) \
                 aarg = acopy; \
             GCOP_TOP_PART; \
             if (acopy) \
                 memcpy(acopy, pArray, nArray * sizeof(atype)); \
             (*pGC->ops->aop)(pDrawable, pGC, GCOP_ARGS nArray, aarg); \
             GCOP_BOTTOM_PART; \
-            DEALLOCATE_LOCAL(acopy); \
+            xfree(acopy); \
             CLIP_RESTORE; \
         } \
         SCREEN_RESTORE; \
@@ -787,7 +787,7 @@ miBankCopy(
             fastBlit = pGCPriv->fastCopy;
 
         nQueue = nBox * pScreenPriv->maxRects * 2;
-        pQueue = Queue = ALLOCATE_LOCAL_ARRAY(miBankQueue, nQueue);
+        pQueue = Queue = xalloc_ARRAY(miBankQueue, nQueue);
 
         if (Queue)
         {
@@ -953,7 +953,7 @@ miBankCopy(
 
             paddedWidth = PixmapBytePad(maxWidth,
                 pScreenPriv->pScreenPixmap->drawable.depth);
-            pImage = (char *)ALLOCATE_LOCAL(paddedWidth * maxHeight);
+            pImage = (char *)xalloc(paddedWidth * maxHeight);
 
             pGC->fExpose = FALSE;
 
@@ -1031,7 +1031,7 @@ miBankCopy(
                 pQueue++;
             }
 
-            DEALLOCATE_LOCAL(pImage);
+            xfree(pImage);
 
             BANK_RESTORE;
         }
@@ -1040,7 +1040,7 @@ miBankCopy(
 
         pGC->fExpose = fExpose;
 
-        DEALLOCATE_LOCAL(Queue);
+        xfree(Queue);
     }
 
     SCREEN_RESTORE;
@@ -1748,7 +1748,7 @@ miBankGetImage(
 
             paddedWidth = PixmapBytePad(w,
                 pScreenPriv->pScreenPixmap->drawable.depth);
-            pBankImage = (char *)ALLOCATE_LOCAL(paddedWidth * h);
+            pBankImage = (char *)xalloc(paddedWidth * h);
 
             if (pBankImage)
             {
@@ -1768,7 +1768,7 @@ miBankGetImage(
 
                 BANK_RESTORE;
 
-                DEALLOCATE_LOCAL(pBankImage);
+                xfree(pBankImage);
             }
         }
 
@@ -1809,7 +1809,7 @@ miBankGetSpans(
             paddedWidth =
                 PixmapBytePad(pScreenPriv->pScreenPixmap->drawable.width,
                     pScreenPriv->pScreenPixmap->drawable.depth);
-            pBankImage = (char *)ALLOCATE_LOCAL(paddedWidth);
+            pBankImage = (char *)xalloc(paddedWidth);
 
             if (pBankImage)
             {
@@ -1838,7 +1838,7 @@ miBankGetSpans(
 
                 BANK_RESTORE;
 
-                DEALLOCATE_LOCAL(pBankImage);
+                xfree(pBankImage);
             }
         }
 
@@ -1911,7 +1911,7 @@ miBankCopyWindow(
         if (dy < 0)
         {
             /* Sort boxes from bottom to top */
-            pBoxNew1 = ALLOCATE_LOCAL_ARRAY(BoxRec, nBox);
+            pBoxNew1 = xalloc_ARRAY(BoxRec, nBox);
 
             if (pBoxNew1)
             {
@@ -1939,7 +1939,7 @@ miBankCopyWindow(
         if (dx < 0)
         {
             /* Sort boxes from right to left */
-            pBoxNew2 = ALLOCATE_LOCAL_ARRAY(BoxRec, nBox);
+            pBoxNew2 = xalloc_ARRAY(BoxRec, nBox);
 
             if (pBoxNew2)
             {
@@ -1979,8 +1979,8 @@ miBankCopyWindow(
 
     REGION_DESTROY(pScreen, pRgnDst);
 
-    DEALLOCATE_LOCAL(pBoxNew2);
-    DEALLOCATE_LOCAL(pBoxNew1);
+    xfree(pBoxNew2);
+    xfree(pBoxNew1);
 }
 
 _X_EXPORT Bool
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 1ddccdd..14d68e2 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -143,21 +143,21 @@ miCopyArea(pSrcDrawable, pDstDrawable,
     }
 
     pptFirst = ppt = (DDXPointPtr)
-        ALLOCATE_LOCAL(heightSrc * sizeof(DDXPointRec));
+        xalloc(heightSrc * sizeof(DDXPointRec));
     pwidthFirst = pwidth = (unsigned int *)
-        ALLOCATE_LOCAL(heightSrc * sizeof(unsigned int));
+        xalloc(heightSrc * sizeof(unsigned int));
     numRects = REGION_NUM_RECTS(prgnSrcClip);
     boxes = REGION_RECTS(prgnSrcClip);
     ordering = (unsigned int *)
-        ALLOCATE_LOCAL(numRects * sizeof(unsigned int));
+        xalloc(numRects * sizeof(unsigned int));
     if(!pptFirst || !pwidthFirst || !ordering)
     {
        if (ordering)
-	   DEALLOCATE_LOCAL(ordering);
+	   xfree(ordering);
        if (pwidthFirst)
-           DEALLOCATE_LOCAL(pwidthFirst);
+           xfree(pwidthFirst);
        if (pptFirst)
-           DEALLOCATE_LOCAL(pptFirst);
+           xfree(pptFirst);
        return (RegionPtr)NULL;
     }
 
@@ -264,9 +264,9 @@ miCopyArea(pSrcDrawable, pDstDrawable,
     if(realSrcClip)
 	REGION_DESTROY(pGC->pScreen, prgnSrcClip);
 		
-    DEALLOCATE_LOCAL(ordering);
-    DEALLOCATE_LOCAL(pwidthFirst);
-    DEALLOCATE_LOCAL(pptFirst);
+    xfree(ordering);
+    xfree(pwidthFirst);
+    xfree(pptFirst);
     return prgnExposed;
 }
 
@@ -433,12 +433,12 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
     dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv);
     ValidateGC((DrawablePtr)pPixmap, pGCT);
     miClearDrawable((DrawablePtr)pPixmap, pGCT);
-    ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec));
-    pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int));
+    ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec));
+    pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int));
     if(!pptFirst || !pwidthFirst)
     {
-	if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst);
-	if (pptFirst) DEALLOCATE_LOCAL(pptFirst);
+	if (pwidthFirst) xfree(pwidthFirst);
+	if (pptFirst) xfree(pptFirst);
 	FreeScratchGC(pGCT);
 	return;
     }
@@ -464,8 +464,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
 
     (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits,
 			   pptFirst, pwidthFirst, h, TRUE);
-    DEALLOCATE_LOCAL(pwidthFirst);
-    DEALLOCATE_LOCAL(pptFirst);
+    xfree(pwidthFirst);
+    xfree(pptFirst);
 
 
     /* Save current values from the client GC */
@@ -808,14 +808,14 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
 	break;
 
       case ZPixmap:
-    	ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec));
-    	pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int));
+    	ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec));
+    	pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int));
 	if(!pptFirst || !pwidthFirst)
         {
 	   if (pwidthFirst)
-               DEALLOCATE_LOCAL(pwidthFirst);
+               xfree(pwidthFirst);
            if (pptFirst)
-               DEALLOCATE_LOCAL(pptFirst);
+               xfree(pptFirst);
            return;
         }
 	if (pGC->miTranslate)
@@ -834,8 +834,8 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
 
 	(*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst,
 			      pwidthFirst, h, TRUE);
-	DEALLOCATE_LOCAL(pwidthFirst);
-	DEALLOCATE_LOCAL(pptFirst);
+	xfree(pwidthFirst);
+	xfree(pptFirst);
 	break;
     }
 }
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 6ace9f5..2d3b0d5 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -369,7 +369,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
 
 	numRects = REGION_NUM_RECTS(pRgn);
 	pBox = REGION_RECTS(pRgn);
-	if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
+	if(!(pEvent = (xEvent *)xalloc(numRects * sizeof(xEvent))))
 		return;
 	pe = pEvent;
 
@@ -387,7 +387,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
 	}
 	TryClientEvents(client, pEvent, numRects,
 			    (Mask)0, NoEventMask, NullGrab);
-	DEALLOCATE_LOCAL(pEvent);
+	xfree(pEvent);
     }
     else
     {
@@ -415,7 +415,7 @@ miSendExposures(pWin, pRgn, dx, dy)
 
     pBox = REGION_RECTS(pRgn);
     numRects = REGION_NUM_RECTS(pRgn);
-    if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
+    if(!(pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent))))
 	return;
 
     for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
@@ -445,7 +445,7 @@ miSendExposures(pWin, pRgn, dx, dy)
 	    win = PanoramiXFindIDByScrnum(XRT_WINDOW, 
 			pWin->drawable.id, scrnum);
 	    if(!win) {
-		DEALLOCATE_LOCAL(pEvent);
+		xfree(pEvent);
 		return;
 	    }
 	    realWin = win->info[0].id;
@@ -462,7 +462,7 @@ miSendExposures(pWin, pRgn, dx, dy)
 
     DeliverEvents(pWin, pEvent, numRects, NullWindow);
 
-    DEALLOCATE_LOCAL(pEvent);
+    xfree(pEvent);
 }
 
 _X_EXPORT void 
@@ -620,7 +620,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
     }
 
-    prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) *
+    prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) *
 					 sizeof(xRectangle));
     if (!prect)
 	return;
@@ -628,7 +628,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     pGC = GetScratchGC(drawable->depth, drawable->pScreen);
     if (!pGC)
     {
-	DEALLOCATE_LOCAL(prect);
+	xfree(prect);
 	return;
     }
     
@@ -646,7 +646,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     }
     prect -= numRects;
     (*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect);
-    DEALLOCATE_LOCAL(prect);
+    xfree(prect);
 
     FreeScratchGC(pGC);
 }
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index c561b1f..f68ddf4 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -551,13 +551,13 @@ miFillEllipseI(
     int *widths;
     int *wids;
 
-    points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height);
+    points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height);
     if (!points)
 	return;
-    widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height);
+    widths = (int *)xalloc(sizeof(int) * arc->height);
     if (!widths)
     {
-	DEALLOCATE_LOCAL(points);
+	xfree(points);
 	return;
     }
     miFillArcSetup(arc, &info);
@@ -575,8 +575,8 @@ miFillEllipseI(
 	ADDSPANS();
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    DEALLOCATE_LOCAL(widths);
-    DEALLOCATE_LOCAL(points);
+    xfree(widths);
+    xfree(points);
 }
 
 static void
@@ -594,13 +594,13 @@ miFillEllipseD(
     int *widths;
     int *wids;
 
-    points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height);
+    points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height);
     if (!points)
 	return;
-    widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height);
+    widths = (int *)xalloc(sizeof(int) * arc->height);
     if (!widths)
     {
-	DEALLOCATE_LOCAL(points);
+	xfree(points);
 	return;
     }
     miFillArcDSetup(arc, &info);
@@ -618,8 +618,8 @@ miFillEllipseD(
 	ADDSPANS();
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    DEALLOCATE_LOCAL(widths);
-    DEALLOCATE_LOCAL(points);
+    xfree(widths);
+    xfree(points);
 }
 
 #define ADDSPAN(l,r) \
@@ -666,13 +666,13 @@ miFillArcSliceI(
     slw = arc->height;
     if (slice.flip_top || slice.flip_bot)
 	slw += (arc->height >> 1) + 1;
-    points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw);
+    points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw);
     if (!points)
 	return;
-    widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw);
+    widths = (int *)xalloc(sizeof(int) * slw);
     if (!widths)
     {
-	DEALLOCATE_LOCAL(points);
+	xfree(points);
 	return;
     }
     if (pGC->miTranslate)
@@ -703,8 +703,8 @@ miFillArcSliceI(
 	}
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    DEALLOCATE_LOCAL(widths);
-    DEALLOCATE_LOCAL(points);
+    xfree(widths);
+    xfree(points);
 }
 
 static void
@@ -730,13 +730,13 @@ miFillArcSliceD(
     slw = arc->height;
     if (slice.flip_top || slice.flip_bot)
 	slw += (arc->height >> 1) + 1;
-    points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw);
+    points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw);
     if (!points)
 	return;
-    widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw);
+    widths = (int *)xalloc(sizeof(int) * slw);
     if (!widths)
     {
-	DEALLOCATE_LOCAL(points);
+	xfree(points);
 	return;
     }
     if (pGC->miTranslate)
@@ -767,8 +767,8 @@ miFillArcSliceD(
 	}
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    DEALLOCATE_LOCAL(widths);
-    DEALLOCATE_LOCAL(points);
+    xfree(widths);
+    xfree(points);
 }
 
 /* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
diff --git a/mi/mifillrct.c b/mi/mifillrct.c
index ca7e864..e7646cf 100644
--- a/mi/mifillrct.c
+++ b/mi/mifillrct.c
@@ -106,12 +106,12 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
 	    maxheight = max(maxheight, prect->height);
     }
 
-    pptFirst = (DDXPointPtr) ALLOCATE_LOCAL(maxheight * sizeof(DDXPointRec));
-    pwFirst = (int *) ALLOCATE_LOCAL(maxheight * sizeof(int));
+    pptFirst = (DDXPointPtr) xalloc(maxheight * sizeof(DDXPointRec));
+    pwFirst = (int *) xalloc(maxheight * sizeof(int));
     if(!pptFirst || !pwFirst)
     {
-	if (pwFirst) DEALLOCATE_LOCAL(pwFirst);
-	if (pptFirst) DEALLOCATE_LOCAL(pptFirst);
+	if (pwFirst) xfree(pwFirst);
+	if (pptFirst) xfree(pptFirst);
 	return;
     }
 
@@ -137,6 +137,6 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
 			   1);
 	prect++;
     }
-    DEALLOCATE_LOCAL(pwFirst);
-    DEALLOCATE_LOCAL(pptFirst);
+    xfree(pwFirst);
+    xfree(pptFirst);
 }
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
index f851971..d19f031 100644
--- a/mi/mifpolycon.c
+++ b/mi/mifpolycon.c
@@ -114,15 +114,15 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
     y = ymax - ymin + 1;
     if ((count < 3) || (y <= 0))
 	return;
-    ptsOut = FirstPoint = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * y);
-    width = FirstWidth = (int *) ALLOCATE_LOCAL(sizeof(int) * y);
-    Marked = (int *) ALLOCATE_LOCAL(sizeof(int) * count);
+    ptsOut = FirstPoint = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * y);
+    width = FirstWidth = (int *) xalloc(sizeof(int) * y);
+    Marked = (int *) xalloc(sizeof(int) * count);
 
     if(!ptsOut || !width || !Marked)
     {
-	if (Marked) DEALLOCATE_LOCAL(Marked);
-	if (width) DEALLOCATE_LOCAL(width);
-	if (ptsOut) DEALLOCATE_LOCAL(ptsOut);
+	if (Marked) xfree(Marked);
+	if (width) xfree(width);
+	if (ptsOut) xfree(ptsOut);
 	return;
     }
 
@@ -236,9 +236,9 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
     /* Finally, fill the spans we've collected */
     (*pgc->ops->FillSpans)(dst, pgc, 
 		      ptsOut-FirstPoint, FirstPoint, FirstWidth, 1);
-    DEALLOCATE_LOCAL(Marked);
-    DEALLOCATE_LOCAL(FirstWidth);
-    DEALLOCATE_LOCAL(FirstPoint);
+    xfree(Marked);
+    xfree(FirstWidth);
+    xfree(FirstPoint);
 }
 
 
diff --git a/mi/miglblt.c b/mi/miglblt.c
index c9ae02d..0155b56 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -139,7 +139,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
     DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
 
     nbyLine = BitmapBytePad(width);
-    pbits = (unsigned char *)ALLOCATE_LOCAL(height*nbyLine);
+    pbits = (unsigned char *)xalloc(height*nbyLine);
     if (!pbits)
     {
 	(*pDrawable->pScreen->DestroyPixmap)(pPixmap);
@@ -190,7 +190,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
 	x += pci->metrics.characterWidth;
     }
     (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
-    DEALLOCATE_LOCAL(pbits);
+    xfree(pbits);
     FreeScratchGC(pGCtmp);
 }
 
diff --git a/mi/mipolycon.c b/mi/mipolycon.c
index e2d666e..6aabad6 100644
--- a/mi/mipolycon.c
+++ b/mi/mipolycon.c
@@ -104,12 +104,12 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
     dy = ymax - ymin + 1;
     if ((count < 3) || (dy < 0))
 	return(TRUE);
-    ptsOut = FirstPoint = (DDXPointPtr )ALLOCATE_LOCAL(sizeof(DDXPointRec)*dy);
-    width = FirstWidth = (int *)ALLOCATE_LOCAL(sizeof(int) * dy);
+    ptsOut = FirstPoint = (DDXPointPtr )xalloc(sizeof(DDXPointRec)*dy);
+    width = FirstWidth = (int *)xalloc(sizeof(int) * dy);
     if(!FirstPoint || !FirstWidth)
     {
-	if (FirstWidth) DEALLOCATE_LOCAL(FirstWidth);
-	if (FirstPoint) DEALLOCATE_LOCAL(FirstPoint);
+	if (FirstWidth) xfree(FirstWidth);
+	if (FirstPoint) xfree(FirstPoint);
 	return(FALSE);
     }
 
@@ -174,8 +174,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
 	/* in case we're called with non-convex polygon */
 	if(i < 0)
         {
-	    DEALLOCATE_LOCAL(FirstWidth);
-	    DEALLOCATE_LOCAL(FirstPoint);
+	    xfree(FirstWidth);
+	    xfree(FirstPoint);
 	    return(TRUE);
 	}
         while (i-- > 0) 
@@ -209,8 +209,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
     (*pgc->ops->FillSpans)(dst, pgc, 
 		      ptsOut-FirstPoint,FirstPoint,FirstWidth,
 		      1);
-    DEALLOCATE_LOCAL(FirstWidth);
-    DEALLOCATE_LOCAL(FirstPoint);
+    xfree(FirstWidth);
+    xfree(FirstPoint);
     return(TRUE);
 }
 
diff --git a/mi/mipolygen.c b/mi/mipolygen.c
index 0d2ecc4..7623fc4 100644
--- a/mi/mipolygen.c
+++ b/mi/mipolygen.c
@@ -92,13 +92,13 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
 	return(TRUE);
 
     if(!(pETEs = (EdgeTableEntry *)
-        ALLOCATE_LOCAL(sizeof(EdgeTableEntry) * count)))
+        xalloc(sizeof(EdgeTableEntry) * count)))
 	return(FALSE);
     ptsOut = FirstPoint;
     width = FirstWidth;
     if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
     {
-	DEALLOCATE_LOCAL(pETEs);
+	xfree(pETEs);
 	return(FALSE);
     }
     pSLL = ET.scanlines.next;
@@ -224,7 +224,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
      *     Get any spans that we missed by buffering
      */
     (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1);
-    DEALLOCATE_LOCAL(pETEs);
+    xfree(pETEs);
     miFreeStorage(SLLBlock.next);
     return(TRUE);
 }
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index afe3f72..56026bd 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -106,7 +106,7 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
 	DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
 	ValidateGC(pDrawable, pGC);
     }
-    if(!(pwidthInit = (int *)ALLOCATE_LOCAL(npt * sizeof(int))))
+    if(!(pwidthInit = (int *)xalloc(npt * sizeof(int))))
 	return;
     pwidth = pwidthInit;
     for(i = 0; i < npt; i++)
@@ -118,6 +118,6 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
 	DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
 	ValidateGC(pDrawable, pGC);
     }
-    DEALLOCATE_LOCAL(pwidthInit);
+    xfree(pwidthInit);
 }
 
diff --git a/mi/mipolyrect.c b/mi/mipolyrect.c
index a9ab909..7886248 100644
--- a/mi/mipolyrect.c
+++ b/mi/mipolyrect.c
@@ -94,7 +94,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
 	offset2 = pGC->lineWidth;
 	offset1 = offset2 >> 1;
 	offset3 = offset2 - offset1;
-	tmp = (xRectangle *) ALLOCATE_LOCAL(ntmp * sizeof (xRectangle));
+	tmp = (xRectangle *) xalloc(ntmp * sizeof (xRectangle));
 	if (!tmp)
 	    return;
 	t = tmp;
@@ -162,7 +162,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
 	    }
 	}
 	(*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
-	DEALLOCATE_LOCAL ((pointer) tmp);
+	xfree ((pointer) tmp);
     }
     else
     {
diff --git a/mi/mispans.c b/mi/mispans.c
index 530d9df..6f30155 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -528,7 +528,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
 	xfree(points);
 	xfree(widths);
 	xfree(yspans);
-	xfree(ysizes);		/* use (DE)ALLOCATE_LOCAL for these? */
+	xfree(ysizes);		/* use (DE)xalloc for these? */
     }
 
     spanGroup->count = 0;
diff --git a/mi/miwideline.c b/mi/miwideline.c
index 8c6022f..f080ca1 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -95,13 +95,13 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     
     if (!spanData)
     {
-    	pptInit = (DDXPointPtr) ALLOCATE_LOCAL (overall_height * sizeof(*ppt));
+    	pptInit = (DDXPointPtr) xalloc (overall_height * sizeof(*ppt));
     	if (!pptInit)
 	    return;
-    	pwidthInit = (int *) ALLOCATE_LOCAL (overall_height * sizeof(*pwidth));
+    	pwidthInit = (int *) xalloc (overall_height * sizeof(*pwidth));
     	if (!pwidthInit)
     	{
-	    DEALLOCATE_LOCAL (pptInit);
+	    xfree (pptInit);
 	    return;
     	}
 	ppt = pptInit;
@@ -167,8 +167,8 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     if (!spanData)
     {
     	(*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE);
-    	DEALLOCATE_LOCAL (pwidthInit);
-    	DEALLOCATE_LOCAL (pptInit);
+    	xfree (pwidthInit);
+    	xfree (pptInit);
     	if (pixel != oldPixel)
     	{
 	    DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
@@ -1045,13 +1045,13 @@ miLineArc (
     }
     if (!spanData)
     {
-    	points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * pGC->lineWidth);
+    	points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
     	if (!points)
 	    return;
-    	widths = (int *)ALLOCATE_LOCAL(sizeof(int) * pGC->lineWidth);
+    	widths = (int *)xalloc(sizeof(int) * pGC->lineWidth);
     	if (!widths)
     	{
-	    DEALLOCATE_LOCAL(points);
+	    xfree(points);
 	    return;
     	}
     	oldPixel = pGC->fgPixel;
@@ -1086,8 +1086,8 @@ miLineArc (
     if (!spanData)
     {
     	(*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE);
-    	DEALLOCATE_LOCAL(widths);
-    	DEALLOCATE_LOCAL(points);
+    	xfree(widths);
+    	xfree(points);
     	if (pixel != oldPixel)
     	{
 	    DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index 9d4715a..947b85a 100644
--- a/mi/mizerarc.c
+++ b/mi/mizerarc.c
@@ -744,7 +744,7 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
     dospans = (pGC->fillStyle != FillSolid);
     if (dospans)
     {
-	widths = (int *)ALLOCATE_LOCAL(sizeof(int) * numPts);
+	widths = (int *)xalloc(sizeof(int) * numPts);
 	if (!widths)
 	    return;
 	maxw = 0;
@@ -761,12 +761,12 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
 		   (unsigned char *) pGC->dash, (int)pGC->numInDashList,
 		   &dinfo.dashOffsetInit);
     }
-    points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * numPts);
+    points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * numPts);
     if (!points)
     {
 	if (dospans)
 	{
-	    DEALLOCATE_LOCAL(widths);
+	    xfree(widths);
 	}
 	return;
     }
@@ -843,9 +843,9 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
 	    }
 	}
     }
-    DEALLOCATE_LOCAL(points);
+    xfree(points);
     if (dospans)
     {
-	DEALLOCATE_LOCAL(widths);
+	xfree(widths);
     }
 }
diff --git a/mi/mizerline.c b/mi/mizerline.c
index 073f1b2..6604a09 100644
--- a/mi/mizerline.c
+++ b/mi/mizerline.c
@@ -155,8 +155,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
     width = xright - xleft + 1;
     height = ybottom - ytop + 1;
     list_len = (height >= width) ? height : width;
-    pspanInit = (DDXPointPtr)ALLOCATE_LOCAL(list_len * sizeof(DDXPointRec));
-    pwidthInit = (int *)ALLOCATE_LOCAL(list_len * sizeof(int));
+    pspanInit = (DDXPointPtr)xalloc(list_len * sizeof(DDXPointRec));
+    pwidthInit = (int *)xalloc(list_len * sizeof(int));
     if (!pspanInit || !pwidthInit)
 	return;
 
@@ -359,8 +359,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
 	(*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit,
 			       pwidthInit, FALSE);
 
-    DEALLOCATE_LOCAL(pwidthInit);
-    DEALLOCATE_LOCAL(pspanInit);
+    xfree(pwidthInit);
+    xfree(pspanInit);
 }
 
 _X_EXPORT void
commit 3633ae6efb57c5405c26e8ae132b9371e5f920de
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:04:27 2007 +0000

    Damage: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 58f37e9..17425ae 100755
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -1399,7 +1399,7 @@ damageText (DrawablePtr	    pDrawable,
 
     imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
 
-    charinfo = (CharInfoPtr *) ALLOCATE_LOCAL(count * sizeof(CharInfoPtr));
+    charinfo = (CharInfoPtr *) xalloc(count * sizeof(CharInfoPtr));
     if (!charinfo)
 	return x;
 
@@ -1421,7 +1421,7 @@ damageText (DrawablePtr	    pDrawable,
 	    (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
 				      FONTGLYPHS(pGC->font));
     }
-    DEALLOCATE_LOCAL(charinfo);
+    xfree(charinfo);
     return x + w;
 }
 
commit 2761c103311a1160bc483fd0367d654733df8598
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:03:26 2007 +0000

    OS: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/os/oscolor.c b/os/oscolor.c
index e175692..6f3a7fa 100644
--- a/os/oscolor.c
+++ b/os/oscolor.c
@@ -180,7 +180,7 @@ lookup(char *name, int len, Bool create)
   dbEntryPtr   entry, *prev = NULL;
   char         *str = name;
 
-  if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL;
+  if (!(name = (char*)xalloc(len +1))) return NULL;
   CopyISOLatin1Lowered((unsigned char *)name, (unsigned char *)str, len);
   name[len] = '\0';
 
@@ -206,7 +206,7 @@ lookup(char *name, int len, Bool create)
       strcpy( entry->name, name );
     }
 
-  DEALLOCATE_LOCAL(name);
+  xfree(name);
 
   return entry;
 }
@@ -225,13 +225,13 @@ OsInitColors(void)
 
   if (!was_here)
     {
-      path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5);
+      path = (char*)xalloc(strlen(rgbPath) +5);
       strcpy(path, rgbPath);
       strcat(path, ".txt");
       if (!(rgb = fopen(path, "r")))
         {
 	   ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
-	   DEALLOCATE_LOCAL(path);
+	   xfree(path);
 	   return FALSE;
 	}
 
@@ -259,7 +259,7 @@ OsInitColors(void)
 	}
       
       fclose(rgb);
-      DEALLOCATE_LOCAL(path);
+      xfree(path);
 
       was_here = TRUE;
     }
commit 2d738efb959912d8a89864e41190e0064fa77906
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:01:11 2007 +0000

    RandR: Remove usage of alloca
    
    Replace with heap allocations.

diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 5ac073f..4617064 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -386,7 +386,7 @@ ProcRRListOutputProperties (ClientPtr client)
     for (prop = output->properties; prop; prop = prop->next)
 	numProps++;
     if (numProps)
-        if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom))))
+        if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
             return(BadAlloc);
 
     rep.type = X_Reply;
@@ -408,7 +408,7 @@ ProcRRListOutputProperties (ClientPtr client)
     {
         client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
         WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
-        DEALLOCATE_LOCAL(pAtoms);
+        xfree(pAtoms);
     }
     return(client->noClientException);
 }
commit 3c1d2fdeff0ed61d86fa7d35cb0a61535d9b2816
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 14:00:40 2007 +0000

    Record: Remove usage of alloca
    
    Replace with xalloc/xfree.

diff --git a/record/record.c b/record/record.c
index 0ed8f84..f580f64 100644
--- a/record/record.c
+++ b/record/record.c
@@ -1724,7 +1724,7 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegist
      * range for extension replies.
      */
     maxSets = PREDEFSETS + 2 * stuff->nRanges;
-    si = (SetInfoPtr)ALLOCATE_LOCAL(sizeof(SetInfoRec) * maxSets);
+    si = (SetInfoPtr)xalloc(sizeof(SetInfoRec) * maxSets);
     if (!si)
     {
 	err = BadAlloc;
@@ -1931,7 +1931,7 @@ bailout:
 	for (i = 0; i < maxSets; i++)
 	    if (si[i].intervals)
 		xfree(si[i].intervals);
-	DEALLOCATE_LOCAL(si);
+	xfree(si);
     }
     if (pCanonClients && pCanonClients != (XID *)&stuff[1])
 	xfree(pCanonClients);
@@ -2298,7 +2298,7 @@ ProcRecordGetContext(ClientPtr client)
 
     /* allocate and initialize space for record range info */
 
-    pRangeInfo = (GetContextRangeInfoPtr)ALLOCATE_LOCAL(
+    pRangeInfo = (GetContextRangeInfoPtr)xalloc(
 				nRCAPs * sizeof(GetContextRangeInfoRec));
     if (!pRangeInfo && nRCAPs > 0)
 	return BadAlloc;
@@ -2415,7 +2415,7 @@ bailout:
     {
 	if (pRangeInfo[i].pRanges) xfree(pRangeInfo[i].pRanges);
     }
-    DEALLOCATE_LOCAL(pRangeInfo);
+    xfree(pRangeInfo);
     return err;
 } /* ProcRecordGetContext */
 
@@ -2815,14 +2815,14 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
 
     if (pci->client->swapped)
     {
-	char *pConnSetup = (char *)ALLOCATE_LOCAL(prefixsize + restsize);
+	char *pConnSetup = (char *)xalloc(prefixsize + restsize);
 	if (!pConnSetup)
 	    return;
 	SwapConnSetupPrefix(pci->prefix, pConnSetup);
 	SwapConnSetupInfo(pci->setup, pConnSetup + prefixsize);
 	RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
 			       (pointer)pConnSetup, prefixsize + restsize, 0);
-	DEALLOCATE_LOCAL(pConnSetup);
+	xfree(pConnSetup);
     }
     else
     {
diff --git a/record/set.c b/record/set.c
index 07a3a63..453452e 100644
--- a/record/set.c
+++ b/record/set.c
@@ -302,7 +302,7 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
 
     if (nIntervals > 0)
     {
-	stackIntervals = (RecordSetInterval *)ALLOCATE_LOCAL(
+	stackIntervals = (RecordSetInterval *)xalloc(
 				sizeof(RecordSetInterval) * nIntervals);
 	if (!stackIntervals) return NULL;
 
@@ -360,7 +360,7 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
     memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
     prls->nIntervals = nIntervals;
 bailout:
-    if (stackIntervals) DEALLOCATE_LOCAL(stackIntervals);
+    if (stackIntervals) xfree(stackIntervals);
     return (RecordSetPtr)prls;
 }
 
commit e0491f470e130147191388168e878e3a7348afaf
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 13:59:51 2007 +0000

    Render: Remove usage of alloca
    
    Replace it with heap-based allocations.

diff --git a/render/mitri.c b/render/mitri.c
index 374e2fd..a92c19b 100644
--- a/render/mitri.c
+++ b/render/mitri.c
@@ -144,7 +144,7 @@ miTriStrip (CARD8	    op,
     if (npoint < 3)
 	return;
     ntri = npoint - 2;
-    tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle));
+    tris = xalloc (ntri * sizeof (xTriangle));
     if (!tris)
 	return;
     for (tri = tris; npoint >= 3; npoint--, points++, tri++)
@@ -154,7 +154,7 @@ miTriStrip (CARD8	    op,
 	tri->p3 = points[2];
     }
     (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
-    DEALLOCATE_LOCAL (tris);
+    xfree (tris);
 }
 
 void
@@ -176,7 +176,7 @@ miTriFan (CARD8		op,
     if (npoint < 3)
 	return;
     ntri = npoint - 2;
-    tris = ALLOCATE_LOCAL (ntri * sizeof (xTriangle));
+    tris = xalloc (ntri * sizeof (xTriangle));
     if (!tris)
 	return;
     first = points++;
@@ -187,5 +187,5 @@ miTriFan (CARD8		op,
 	tri->p3 = points[1];
     }
     (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
-    DEALLOCATE_LOCAL (tris);
+    xfree (tris);
 }
diff --git a/render/render.c b/render/render.c
index b070753..3a9d24a 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1409,7 +1409,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 	glyphsBase = glyphsLocal;
     else
     {
-	glyphsBase = (GlyphPtr *) ALLOCATE_LOCAL (nglyph * sizeof (GlyphPtr));
+	glyphsBase = (GlyphPtr *) xalloc (nglyph * sizeof (GlyphPtr));
 	if (!glyphsBase)
 	    return BadAlloc;
     }
@@ -1417,7 +1417,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 	listsBase = listsLocal;
     else
     {
-	listsBase = (GlyphListPtr) ALLOCATE_LOCAL (nlist * sizeof (GlyphListRec));
+	listsBase = (GlyphListPtr) xalloc (nlist * sizeof (GlyphListRec));
 	if (!listsBase)
 	    return BadAlloc;
     }
@@ -1442,9 +1442,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 		{
 		    client->errorValue = gs;
 		    if (glyphsBase != glyphsLocal)
-			DEALLOCATE_LOCAL (glyphsBase);
+			xfree (glyphsBase);
 		    if (listsBase != listsLocal)
-			DEALLOCATE_LOCAL (listsBase);
+			xfree (listsBase);
 		    return RenderErrBase + BadGlyphSet;
 		}
 	    }
@@ -1498,9 +1498,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 		     glyphsBase);
 
     if (glyphsBase != glyphsLocal)
-	DEALLOCATE_LOCAL (glyphsBase);
+	xfree (glyphsBase);
     if (listsBase != listsLocal)
-	DEALLOCATE_LOCAL (listsBase);
+	xfree (listsBase);
     
     return client->noClientException;
 }
@@ -2965,7 +2965,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
 			RenderErrBase + BadPicture);
     extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len)))
+	(extra = (char *) xalloc (extra_len)))
     {
 	memcpy (extra, stuff + 1, extra_len);
 	FOR_NSCREENS_FORWARD(j) {
@@ -2991,7 +2991,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
 	    result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
 	    if(result != Success) break;
 	}
-	DEALLOCATE_LOCAL(extra);
+	xfree(extra);
     }
 
     return result;
@@ -3016,7 +3016,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
 
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
+	(extra = (char *) xalloc (extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3053,7 +3053,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        DEALLOCATE_LOCAL(extra);
+        xfree(extra);
     }
 
     return result;
@@ -3078,7 +3078,7 @@ PanoramiXRenderTriangles(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
 
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
+	(extra = (char *) xalloc (extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3111,7 +3111,7 @@ PanoramiXRenderTriangles(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        DEALLOCATE_LOCAL(extra);
+        xfree(extra);
     }
 
     return result;
@@ -3136,7 +3136,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
 
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
+	(extra = (char *) xalloc (extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3165,7 +3165,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        DEALLOCATE_LOCAL(extra);
+        xfree(extra);
     }
 
     return result;
@@ -3190,7 +3190,7 @@ PanoramiXRenderTriFan(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
 
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
+	(extra = (char *) xalloc (extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3219,7 +3219,7 @@ PanoramiXRenderTriFan(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        DEALLOCATE_LOCAL(extra);
+        xfree(extra);
     }
 
     return result;
@@ -3244,7 +3244,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq);
 
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
+	(extra = (char *) xalloc (extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3265,7 +3265,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        DEALLOCATE_LOCAL(extra);
+        xfree(extra);
     }
 
     return result;
@@ -3288,7 +3288,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq);
 
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len))) {
+	(extra = (char *) xalloc (extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3309,7 +3309,7 @@ PanoramiXRenderColorTriangles(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        DEALLOCATE_LOCAL(extra);
+        xfree(extra);
     }
 
     return result;
@@ -3332,7 +3332,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
 			RenderErrBase + BadPicture);
     extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
     if (extra_len &&
-	(extra = (char *) ALLOCATE_LOCAL (extra_len)))
+	(extra = (char *) xalloc (extra_len)))
     {
 	memcpy (extra, stuff + 1, extra_len);
 	x_off = stuff->xOff;
@@ -3349,7 +3349,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
 	    result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
 	    if(result != Success) break;
 	}
-	DEALLOCATE_LOCAL(extra);
+	xfree(extra);
     }
 
     return result;
commit 59774af86b851c7fb8989cef6c013522549000b8
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Nov 5 13:59:15 2007 +0000

    XKB: Remove usage of alloca
    
    alloca has no way to return failure, and instead can possibly arbitrarily
    overflow the stack.  Let's avoid that one.

diff --git a/xkb/xkb.c b/xkb/xkb.c
index cf42430..2b8b528 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -1312,7 +1312,7 @@ unsigned	i,len;
 char		*desc,*start;
 
     len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply));
-    start= desc= (char *)ALLOCATE_LOCAL(len);
+    start= desc= (char *)xalloc(len);
     if (!start)
 	return BadAlloc;
     if ( rep->nTypes>0 )
@@ -1352,7 +1352,7 @@ char		*desc,*start;
     }
     WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep);
     WriteToClient(client, len, start);
-    DEALLOCATE_LOCAL((char *)start);
+    xfree((char *)start);
     return client->noClientException;
 }
 
@@ -2499,7 +2499,7 @@ int		size;
 
     size= rep->length*4;
     if (size>0) {
-	data = (char *)ALLOCATE_LOCAL(size);
+	data = (char *)xalloc(size);
 	if (data) {
 	    register unsigned i,bit;
 	    xkbModsWireDesc *	grp;
@@ -2550,7 +2550,7 @@ int		size;
     WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep);
     if (data) {
 	WriteToClient(client, size, data);
-	DEALLOCATE_LOCAL((char *)data);
+	xfree((char *)data);
     }
     return client->noClientException;
 }
@@ -2801,7 +2801,7 @@ register unsigned	bit;
     length = rep->length*4;
     if (length>0) {
 	CARD8 *to;
-	to= map= (CARD8 *)ALLOCATE_LOCAL(length);
+	to= map= (CARD8 *)xalloc(length);
 	if (map) {
 	    xkbIndicatorMapWireDesc  *wire = (xkbIndicatorMapWireDesc *)to;
 	    for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
@@ -2840,7 +2840,7 @@ register unsigned	bit;
     WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep);
     if (map) {
 	WriteToClient(client, length, (char *)map);
-	DEALLOCATE_LOCAL((char *)map);
+	xfree((char *)map);
     }
     return client->noClientException;
 }
@@ -3292,7 +3292,7 @@ register int            n;
 	swapl(&rep->indicators,n);
     }
 
-    start = desc = (char *)ALLOCATE_LOCAL(length);
+    start = desc = (char *)xalloc(length);
     if ( !start )
 	return BadAlloc;
     if (xkb->names) {
@@ -3416,7 +3416,7 @@ register int            n;
     }
     WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep);
     WriteToClient(client, length, start);
-    DEALLOCATE_LOCAL((char *)start);
+    xfree((char *)start);
     return client->noClientException;
 }
 
@@ -4314,7 +4314,7 @@ XkbSendGeometry(	ClientPtr		client,
 
     if (geom!=NULL) {
 	len= rep->length*4;
-	start= desc= (char *)ALLOCATE_LOCAL(len);
+	start= desc= (char *)xalloc(len);
 	if (!start)
 	    return BadAlloc;
 	desc=  XkbWriteCountedString(desc,geom->label_font,client->swapped);
@@ -4358,7 +4358,7 @@ XkbSendGeometry(	ClientPtr		client,
     if (len>0)
 	WriteToClient(client, len, start);
     if (start!=NULL)
-	DEALLOCATE_LOCAL((char *)start);
+	xfree((char *)start);
     if (freeGeom)
 	XkbFreeGeometry(geom,XkbGeomAllMask,True);
     return client->noClientException;
@@ -5758,12 +5758,12 @@ char *			str;
     }
     WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);
 
-    str= (char*) ALLOCATE_LOCAL(nameLen);
+    str= (char*) xalloc(nameLen);
     if (!str) 
 	return BadAlloc;
     XkbWriteCountedString(str,dev->name,client->swapped);
     WriteToClient(client,nameLen,str);
-    DEALLOCATE_LOCAL(str);
+    xfree(str);
     length-= nameLen;
 
     if (rep.nBtnsRtrn>0) {
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index c0867ad..6301a32 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -182,7 +182,7 @@ char *			pval;
 	ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
 	return True;
     }
-    pval= (char*) ALLOCATE_LOCAL(len);
+    pval= (char*) xalloc(len);
     if (!pval) {
 	ErrorF("Allocation error: %s proprerty not created\n",
 						_XKB_RF_NAMES_PROP_ATOM);
@@ -223,7 +223,7 @@ char *			pval;
     }
     ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace,
 							len,pval,True);
-    DEALLOCATE_LOCAL(pval);
+    xfree(pval);
     return True;
 }
 


More information about the xorg-commit mailing list