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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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