mi: Remove usage of alloca

Replace with heap allocations.
This commit is contained in:
Daniel Stone 2007-11-05 14:08:51 +00:00
parent 3633ae6efb
commit be9ee17f96
16 changed files with 128 additions and 128 deletions

View File

@ -925,14 +925,14 @@ miFillWideEllipse(
yorgu = parc->height + pGC->lineWidth; yorgu = parc->height + pGC->lineWidth;
n = (sizeof(int) * 2) * yorgu; n = (sizeof(int) * 2) * yorgu;
widths = (int *)ALLOCATE_LOCAL(n + (sizeof(DDXPointRec) * 2) * yorgu); widths = (int *)xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
if (!widths) if (!widths)
return; return;
points = (DDXPointPtr)((char *)widths + n); points = (DDXPointPtr)((char *)widths + n);
spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree); spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree);
if (!spdata) if (!spdata)
{ {
DEALLOCATE_LOCAL(widths); xfree(widths);
return; return;
} }
pts = points; pts = points;
@ -1025,7 +1025,7 @@ miFillWideEllipse(
xfree(spdata); xfree(spdata);
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); xfree(widths);
} }
/* /*
@ -1899,13 +1899,13 @@ miComputeArcs (
isDoubleDash = (pGC->lineStyle == LineDoubleDash); isDoubleDash = (pGC->lineStyle == LineDoubleDash);
dashOffset = pGC->dashOffset; dashOffset = pGC->dashOffset;
data = (struct arcData *) ALLOCATE_LOCAL (narcs * sizeof (struct arcData)); data = (struct arcData *) xalloc (narcs * sizeof (struct arcData));
if (!data) if (!data)
return (miPolyArcPtr)NULL; return (miPolyArcPtr)NULL;
arcs = (miPolyArcPtr) xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1)); arcs = (miPolyArcPtr) xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
if (!arcs) if (!arcs)
{ {
DEALLOCATE_LOCAL(data); xfree(data);
return (miPolyArcPtr)NULL; return (miPolyArcPtr)NULL;
} }
for (i = 0; i < narcs; i++) { for (i = 0; i < narcs; i++) {
@ -2254,11 +2254,11 @@ miComputeArcs (
arcs[iphase].arcs[arcs[iphase].narcs-1].cap = arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
arcs[iphase].ncaps; arcs[iphase].ncaps;
} }
DEALLOCATE_LOCAL(data); xfree(data);
return arcs; return arcs;
arcfail: arcfail:
miFreeArcs(arcs, pGC); miFreeArcs(arcs, pGC);
DEALLOCATE_LOCAL(data); xfree(data);
return (miPolyArcPtr)NULL; return (miPolyArcPtr)NULL;
} }
@ -3162,8 +3162,8 @@ fillSpans (
if (nspans == 0) if (nspans == 0)
return; return;
xSpan = xSpans = (DDXPointPtr) ALLOCATE_LOCAL (nspans * sizeof (DDXPointRec)); xSpan = xSpans = (DDXPointPtr) xalloc (nspans * sizeof (DDXPointRec));
xWidth = xWidths = (int *) ALLOCATE_LOCAL (nspans * sizeof (int)); xWidth = xWidths = (int *) xalloc (nspans * sizeof (int));
if (xSpans && xWidths) if (xSpans && xWidths)
{ {
i = 0; i = 0;
@ -3183,9 +3183,9 @@ fillSpans (
} }
disposeFinalSpans (); disposeFinalSpans ();
if (xSpans) if (xSpans)
DEALLOCATE_LOCAL (xSpans); xfree (xSpans);
if (xWidths) if (xWidths)
DEALLOCATE_LOCAL (xWidths); xfree (xWidths);
finalMiny = 0; finalMiny = 0;
finalMaxy = -1; finalMaxy = -1;
finalSize = 0; finalSize = 0;

View File

@ -172,8 +172,8 @@ typedef struct _miBankQueue
(*pScreenPriv->BankInfo.SetDestinationBank)(pScreen, (_no)) - \ (*pScreenPriv->BankInfo.SetDestinationBank)(pScreen, (_no)) - \
(pScreenPriv->BankInfo.BankSize * (_no))) (pScreenPriv->BankInfo.BankSize * (_no)))
#define ALLOCATE_LOCAL_ARRAY(atype, ntype) \ #define xalloc_ARRAY(atype, ntype) \
(atype *)ALLOCATE_LOCAL((ntype) * sizeof(atype)) (atype *)xalloc((ntype) * sizeof(atype))
static int miBankScreenIndex; static int miBankScreenIndex;
static int miBankGCIndex; static int miBankGCIndex;
@ -318,14 +318,14 @@ static unsigned long miBankGeneration = 0;
atype *aarg = pArray, *acopy; \ atype *aarg = pArray, *acopy; \
int i; \ int i; \
CLIP_SAVE; \ CLIP_SAVE; \
if ((acopy = ALLOCATE_LOCAL_ARRAY(atype, nArray))) \ if ((acopy = xalloc_ARRAY(atype, nArray))) \
aarg = acopy; \ aarg = acopy; \
GCOP_TOP_PART; \ GCOP_TOP_PART; \
if (acopy) \ if (acopy) \
memcpy(acopy, pArray, nArray * sizeof(atype)); \ memcpy(acopy, pArray, nArray * sizeof(atype)); \
(*pGC->ops->aop)(pDrawable, pGC, GCOP_ARGS nArray, aarg); \ (*pGC->ops->aop)(pDrawable, pGC, GCOP_ARGS nArray, aarg); \
GCOP_BOTTOM_PART; \ GCOP_BOTTOM_PART; \
DEALLOCATE_LOCAL(acopy); \ xfree(acopy); \
CLIP_RESTORE; \ CLIP_RESTORE; \
} \ } \
SCREEN_RESTORE; \ SCREEN_RESTORE; \
@ -787,7 +787,7 @@ miBankCopy(
fastBlit = pGCPriv->fastCopy; fastBlit = pGCPriv->fastCopy;
nQueue = nBox * pScreenPriv->maxRects * 2; nQueue = nBox * pScreenPriv->maxRects * 2;
pQueue = Queue = ALLOCATE_LOCAL_ARRAY(miBankQueue, nQueue); pQueue = Queue = xalloc_ARRAY(miBankQueue, nQueue);
if (Queue) if (Queue)
{ {
@ -953,7 +953,7 @@ miBankCopy(
paddedWidth = PixmapBytePad(maxWidth, paddedWidth = PixmapBytePad(maxWidth,
pScreenPriv->pScreenPixmap->drawable.depth); pScreenPriv->pScreenPixmap->drawable.depth);
pImage = (char *)ALLOCATE_LOCAL(paddedWidth * maxHeight); pImage = (char *)xalloc(paddedWidth * maxHeight);
pGC->fExpose = FALSE; pGC->fExpose = FALSE;
@ -1031,7 +1031,7 @@ miBankCopy(
pQueue++; pQueue++;
} }
DEALLOCATE_LOCAL(pImage); xfree(pImage);
BANK_RESTORE; BANK_RESTORE;
} }
@ -1040,7 +1040,7 @@ miBankCopy(
pGC->fExpose = fExpose; pGC->fExpose = fExpose;
DEALLOCATE_LOCAL(Queue); xfree(Queue);
} }
SCREEN_RESTORE; SCREEN_RESTORE;
@ -1748,7 +1748,7 @@ miBankGetImage(
paddedWidth = PixmapBytePad(w, paddedWidth = PixmapBytePad(w,
pScreenPriv->pScreenPixmap->drawable.depth); pScreenPriv->pScreenPixmap->drawable.depth);
pBankImage = (char *)ALLOCATE_LOCAL(paddedWidth * h); pBankImage = (char *)xalloc(paddedWidth * h);
if (pBankImage) if (pBankImage)
{ {
@ -1768,7 +1768,7 @@ miBankGetImage(
BANK_RESTORE; BANK_RESTORE;
DEALLOCATE_LOCAL(pBankImage); xfree(pBankImage);
} }
} }
@ -1809,7 +1809,7 @@ miBankGetSpans(
paddedWidth = paddedWidth =
PixmapBytePad(pScreenPriv->pScreenPixmap->drawable.width, PixmapBytePad(pScreenPriv->pScreenPixmap->drawable.width,
pScreenPriv->pScreenPixmap->drawable.depth); pScreenPriv->pScreenPixmap->drawable.depth);
pBankImage = (char *)ALLOCATE_LOCAL(paddedWidth); pBankImage = (char *)xalloc(paddedWidth);
if (pBankImage) if (pBankImage)
{ {
@ -1838,7 +1838,7 @@ miBankGetSpans(
BANK_RESTORE; BANK_RESTORE;
DEALLOCATE_LOCAL(pBankImage); xfree(pBankImage);
} }
} }
@ -1911,7 +1911,7 @@ miBankCopyWindow(
if (dy < 0) if (dy < 0)
{ {
/* Sort boxes from bottom to top */ /* Sort boxes from bottom to top */
pBoxNew1 = ALLOCATE_LOCAL_ARRAY(BoxRec, nBox); pBoxNew1 = xalloc_ARRAY(BoxRec, nBox);
if (pBoxNew1) if (pBoxNew1)
{ {
@ -1939,7 +1939,7 @@ miBankCopyWindow(
if (dx < 0) if (dx < 0)
{ {
/* Sort boxes from right to left */ /* Sort boxes from right to left */
pBoxNew2 = ALLOCATE_LOCAL_ARRAY(BoxRec, nBox); pBoxNew2 = xalloc_ARRAY(BoxRec, nBox);
if (pBoxNew2) if (pBoxNew2)
{ {
@ -1979,8 +1979,8 @@ miBankCopyWindow(
REGION_DESTROY(pScreen, pRgnDst); REGION_DESTROY(pScreen, pRgnDst);
DEALLOCATE_LOCAL(pBoxNew2); xfree(pBoxNew2);
DEALLOCATE_LOCAL(pBoxNew1); xfree(pBoxNew1);
} }
_X_EXPORT Bool _X_EXPORT Bool

View File

@ -143,21 +143,21 @@ miCopyArea(pSrcDrawable, pDstDrawable,
} }
pptFirst = ppt = (DDXPointPtr) pptFirst = ppt = (DDXPointPtr)
ALLOCATE_LOCAL(heightSrc * sizeof(DDXPointRec)); xalloc(heightSrc * sizeof(DDXPointRec));
pwidthFirst = pwidth = (unsigned int *) pwidthFirst = pwidth = (unsigned int *)
ALLOCATE_LOCAL(heightSrc * sizeof(unsigned int)); xalloc(heightSrc * sizeof(unsigned int));
numRects = REGION_NUM_RECTS(prgnSrcClip); numRects = REGION_NUM_RECTS(prgnSrcClip);
boxes = REGION_RECTS(prgnSrcClip); boxes = REGION_RECTS(prgnSrcClip);
ordering = (unsigned int *) ordering = (unsigned int *)
ALLOCATE_LOCAL(numRects * sizeof(unsigned int)); xalloc(numRects * sizeof(unsigned int));
if(!pptFirst || !pwidthFirst || !ordering) if(!pptFirst || !pwidthFirst || !ordering)
{ {
if (ordering) if (ordering)
DEALLOCATE_LOCAL(ordering); xfree(ordering);
if (pwidthFirst) if (pwidthFirst)
DEALLOCATE_LOCAL(pwidthFirst); xfree(pwidthFirst);
if (pptFirst) if (pptFirst)
DEALLOCATE_LOCAL(pptFirst); xfree(pptFirst);
return (RegionPtr)NULL; return (RegionPtr)NULL;
} }
@ -264,9 +264,9 @@ miCopyArea(pSrcDrawable, pDstDrawable,
if(realSrcClip) if(realSrcClip)
REGION_DESTROY(pGC->pScreen, prgnSrcClip); REGION_DESTROY(pGC->pScreen, prgnSrcClip);
DEALLOCATE_LOCAL(ordering); xfree(ordering);
DEALLOCATE_LOCAL(pwidthFirst); xfree(pwidthFirst);
DEALLOCATE_LOCAL(pptFirst); xfree(pptFirst);
return prgnExposed; return prgnExposed;
} }
@ -433,12 +433,12 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv); dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv);
ValidateGC((DrawablePtr)pPixmap, pGCT); ValidateGC((DrawablePtr)pPixmap, pGCT);
miClearDrawable((DrawablePtr)pPixmap, pGCT); miClearDrawable((DrawablePtr)pPixmap, pGCT);
ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst); if (pwidthFirst) xfree(pwidthFirst);
if (pptFirst) DEALLOCATE_LOCAL(pptFirst); if (pptFirst) xfree(pptFirst);
FreeScratchGC(pGCT); FreeScratchGC(pGCT);
return; return;
} }
@ -464,8 +464,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
(*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits, (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits,
pptFirst, pwidthFirst, h, TRUE); pptFirst, pwidthFirst, h, TRUE);
DEALLOCATE_LOCAL(pwidthFirst); xfree(pwidthFirst);
DEALLOCATE_LOCAL(pptFirst); xfree(pptFirst);
/* Save current values from the client GC */ /* Save current values from the client GC */
@ -808,14 +808,14 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
break; break;
case ZPixmap: case ZPixmap:
ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec));
pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst) if(!pptFirst || !pwidthFirst)
{ {
if (pwidthFirst) if (pwidthFirst)
DEALLOCATE_LOCAL(pwidthFirst); xfree(pwidthFirst);
if (pptFirst) if (pptFirst)
DEALLOCATE_LOCAL(pptFirst); xfree(pptFirst);
return; return;
} }
if (pGC->miTranslate) if (pGC->miTranslate)
@ -834,8 +834,8 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
(*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst, (*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst,
pwidthFirst, h, TRUE); pwidthFirst, h, TRUE);
DEALLOCATE_LOCAL(pwidthFirst); xfree(pwidthFirst);
DEALLOCATE_LOCAL(pptFirst); xfree(pptFirst);
break; break;
} }
} }

