Commit ca75261b authored by Daniel Stone's avatar Daniel Stone
Browse files

cfb: Remove usage of alloca

Replace with xalloc/xfree.
parent 914922fd
......@@ -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;
......
......@@ -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);
}
}
......@@ -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);
}
......@@ -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 */
......@@ -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 */
......@@ -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
......
......@@ -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
}
......@@ -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);
}
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment