KDrive: Remove usage of alloca

Replace with heap allocations.
This commit is contained in:
Daniel Stone 2007-11-05 14:10:55 +00:00
parent d57060f167
commit caf5450634
8 changed files with 40 additions and 40 deletions

View File

@ -331,7 +331,7 @@ epsonCreateColormap (ColormapPtr pmap)
case FB_VISUAL_STATIC_PSEUDOCOLOR: case FB_VISUAL_STATIC_PSEUDOCOLOR:
pVisual = pmap->pVisual; pVisual = pmap->pVisual;
nent = pVisual->ColormapEntries; nent = pVisual->ColormapEntries;
pdefs = ALLOCATE_LOCAL (nent * sizeof (xColorItem)); pdefs = xalloc (nent * sizeof (xColorItem));
if (!pdefs) if (!pdefs)
return FALSE; return FALSE;
for (i = 0; i < nent; i++) 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.green = pdefs[i].green;
pmap->red[i].co.local.blue = pdefs[i].blue; pmap->red[i].co.local.blue = pdefs[i].blue;
} }
DEALLOCATE_LOCAL (pdefs); xfree (pdefs);
return TRUE; return TRUE;
default: default:

View File

@ -598,7 +598,7 @@ fbdevCreateColormap (ColormapPtr pmap)
case FB_VISUAL_STATIC_PSEUDOCOLOR: case FB_VISUAL_STATIC_PSEUDOCOLOR:
pVisual = pmap->pVisual; pVisual = pmap->pVisual;
nent = pVisual->ColormapEntries; nent = pVisual->ColormapEntries;
pdefs = ALLOCATE_LOCAL (nent * sizeof (xColorItem)); pdefs = xalloc (nent * sizeof (xColorItem));
if (!pdefs) if (!pdefs)
return FALSE; return FALSE;
for (i = 0; i < nent; i++) 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.green = pdefs[i].green;
pmap->red[i].co.local.blue = pdefs[i].blue; pmap->red[i].co.local.blue = pdefs[i].blue;
} }
DEALLOCATE_LOCAL (pdefs); xfree (pdefs);
return TRUE; return TRUE;
default: default:
return fbInitializeColormap (pmap); return fbInitializeColormap (pmap);

View File

@ -553,12 +553,12 @@ igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
return; return;
} }
nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC)); nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC));
pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); pwidthFree = (int *)xalloc(nTmp * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree) if(!pptFree || !pwidthFree)
{ {
if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pptFree) xfree(pptFree);
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); if (pwidthFree) xfree(pwidthFree);
return; return;
} }
n = miClipSpans(fbGetCompositeClip(pGC), n = miClipSpans(fbGetCompositeClip(pGC),
@ -607,8 +607,8 @@ igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
_igsPatRect(cop,x,y,width,1,cmd); _igsPatRect(cop,x,y,width,1,cmd);
} }
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
KdMarkSync (pDrawable->pScreen); KdMarkSync (pDrawable->pScreen);
} }

View File

@ -343,7 +343,7 @@ nvidiaPaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
BoxPtr pBox = REGION_RECTS (pRgn); BoxPtr pBox = REGION_RECTS (pRgn);
int nBox = REGION_NUM_RECTS (pRgn); int nBox = REGION_NUM_RECTS (pRgn);
rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle)); rects = xalloc (nBox * sizeof (xRectangle));
if (!rects) if (!rects)
goto bail0; goto bail0;
r = rects; r = rects;
@ -372,7 +372,7 @@ nvidiaPaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
FreeScratchGC (pGC); FreeScratchGC (pGC);
bail1: bail1:
DEALLOCATE_LOCAL (rects); xfree (rects);
bail0: bail0:
; ;
} }

View File