View File

@ -369,7 +369,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
numRects = REGION_NUM_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn);
pBox = REGION_RECTS(pRgn); pBox = REGION_RECTS(pRgn);
if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) if(!(pEvent = (xEvent *)xalloc(numRects * sizeof(xEvent))))
return; return;
pe = pEvent; pe = pEvent;
@ -387,7 +387,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
} }
TryClientEvents(client, pEvent, numRects, TryClientEvents(client, pEvent, numRects,
(Mask)0, NoEventMask, NullGrab); (Mask)0, NoEventMask, NullGrab);
DEALLOCATE_LOCAL(pEvent); xfree(pEvent);
} }
else else
{ {
@ -415,7 +415,7 @@ miSendExposures(pWin, pRgn, dx, dy)
pBox = REGION_RECTS(pRgn); pBox = REGION_RECTS(pRgn);
numRects = REGION_NUM_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn);
if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) if(!(pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent))))
return; return;
for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
@ -445,7 +445,7 @@ miSendExposures(pWin, pRgn, dx, dy)
win = PanoramiXFindIDByScrnum(XRT_WINDOW, win = PanoramiXFindIDByScrnum(XRT_WINDOW,
pWin->drawable.id, scrnum); pWin->drawable.id, scrnum);
if(!win) { if(!win) {
DEALLOCATE_LOCAL(pEvent); xfree(pEvent);
return; return;
} }
realWin = win->info[0].id; realWin = win->info[0].id;
@ -462,7 +462,7 @@ miSendExposures(pWin, pRgn, dx, dy)
DeliverEvents(pWin, pEvent, numRects, NullWindow); DeliverEvents(pWin, pEvent, numRects, NullWindow);
DEALLOCATE_LOCAL(pEvent); xfree(pEvent);
} }
_X_EXPORT void _X_EXPORT void
@ -620,7 +620,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
} }
prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) *
sizeof(xRectangle)); sizeof(xRectangle));
if (!prect) if (!prect)
return; return;
@ -628,7 +628,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
pGC = GetScratchGC(drawable->depth, drawable->pScreen); pGC = GetScratchGC(drawable->depth, drawable->pScreen);
if (!pGC) if (!pGC)
{ {
DEALLOCATE_LOCAL(prect); xfree(prect);
return; return;
} }
@ -646,7 +646,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
} }
prect -= numRects; prect -= numRects;
(*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect); (*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect);
DEALLOCATE_LOCAL(prect); xfree(prect);
FreeScratchGC(pGC); FreeScratchGC(pGC);
} }

