summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2007-11-05 14:10:55 +0000
committerDaniel Stone <daniel@fooishbar.org>2007-11-05 14:34:42 +0000
commitcaf545063457591f88e1f7bcd25dbd0342f44343 (patch)
treea2c87d098235fe7bdcc6c59dfb303b7e4b3f650a
parentd57060f16714f5667722001bd1a4500059dd59e1 (diff)
KDrive: Remove usage of alloca
Replace with heap allocations.
-rw-r--r--hw/kdrive/epson/epson13806.c4
-rw-r--r--hw/kdrive/fbdev/fbdev.c4
-rw-r--r--hw/kdrive/igs/igsdraw.c12
-rw-r--r--hw/kdrive/nvidia/nvidiavideo.c4
-rw-r--r--hw/kdrive/savage/s3draw.c32
-rw-r--r--hw/kdrive/sis530/sisdraw.c16
-rw-r--r--hw/kdrive/smi/smivideo.c4
-rw-r--r--hw/kdrive/src/kxv.c4
8 files changed, 40 insertions, 40 deletions
diff --git a/hw/kdrive/epson/epson13806.c b/hw/kdrive/epson/epson13806.c
index cb00890a7..6cf8c9ad9 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 6e8b3ff5e..177be0bdc 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 e1ff2befc..677436be5 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 ad7147dd1..2ab41edfd 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 7b6543b4b..e2766df0f 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 f2b39a477..595544348 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 46593a0ee..f372498c0 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 b8fbd731b..046ab27b3 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:
;
}