cfb: Remove usage of alloca

Replace with xalloc/xfree.
This commit is contained in:
Daniel Stone 2007-11-05 14:14:04 +00:00
parent 914922fd61
commit ca75261bee
9 changed files with 69 additions and 69 deletions

View File

@ -296,7 +296,7 @@ cfbBitBlt (
numRects = REGION_NUM_RECTS(&rgnDst); numRects = REGION_NUM_RECTS(&rgnDst);
if (numRects && width && height) if (numRects && width && height)
{ {
if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects * if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
sizeof(DDXPointRec)))) sizeof(DDXPointRec))))
{ {
REGION_UNINIT(pGC->pScreen, &rgnDst); REGION_UNINIT(pGC->pScreen, &rgnDst);
@ -313,7 +313,7 @@ cfbBitBlt (
} }
(*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask); (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask);
DEALLOCATE_LOCAL(pptSrc); xfree(pptSrc);
} }
prgnExposed = NULL; prgnExposed = NULL;
@ -559,7 +559,7 @@ cfbCopyPlaneReduce (
numRects = REGION_NUM_RECTS(&rgnDst); numRects = REGION_NUM_RECTS(&rgnDst);
if (numRects && width && height) if (numRects && width && height)
{ {
if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects * if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
sizeof(DDXPointRec)))) sizeof(DDXPointRec))))
{ {
REGION_UNINIT(pGC->pScreen, &rgnDst); REGION_UNINIT(pGC->pScreen, &rgnDst);
@ -576,7 +576,7 @@ cfbCopyPlaneReduce (
} }
(*doCopyPlane) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane); (*doCopyPlane) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane);
DEALLOCATE_LOCAL(pptSrc); xfree(pptSrc);
} }
prgnExposed = NULL; prgnExposed = NULL;

View File

@ -207,13 +207,13 @@ MROP_NAME(cfbDoBitblt)(
if (nbox > 1) if (nbox > 1)
{ {
/* keep ordering in each band, reverse order of bands */ /* keep ordering in each band, reverse order of bands */
pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
if(!pboxNew1) if(!pboxNew1)
return; return;
pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
if(!pptNew1) if(!pptNew1)
{ {
DEALLOCATE_LOCAL(pboxNew1); xfree(pboxNew1);
return; return;
} }
pboxBase = pboxNext = pbox+nbox-1; pboxBase = pboxNext = pbox+nbox-1;
@ -251,16 +251,16 @@ MROP_NAME(cfbDoBitblt)(
if (nbox > 1) if (nbox > 1)
{ {
/* reverse order of rects in each band */ /* reverse order of rects in each band */
pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
if(!pboxNew2 || !pptNew2) if(!pboxNew2 || !pptNew2)
{ {
if (pptNew2) DEALLOCATE_LOCAL(pptNew2); if (pptNew2) xfree(pptNew2);
if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2); if (pboxNew2) xfree(pboxNew2);
if (pboxNew1) if (pboxNew1)
{ {
DEALLOCATE_LOCAL(pptNew1); xfree(pptNew1);
DEALLOCATE_LOCAL(pboxNew1); xfree(pboxNew1);
} }
return; return;
} }
@ -922,12 +922,12 @@ bits1 = *--psrc; --pdst; \
} }
if (pboxNew2) if (pboxNew2)
{ {
DEALLOCATE_LOCAL(pptNew2); xfree(pptNew2);
DEALLOCATE_LOCAL(pboxNew2); xfree(pboxNew2);
} }
if (pboxNew1) if (pboxNew1)
{ {
DEALLOCATE_LOCAL(pptNew1); xfree(pptNew1);
DEALLOCATE_LOCAL(pboxNew1); xfree(pboxNew1);
} }
} }

View File

@ -196,7 +196,7 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
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;
} }
@ -301,5 +301,5 @@ cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
(*BoxFill) (pDrawable, pGC, (*BoxFill) (pDrawable, pGC,
pboxClipped-pboxClippedBase, pboxClippedBase); pboxClipped-pboxClippedBase, pboxClippedBase);
if (pboxClippedBase != stackRects) if (pboxClippedBase != stackRects)
DEALLOCATE_LOCAL(pboxClippedBase); xfree(pboxClippedBase);
} }

View File