View File

@ -551,13 +551,13 @@ miFillEllipseI(
int *widths; int *widths;
int *wids; int *wids;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height); points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height); widths = (int *)xalloc(sizeof(int) * arc->height);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); xfree(points);
return; return;
} }
miFillArcSetup(arc, &info); miFillArcSetup(arc, &info);
@ -575,8 +575,8 @@ miFillEllipseI(
ADDSPANS(); ADDSPANS();
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); xfree(widths);
DEALLOCATE_LOCAL(points); xfree(points);
} }
static void static void
@ -594,13 +594,13 @@ miFillEllipseD(
int *widths; int *widths;
int *wids; int *wids;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height); points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height); widths = (int *)xalloc(sizeof(int) * arc->height);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); xfree(points);
return; return;
} }
miFillArcDSetup(arc, &info); miFillArcDSetup(arc, &info);
@ -618,8 +618,8 @@ miFillEllipseD(
ADDSPANS(); ADDSPANS();
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); xfree(widths);
DEALLOCATE_LOCAL(points); xfree(points);
} }
#define ADDSPAN(l,r) \ #define ADDSPAN(l,r) \
@ -666,13 +666,13 @@ miFillArcSliceI(
slw = arc->height; slw = arc->height;
if (slice.flip_top || slice.flip_bot) if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1; slw += (arc->height >> 1) + 1;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw); points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw); widths = (int *)xalloc(sizeof(int) * slw);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); xfree(points);
return; return;
} }
if (pGC->miTranslate) if (pGC->miTranslate)
@ -703,8 +703,8 @@ miFillArcSliceI(
} }
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); xfree(widths);
DEALLOCATE_LOCAL(points); xfree(points);
} }
static void static void
@ -730,13 +730,13 @@ miFillArcSliceD(
slw = arc->height; slw = arc->height;
if (slice.flip_top || slice.flip_bot) if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1; slw += (arc->height >> 1) + 1;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw); points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw); widths = (int *)xalloc(sizeof(int) * slw);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); xfree(points);
return; return;
} }
if (pGC->miTranslate) if (pGC->miTranslate)
@ -767,8 +767,8 @@ miFillArcSliceD(
} }
} }
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
DEALLOCATE_LOCAL(widths); xfree(widths);
DEALLOCATE_LOCAL(points); xfree(points);
} }
/* MIPOLYFILLARC -- The public entry for the PolyFillArc request. /* MIPOLYFILLARC -- The public entry for the PolyFillArc request.

View File

@ -106,12 +106,12 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
maxheight = max(maxheight, prect->height); maxheight = max(maxheight, prect->height);
} }
pptFirst = (DDXPointPtr) ALLOCATE_LOCAL(maxheight * sizeof(DDXPointRec)); pptFirst = (DDXPointPtr) xalloc(maxheight * sizeof(DDXPointRec));
pwFirst = (int *) ALLOCATE_LOCAL(maxheight * sizeof(int)); pwFirst = (int *) xalloc(maxheight * sizeof(int));
if(!pptFirst || !pwFirst) if(!pptFirst || !pwFirst)
{ {
if (pwFirst) DEALLOCATE_LOCAL(pwFirst); if (pwFirst) xfree(pwFirst);
if (pptFirst) DEALLOCATE_LOCAL(pptFirst); if (pptFirst) xfree(pptFirst);
return; return;
} }
@ -137,6 +137,6 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
1); 1);
prect++; prect++;
} }
DEALLOCATE_LOCAL(pwFirst); xfree(pwFirst);
DEALLOCATE_LOCAL(pptFirst); xfree(pptFirst);
} }

View File

@ -114,15 +114,15 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
y = ymax - ymin + 1; y = ymax - ymin + 1;
if ((count < 3) || (y <= 0)) if ((count < 3) || (y <= 0))
return; return;
ptsOut = FirstPoint = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * y); ptsOut = FirstPoint = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * y);
width = FirstWidth = (int *) ALLOCATE_LOCAL(sizeof(int) * y); width = FirstWidth = (int *) xalloc(sizeof(int) * y);
Marked = (int *) ALLOCATE_LOCAL(sizeof(int) * count); Marked = (int *) xalloc(sizeof(int) * count);
if(!ptsOut || !width || !Marked) if(!ptsOut || !width || !Marked)
{ {
if (Marked) DEALLOCATE_LOCAL(Marked); if (Marked) xfree(Marked);
if (width) DEALLOCATE_LOCAL(width); if (width) xfree(width);
if (ptsOut) DEALLOCATE_LOCAL(ptsOut); if (ptsOut) xfree(ptsOut);
return; return;
} }
@ -236,9 +236,9 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
/* Finally, fill the spans we've collected */ /* Finally, fill the spans we've collected */
(*pgc->ops->FillSpans)(dst, pgc, (*pgc->ops->FillSpans)(dst, pgc,
ptsOut-FirstPoint, FirstPoint, FirstWidth, 1); ptsOut-FirstPoint, FirstPoint, FirstWidth, 1);
DEALLOCATE_LOCAL(Marked); xfree(Marked);
DEALLOCATE_LOCAL(FirstWidth); xfree(FirstWidth);
DEALLOCATE_LOCAL(FirstPoint); xfree(FirstPoint);
} }