@ -519,7 +519,7 @@ s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
if (numRects > NUM_STACK_RECTS) if (numRects > NUM_STACK_RECTS)
{ {
pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
if (!pboxClippedBase) if (!pboxClippedBase)
return; return;
} }
@ -637,7 +637,7 @@ s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
pboxClippedBase); pboxClippedBase);
} }
if (pboxClippedBase != stackRects) if (pboxClippedBase != stackRects)
DEALLOCATE_LOCAL(pboxClippedBase); xfree(pboxClippedBase);
} }
void void
@ -771,12 +771,12 @@ s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
else else
{ {
nTmp = n * miFindMaxBand(pClip); nTmp = n * miFindMaxBand(pClip);
pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); pwidthFree = (int *)xalloc(nTmp * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree) if(!pptFree || !pwidthFree)
{ {
if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pptFree) xfree(pptFree);
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); if (pwidthFree) xfree(pwidthFree);
return; return;
} }
n = miClipSpans(fbGetCompositeClip(pGC), n = miClipSpans(fbGetCompositeClip(pGC),
@ -820,8 +820,8 @@ s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
{ {
_s3FillSpanLargeStipple (pDrawable, pGC, n, ppt, pwidth); _s3FillSpanLargeStipple (pDrawable, pGC, n, ppt, pwidth);
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }
MarkSyncS3 (pDrawable->pScreen); MarkSyncS3 (pDrawable->pScreen);
} }
@ -2449,12 +2449,12 @@ s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
else else
{ {
nTmp = n * miFindMaxBand(pClip); nTmp = n * miFindMaxBand(pClip);
pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); pwidthFree = (int *)xalloc(nTmp * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree) if(!pptFree || !pwidthFree)
{ {
if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pptFree) xfree(pptFree);
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); if (pwidthFree) xfree(pwidthFree);
return; return;
} }
n = miClipSpans(fbGetCompositeClip(pGC), n = miClipSpans(fbGetCompositeClip(pGC),
@ -2474,8 +2474,8 @@ s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
_s3SolidRect(s3,x*3,y,width*3,1); _s3SolidRect(s3,x*3,y,width*3,1);
} }
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }
MarkSyncS3 (pDrawable->pScreen); MarkSyncS3 (pDrawable->pScreen);
} }
@ -2610,7 +2610,7 @@ s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
if (numRects > NUM_STACK_RECTS) if (numRects > NUM_STACK_RECTS)
{ {
pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
if (!pboxClippedBase) if (!pboxClippedBase)
return; return;
} }
@ -2718,7 +2718,7 @@ s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
pGC->fgPixel, pGC->alu, pGC->planemask); pGC->fgPixel, pGC->alu, pGC->planemask);
} }
if (pboxClippedBase != stackRects) if (pboxClippedBase != stackRects)
DEALLOCATE_LOCAL(pboxClippedBase); xfree(pboxClippedBase);
} }
void void

View File

@ -1234,12 +1234,12 @@ sisFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
return; return;
} }
nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC)); nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC));
pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); pwidthFree = (int *)xalloc(nTmp * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec));
if(!pptFree || !pwidthFree) if(!pptFree || !pwidthFree)
{ {
if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pptFree) xfree(pptFree);
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); if (pwidthFree) xfree(pwidthFree);
return; return;
} }
n = miClipSpans(fbGetCompositeClip(pGC), n = miClipSpans(fbGetCompositeClip(pGC),
@ -1273,8 +1273,8 @@ sisFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n,
} }
} }
KdMarkSync (pDrawable->pScreen); KdMarkSync (pDrawable->pScreen);
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }
#define NUM_STACK_RECTS 1024 #define NUM_STACK_RECTS 1024
@ -1323,7 +1323,7 @@ sisPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
if (numRects > NUM_STACK_RECTS) if (numRects > NUM_STACK_RECTS)
{ {
pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
if (!pboxClippedBase) if (!pboxClippedBase)
return; return;
} }
@ -1448,7 +1448,7 @@ sisPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
} }
} }
if (pboxClippedBase != stackRects) if (pboxClippedBase != stackRects)
DEALLOCATE_LOCAL(pboxClippedBase); xfree(pboxClippedBase);
} }
static const GCOps sisOps = { static const GCOps sisOps = {

View File

@ -342,7 +342,7 @@ mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
BoxPtr pBox = REGION_RECTS (pRgn); BoxPtr pBox = REGION_RECTS (pRgn);
int nBox = REGION_NUM_RECTS (pRgn); int nBox = REGION_NUM_RECTS (pRgn);
rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle)); rects = xalloc (nBox * sizeof (xRectangle));
if (!rects) if (!rects)
goto bail0; goto bail0;
r = rects; r = rects;
@ -371,7 +371,7 @@ mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg)
FreeScratchGC (pGC); FreeScratchGC (pGC);
bail1: bail1:
DEALLOCATE_LOCAL (rects); xfree (rects);
bail0: bail0:
; ;
} }

View File

@ -1927,7 +1927,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
BoxPtr pBox = REGION_RECTS (pRgn); BoxPtr pBox = REGION_RECTS (pRgn);
int nBox = REGION_NUM_RECTS (pRgn); int nBox = REGION_NUM_RECTS (pRgn);
rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle)); rects = xalloc (nBox * sizeof (xRectangle));
if (!rects) if (!rects)
goto bail0; goto bail0;
r = rects; r = rects;
@ -1956,7 +1956,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
FreeScratchGC (pGC); FreeScratchGC (pGC);
bail1: bail1:
DEALLOCATE_LOCAL (rects); xfree (rects);
bail0: bail0:
; ;
} }