@ -186,12 +186,12 @@ int fSorted;
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
if ( n == 0 ) if ( n == 0 )
return; return;
pwidth = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pwidth = (int *)xalloc(n * sizeof(int));
ppt = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); ppt = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
if(!ppt || !pwidth) if(!ppt || !pwidth)
{ {
if (ppt) DEALLOCATE_LOCAL(ppt); if (ppt) xfree(ppt);
if (pwidth) DEALLOCATE_LOCAL(pwidth); if (pwidth) xfree(pwidth);
return; return;
} }
n = miClipSpans( cfbGetCompositeClip(pGC), n = miClipSpans( cfbGetCompositeClip(pGC),
@ -203,8 +203,8 @@ int fSorted;
(*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask); (*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
DEALLOCATE_LOCAL(ppt); xfree(ppt);
DEALLOCATE_LOCAL(pwidth); xfree(pwidth);
} }
#if PSZ == 8 #if PSZ == 8
@ -251,12 +251,12 @@ int fSorted;
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
if ( n == 0 ) if ( n == 0 )
return; return;
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pwidthFree = (int *)xalloc(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(n * 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;
} }
@ -392,8 +392,8 @@ int fSorted;
} }
} }
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }
#else /* PSZ != 8 */ #else /* PSZ != 8 */
@ -434,12 +434,12 @@ int fSorted;
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
if ( n == 0 ) if ( n == 0 )
return; return;
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pwidthFree = (int *)xalloc(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(n * 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;
} }
pwidth = pwidthFree; pwidth = pwidthFree;
@ -599,8 +599,8 @@ int fSorted;
ppt++; ppt++;
pwidth++; pwidth++;
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }
#endif /* PSZ == 8 */ #endif /* PSZ == 8 */
@ -648,12 +648,12 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
n = nInit * miFindMaxBand(pGC->pCompositeClip); n = nInit * miFindMaxBand(pGC->pCompositeClip);
if ( n == 0 ) if ( n == 0 )
return; return;
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pwidthFree = (int *)xalloc(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(n * 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;
} }
pwidth = pwidthFree; pwidth = pwidthFree;
@ -816,8 +816,8 @@ cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
} }
} }
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }
void void
@ -862,12 +862,12 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
n = nInit * miFindMaxBand(pGC->pCompositeClip); n = nInit * miFindMaxBand(pGC->pCompositeClip);
if ( n == 0 ) if ( n == 0 )
return; return;
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pwidthFree = (int *)xalloc(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(n * 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;
} }
pwidth = pwidthFree; pwidth = pwidthFree;
@ -997,8 +997,8 @@ cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
} }
} }
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }
#endif /* PSZ == 8 */ #endif /* PSZ == 8 */

View File

@ -355,7 +355,7 @@ cfbPolyGlyphBlt8Clipped(
} }
if (!numRects) if (!numRects)
return; return;
clips = (CARD32 *)ALLOCATE_LOCAL ((maxAscent + maxDescent) * clips = (CARD32 *)xalloc ((maxAscent + maxDescent) *
sizeof (CARD32)); sizeof (CARD32));
while (nglyph--) while (nglyph--)
{ {
@ -471,7 +471,7 @@ cfbPolyGlyphBlt8Clipped(
} }
} }
} }
DEALLOCATE_LOCAL (clips); xfree (clips);
} }
#endif /* FOUR_BIT_CODE */ #endif /* FOUR_BIT_CODE */

View File

@ -270,7 +270,7 @@ cfbXRotatePixmap(pPix, rw)
int size, tsize; int size, tsize;
tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth); 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) if (!pwTmp)
return; return;
/* divide pw (the pixmap) in two vertically at (w - rot) and swap */ /* divide pw (the pixmap) in two vertically at (w - rot) and swap */
@ -288,7 +288,7 @@ cfbXRotatePixmap(pPix, rw)
0, 0, rot, 0, 0, 0, rot, 0,
(int)pPix->drawable.width - rot, (int)pPix->drawable.height, (int)pPix->drawable.width - rot, (int)pPix->drawable.height,
tsize, size); tsize, size);
DEALLOCATE_LOCAL(pwTmp); xfree(pwTmp);
#endif #endif
} }
} }
@ -328,13 +328,13 @@ cfbYRotatePixmap(pPix, rh)
nbyDown = rot * pPix->devKind; nbyDown = rot * pPix->devKind;
nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown; nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown;
if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp))) if(!(ptmp = (char *)xalloc(nbyUp)))
return; return;
memmove(ptmp, pbase, nbyUp); /* save the low rows */ memmove(ptmp, pbase, nbyUp); /* save the low rows */
memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */ memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */
memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rot */ memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rot */
DEALLOCATE_LOCAL(ptmp); xfree(ptmp);
} }
void void

View File

@ -811,12 +811,12 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
devPriv = cfbGetGCPrivate(pGC); devPriv = cfbGetGCPrivate(pGC);
RROP_FETCH_GCPRIV(devPriv) RROP_FETCH_GCPRIV(devPriv)
n = nInit * miFindMaxBand(pGC->pCompositeClip); n = nInit * miFindMaxBand(pGC->pCompositeClip);
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pwidthFree = (int *)xalloc(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(n * 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;
} }
pwidth = pwidthFree; pwidth = pwidthFree;
@ -1359,7 +1359,7 @@ RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
} }
#endif #endif
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
RROP_UNDECLARE RROP_UNDECLARE
} }

View File

@ -367,12 +367,12 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
#endif #endif
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pwidthFree = (int *)xalloc(n * sizeof(int));
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); pptFree = (DDXPointRec *)xalloc(n * 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;
} }
pwidth = pwidthFree; pwidth = pwidthFree;
@ -512,6 +512,6 @@ MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
} }
} }
} }
DEALLOCATE_LOCAL(pptFree); xfree(pptFree);
DEALLOCATE_LOCAL(pwidthFree); xfree(pwidthFree);
} }

View File

@ -133,7 +133,7 @@ cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
pbox = REGION_RECTS(&rgnDst); pbox = REGION_RECTS(&rgnDst);
nbox = REGION_NUM_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); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
return; return;
@ -148,7 +148,7 @@ cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
GXcopy, &rgnDst, pptSrc, ~0L); GXcopy, &rgnDst, pptSrc, ~0L);
DEALLOCATE_LOCAL(pptSrc); xfree(pptSrc);
REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
} }