View File

@ -139,7 +139,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0); DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
nbyLine = BitmapBytePad(width); nbyLine = BitmapBytePad(width);
pbits = (unsigned char *)ALLOCATE_LOCAL(height*nbyLine); pbits = (unsigned char *)xalloc(height*nbyLine);
if (!pbits) if (!pbits)
{ {
(*pDrawable->pScreen->DestroyPixmap)(pPixmap); (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
@ -190,7 +190,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
x += pci->metrics.characterWidth; x += pci->metrics.characterWidth;
} }
(*pDrawable->pScreen->DestroyPixmap)(pPixmap); (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
DEALLOCATE_LOCAL(pbits); xfree(pbits);
FreeScratchGC(pGCtmp); FreeScratchGC(pGCtmp);
} }

View File

@ -104,12 +104,12 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
dy = ymax - ymin + 1; dy = ymax - ymin + 1;
if ((count < 3) || (dy < 0)) if ((count < 3) || (dy < 0))
return(TRUE); return(TRUE);
ptsOut = FirstPoint = (DDXPointPtr )ALLOCATE_LOCAL(sizeof(DDXPointRec)*dy); ptsOut = FirstPoint = (DDXPointPtr )xalloc(sizeof(DDXPointRec)*dy);
width = FirstWidth = (int *)ALLOCATE_LOCAL(sizeof(int) * dy); width = FirstWidth = (int *)xalloc(sizeof(int) * dy);
if(!FirstPoint || !FirstWidth) if(!FirstPoint || !FirstWidth)
{ {
if (FirstWidth) DEALLOCATE_LOCAL(FirstWidth); if (FirstWidth) xfree(FirstWidth);
if (FirstPoint) DEALLOCATE_LOCAL(FirstPoint); if (FirstPoint) xfree(FirstPoint);
return(FALSE); return(FALSE);
} }
@ -174,8 +174,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
/* in case we're called with non-convex polygon */ /* in case we're called with non-convex polygon */
if(i < 0) if(i < 0)
{ {
DEALLOCATE_LOCAL(FirstWidth); xfree(FirstWidth);
DEALLOCATE_LOCAL(FirstPoint); xfree(FirstPoint);
return(TRUE); return(TRUE);
} }
while (i-- > 0) while (i-- > 0)
@ -209,8 +209,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
(*pgc->ops->FillSpans)(dst, pgc, (*pgc->ops->FillSpans)(dst, pgc,
ptsOut-FirstPoint,FirstPoint,FirstWidth, ptsOut-FirstPoint,FirstPoint,FirstWidth,
1); 1);
DEALLOCATE_LOCAL(FirstWidth); xfree(FirstWidth);
DEALLOCATE_LOCAL(FirstPoint); xfree(FirstPoint);
return(TRUE); return(TRUE);
} }

