diff options
author | Daniel Stone <daniel@fooishbar.org> | 2007-11-05 14:14:25 +0000 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2007-11-05 14:34:45 +0000 |
commit | 683ee1776d172035c465aa8fc84ccd53bb8ba7fd (patch) | |
tree | ab506d9ed2b8e43c35935c0ee3f17d74dddd89c7 /afb | |
parent | ca75261beedc3e00767b3812a81b7dac4437f4a1 (diff) |
afb: Remove usage of alloca
Replace with heap allocations.
Diffstat (limited to 'afb')
-rw-r--r-- | afb/afbbitblt.c | 4 | ||||
-rw-r--r-- | afb/afbblt.c | 26 | ||||
-rw-r--r-- | afb/afbfillrct.c | 4 | ||||
-rw-r--r-- | afb/afbfillsp.c | 84 | ||||
-rw-r--r-- | afb/afbimggblt.c | 4 | ||||
-rw-r--r-- | afb/afbpixmap.c | 4 | ||||
-rw-r--r-- | afb/afbplygblt.c | 4 | ||||
-rw-r--r-- | afb/afbwindow.c | 4 |
8 files changed, 67 insertions, 67 deletions
diff --git a/afb/afbbitblt.c b/afb/afbbitblt.c index 2e416e356..d8b2ccda5 100644 --- a/afb/afbbitblt.c +++ b/afb/afbbitblt.c @@ -279,7 +279,7 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, /* Do bit blitting */ 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); if (freeSrcClip) @@ -296,7 +296,7 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, (*doBitBlt)(pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, planemask); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); } prgnExposed = NULL; diff --git a/afb/afbblt.c b/afb/afbblt.c index 9eb4e4732..4e1a49e9d 100644 --- a/afb/afbblt.c +++ b/afb/afbblt.c @@ -132,12 +132,12 @@ MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) 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; @@ -169,16 +169,16 @@ MROP_NAME(afbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) 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); + xfree(pptNew2); if (pboxNew2) - DEALLOCATE_LOCAL(pboxNew2); + xfree(pboxNew2); if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); + xfree(pptNew1); + xfree(pboxNew1); } return; } @@ -553,11 +553,11 @@ bits1 = *--psrc; --pdst; \ pptSrc++; } if (pboxNew2) { - DEALLOCATE_LOCAL(pptNew2); - DEALLOCATE_LOCAL(pboxNew2); + xfree(pptNew2); + xfree(pboxNew2); } if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); + xfree(pptNew1); + xfree(pboxNew1); } } diff --git a/afb/afbfillrct.c b/afb/afbfillrct.c index 06fb37365..1600deab3 100644 --- a/afb/afbfillrct.c +++ b/afb/afbfillrct.c @@ -111,7 +111,7 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre 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; } @@ -287,5 +287,5 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre } } if (pboxClippedBase != stackRects) - DEALLOCATE_LOCAL(pboxClippedBase); + xfree(pboxClippedBase); } diff --git a/afb/afbfillsp.c b/afb/afbfillsp.c index 539c3457c..b00185922 100644 --- a/afb/afbfillsp.c +++ b/afb/afbfillsp.c @@ -109,11 +109,11 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) unsigned char *rrops; 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; @@ -183,8 +183,8 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) pwidth++; ppt++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } void @@ -219,11 +219,11 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) unsigned char *rrops; 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; @@ -297,8 +297,8 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) pwidth++; ppt++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } void @@ -333,11 +333,11 @@ afbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int d; 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; @@ -428,8 +428,8 @@ afbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) break; } } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } void @@ -465,11 +465,11 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int d; 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; @@ -587,8 +587,8 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) break; } } /* switch (rop) */ - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } /* Fill spans with tiles that aren't PPW bits wide */ @@ -626,11 +626,11 @@ afbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) register int d; 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; @@ -732,8 +732,8 @@ afbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt++; pwidth++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } /* Fill spans with stipples that aren't PPW bits wide */ @@ -772,11 +772,11 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int depthDst; 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; @@ -877,8 +877,8 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt++; pwidth++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } /* Fill spans with OpaqueStipples that aren't PPW bits wide */ @@ -918,11 +918,11 @@ afbUnnaturalOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) int depthDst; 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; @@ -1124,6 +1124,6 @@ afbUnnaturalOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt++; pwidth++; } - DEALLOCATE_LOCAL(pptFree); - DEALLOCATE_LOCAL(pwidthFree); + xfree(pptFree); + xfree(pwidthFree); } diff --git a/afb/afbimggblt.c b/afb/afbimggblt.c index de02aa46a..ca49ee3ba 100644 --- a/afb/afbimggblt.c +++ b/afb/afbimggblt.c @@ -298,7 +298,7 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) int getWidth; /* bits to get from glyph */ #endif - if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS)))) + if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS)))) return; pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst); @@ -462,7 +462,7 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) } /* depth */ } /* for each glyph */ } /* while nbox-- */ - DEALLOCATE_LOCAL(ppos); + xfree(ppos); break; } diff --git a/afb/afbpixmap.c b/afb/afbpixmap.c index b0ac80105..d15d86114 100644 --- a/afb/afbpixmap.c +++ b/afb/afbpixmap.c @@ -251,7 +251,7 @@ afbYRotatePixmap(pPix, rh) nbyDown = rh * pPix->devKind; nbyUp = (pPix->devKind * height) - nbyDown; - if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp))) + if(!(ptmp = (char *)xalloc(nbyUp))) return; for (d = 0; d < pPix->drawable.depth; d++) { @@ -261,7 +261,7 @@ afbYRotatePixmap(pPix, rh) memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */ memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rh */ } - DEALLOCATE_LOCAL(ptmp); + xfree(ptmp); } void diff --git a/afb/afbplygblt.c b/afb/afbplygblt.c index 289d50e1b..bcb08c7a6 100644 --- a/afb/afbplygblt.c +++ b/afb/afbplygblt.c @@ -278,7 +278,7 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) int getWidth; /* bits to get from glyph */ #endif - if(!(ppos = (afbTEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(afbTEXTPOS)))) + if(!(ppos = (afbTEXTPOS *)xalloc(nglyph * sizeof(afbTEXTPOS)))) return; pdstBase = afbScanlineNoBankSwitch(pdstBase, x, y, widthDst); @@ -453,7 +453,7 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) } /* depth */ } /* for each glyph */ } /* while nbox-- */ - DEALLOCATE_LOCAL(ppos); + xfree(ppos); break; } diff --git a/afb/afbwindow.c b/afb/afbwindow.c index 5c2f18aea..61641ee31 100644 --- a/afb/afbwindow.c +++ b/afb/afbwindow.c @@ -141,7 +141,7 @@ afbCopyWindow(pWin, ptOldOrg, prgnSrc) pbox = REGION_RECTS(prgnDst); nbox = REGION_NUM_RECTS(prgnDst); - if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) + if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) return; ppt = pptSrc; @@ -152,7 +152,7 @@ afbCopyWindow(pWin, ptOldOrg, prgnSrc) afbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, prgnDst, pptSrc, ~0); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); REGION_DESTROY(pWin->drawable.pScreen, prgnDst); } |