View File

@ -92,13 +92,13 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
return(TRUE); return(TRUE);
if(!(pETEs = (EdgeTableEntry *) if(!(pETEs = (EdgeTableEntry *)
ALLOCATE_LOCAL(sizeof(EdgeTableEntry) * count))) xalloc(sizeof(EdgeTableEntry) * count)))
return(FALSE); return(FALSE);
ptsOut = FirstPoint; ptsOut = FirstPoint;
width = FirstWidth; width = FirstWidth;
if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
{ {
DEALLOCATE_LOCAL(pETEs); xfree(pETEs);
return(FALSE); return(FALSE);
} }
pSLL = ET.scanlines.next; pSLL = ET.scanlines.next;
@ -224,7 +224,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
* Get any spans that we missed by buffering * Get any spans that we missed by buffering
*/ */
(*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1);
DEALLOCATE_LOCAL(pETEs); xfree(pETEs);
miFreeStorage(SLLBlock.next); miFreeStorage(SLLBlock.next);
return(TRUE); return(TRUE);
} }

View File

@ -106,7 +106,7 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
DoChangeGC(pGC, GCFillStyle, &fsNew, 0); DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
ValidateGC(pDrawable, pGC); ValidateGC(pDrawable, pGC);
} }
if(!(pwidthInit = (int *)ALLOCATE_LOCAL(npt * sizeof(int)))) if(!(pwidthInit = (int *)xalloc(npt * sizeof(int))))
return; return;
pwidth = pwidthInit; pwidth = pwidthInit;
for(i = 0; i < npt; i++) for(i = 0; i < npt; i++)
@ -118,6 +118,6 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
DoChangeGC(pGC, GCFillStyle, &fsOld, 0); DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
ValidateGC(pDrawable, pGC); ValidateGC(pDrawable, pGC);
} }
DEALLOCATE_LOCAL(pwidthInit); xfree(pwidthInit);
} }

View File

@ -94,7 +94,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
offset2 = pGC->lineWidth; offset2 = pGC->lineWidth;
offset1 = offset2 >> 1; offset1 = offset2 >> 1;
offset3 = offset2 - offset1; offset3 = offset2 - offset1;
tmp = (xRectangle *) ALLOCATE_LOCAL(ntmp * sizeof (xRectangle)); tmp = (xRectangle *) xalloc(ntmp * sizeof (xRectangle));
if (!tmp) if (!tmp)
return; return;
t = tmp; t = tmp;
@ -162,7 +162,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
} }
} }
(*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp); (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
DEALLOCATE_LOCAL ((pointer) tmp); xfree ((pointer) tmp);
} }
else else
{ {

View File

@ -528,7 +528,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
xfree(points); xfree(points);
xfree(widths); xfree(widths);
xfree(yspans); xfree(yspans);
xfree(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */ xfree(ysizes); /* use (DE)xalloc for these? */
} }
spanGroup->count = 0; spanGroup->count = 0;

View File

@ -95,13 +95,13 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
if (!spanData) if (!spanData)
{ {
pptInit = (DDXPointPtr) ALLOCATE_LOCAL (overall_height * sizeof(*ppt)); pptInit = (DDXPointPtr) xalloc (overall_height * sizeof(*ppt));
if (!pptInit) if (!pptInit)
return; return;
pwidthInit = (int *) ALLOCATE_LOCAL (overall_height * sizeof(*pwidth)); pwidthInit = (int *) xalloc (overall_height * sizeof(*pwidth));
if (!pwidthInit) if (!pwidthInit)
{ {
DEALLOCATE_LOCAL (pptInit); xfree (pptInit);
return; return;
} }
ppt = pptInit; ppt = pptInit;
@ -167,8 +167,8 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
if (!spanData) if (!spanData)
{ {
(*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE); (*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE);
DEALLOCATE_LOCAL (pwidthInit); xfree (pwidthInit);
DEALLOCATE_LOCAL (pptInit); xfree (pptInit);
if (pixel != oldPixel) if (pixel != oldPixel)
{ {
DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
@ -1045,13 +1045,13 @@ miLineArc (
} }
if (!spanData) if (!spanData)
{ {
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * pGC->lineWidth); points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
if (!points) if (!points)
return; return;
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * pGC->lineWidth); widths = (int *)xalloc(sizeof(int) * pGC->lineWidth);
if (!widths) if (!widths)
{ {
DEALLOCATE_LOCAL(points); xfree(points);
return; return;
} }
oldPixel = pGC->fgPixel; oldPixel = pGC->fgPixel;
@ -1086,8 +1086,8 @@ miLineArc (
if (!spanData) if (!spanData)
{ {
(*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE); (*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE);
DEALLOCATE_LOCAL(widths); xfree(widths);
DEALLOCATE_LOCAL(points); xfree(points);
if (pixel != oldPixel) if (pixel != oldPixel)
{ {
DoChangeGC(pGC, GCForeground, &oldPixel, FALSE); DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);

View File

@ -744,7 +744,7 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
dospans = (pGC->fillStyle != FillSolid); dospans = (pGC->fillStyle != FillSolid);
if (dospans) if (dospans)
{ {
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * numPts); widths = (int *)xalloc(sizeof(int) * numPts);
if (!widths) if (!widths)
return; return;
maxw = 0; maxw = 0;
@ -761,12 +761,12 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
(unsigned char *) pGC->dash, (int)pGC->numInDashList, (unsigned char *) pGC->dash, (int)pGC->numInDashList,
&dinfo.dashOffsetInit); &dinfo.dashOffsetInit);
} }
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * numPts); points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * numPts);
if (!points) if (!points)
{ {
if (dospans) if (dospans)
{ {
DEALLOCATE_LOCAL(widths); xfree(widths);
} }
return; return;
} }
@ -843,9 +843,9 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
} }
} }
} }
DEALLOCATE_LOCAL(points); xfree(points);
if (dospans) if (dospans)
{ {
DEALLOCATE_LOCAL(widths); xfree(widths);
} }
} }

View File

@ -155,8 +155,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
width = xright - xleft + 1; width = xright - xleft + 1;
height = ybottom - ytop + 1; height = ybottom - ytop + 1;
list_len = (height >= width) ? height : width; list_len = (height >= width) ? height : width;
pspanInit = (DDXPointPtr)ALLOCATE_LOCAL(list_len * sizeof(DDXPointRec)); pspanInit = (DDXPointPtr)xalloc(list_len * sizeof(DDXPointRec));
pwidthInit = (int *)ALLOCATE_LOCAL(list_len * sizeof(int)); pwidthInit = (int *)xalloc(list_len * sizeof(int));
if (!pspanInit || !pwidthInit) if (!pspanInit || !pwidthInit)
return; return;
@ -359,8 +359,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
(*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit, (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit,
pwidthInit, FALSE); pwidthInit, FALSE);
DEALLOCATE_LOCAL(pwidthInit); xfree(pwidthInit);
DEALLOCATE_LOCAL(pspanInit); xfree(pspanInit);
} }
_X_EXPORT void _X_EXPORT void