mi: Remove usage of alloca
Replace with heap allocations.
This commit is contained in:
parent
3633ae6efb
commit
be9ee17f96
22
mi/miarc.c
22
mi/miarc.c
|
@ -925,14 +925,14 @@ miFillWideEllipse(
|
|||
|
||||
yorgu = parc->height + pGC->lineWidth;
|
||||
n = (sizeof(int) * 2) * yorgu;
|
||||
widths = (int *)ALLOCATE_LOCAL(n + (sizeof(DDXPointRec) * 2) * yorgu);
|
||||
widths = (int *)xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
|
||||
if (!widths)
|
||||
return;
|
||||
points = (DDXPointPtr)((char *)widths + n);
|
||||
spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree);
|
||||
if (!spdata)
|
||||
{
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
xfree(widths);
|
||||
return;
|
||||
}
|
||||
pts = points;
|
||||
|
@ -1025,7 +1025,7 @@ miFillWideEllipse(
|
|||
xfree(spdata);
|
||||
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
|
||||
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
xfree(widths);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1899,13 +1899,13 @@ miComputeArcs (
|
|||
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
|
||||
dashOffset = pGC->dashOffset;
|
||||
|
||||
data = (struct arcData *) ALLOCATE_LOCAL (narcs * sizeof (struct arcData));
|
||||
data = (struct arcData *) xalloc (narcs * sizeof (struct arcData));
|
||||
if (!data)
|
||||
return (miPolyArcPtr)NULL;
|
||||
arcs = (miPolyArcPtr) xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
|
||||
if (!arcs)
|
||||
{
|
||||
DEALLOCATE_LOCAL(data);
|
||||
xfree(data);
|
||||
return (miPolyArcPtr)NULL;
|
||||
}
|
||||
for (i = 0; i < narcs; i++) {
|
||||
|
@ -2254,11 +2254,11 @@ miComputeArcs (
|
|||
arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
|
||||
arcs[iphase].ncaps;
|
||||
}
|
||||
DEALLOCATE_LOCAL(data);
|
||||
xfree(data);
|
||||
return arcs;
|
||||
arcfail:
|
||||
miFreeArcs(arcs, pGC);
|
||||
DEALLOCATE_LOCAL(data);
|
||||
xfree(data);
|
||||
return (miPolyArcPtr)NULL;
|
||||
}
|
||||
|
||||
|
@ -3162,8 +3162,8 @@ fillSpans (
|
|||
|
||||
if (nspans == 0)
|
||||
return;
|
||||
xSpan = xSpans = (DDXPointPtr) ALLOCATE_LOCAL (nspans * sizeof (DDXPointRec));
|
||||
xWidth = xWidths = (int *) ALLOCATE_LOCAL (nspans * sizeof (int));
|
||||
xSpan = xSpans = (DDXPointPtr) xalloc (nspans * sizeof (DDXPointRec));
|
||||
xWidth = xWidths = (int *) xalloc (nspans * sizeof (int));
|
||||
if (xSpans && xWidths)
|
||||
{
|
||||
i = 0;
|
||||
|
@ -3183,9 +3183,9 @@ fillSpans (
|
|||
}
|
||||
disposeFinalSpans ();
|
||||
if (xSpans)
|
||||
DEALLOCATE_LOCAL (xSpans);
|
||||
xfree (xSpans);
|
||||
if (xWidths)
|
||||
DEALLOCATE_LOCAL (xWidths);
|
||||
xfree (xWidths);
|
||||
finalMiny = 0;
|
||||
finalMaxy = -1;
|
||||
finalSize = 0;
|
||||
|
|
32
mi/mibank.c
32
mi/mibank.c
|
@ -172,8 +172,8 @@ typedef struct _miBankQueue
|
|||
(*pScreenPriv->BankInfo.SetDestinationBank)(pScreen, (_no)) - \
|
||||
(pScreenPriv->BankInfo.BankSize * (_no)))
|
||||
|
||||
#define ALLOCATE_LOCAL_ARRAY(atype, ntype) \
|
||||
(atype *)ALLOCATE_LOCAL((ntype) * sizeof(atype))
|
||||
#define xalloc_ARRAY(atype, ntype) \
|
||||
(atype *)xalloc((ntype) * sizeof(atype))
|
||||
|
||||
static int miBankScreenIndex;
|
||||
static int miBankGCIndex;
|
||||
|
@ -318,14 +318,14 @@ static unsigned long miBankGeneration = 0;
|
|||
atype *aarg = pArray, *acopy; \
|
||||
int i; \
|
||||
CLIP_SAVE; \
|
||||
if ((acopy = ALLOCATE_LOCAL_ARRAY(atype, nArray))) \
|
||||
if ((acopy = xalloc_ARRAY(atype, nArray))) \
|
||||
aarg = acopy; \
|
||||
GCOP_TOP_PART; \
|
||||
if (acopy) \
|
||||
memcpy(acopy, pArray, nArray * sizeof(atype)); \
|
||||
(*pGC->ops->aop)(pDrawable, pGC, GCOP_ARGS nArray, aarg); \
|
||||
GCOP_BOTTOM_PART; \
|
||||
DEALLOCATE_LOCAL(acopy); \
|
||||
xfree(acopy); \
|
||||
CLIP_RESTORE; \
|
||||
} \
|
||||
SCREEN_RESTORE; \
|
||||
|
@ -787,7 +787,7 @@ miBankCopy(
|
|||
fastBlit = pGCPriv->fastCopy;
|
||||
|
||||
nQueue = nBox * pScreenPriv->maxRects * 2;
|
||||
pQueue = Queue = ALLOCATE_LOCAL_ARRAY(miBankQueue, nQueue);
|
||||
pQueue = Queue = xalloc_ARRAY(miBankQueue, nQueue);
|
||||
|
||||
if (Queue)
|
||||
{
|
||||
|
@ -953,7 +953,7 @@ miBankCopy(
|
|||
|
||||
paddedWidth = PixmapBytePad(maxWidth,
|
||||
pScreenPriv->pScreenPixmap->drawable.depth);
|
||||
pImage = (char *)ALLOCATE_LOCAL(paddedWidth * maxHeight);
|
||||
pImage = (char *)xalloc(paddedWidth * maxHeight);
|
||||
|
||||
pGC->fExpose = FALSE;
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ miBankCopy(
|
|||
pQueue++;
|
||||
}
|
||||
|
||||
DEALLOCATE_LOCAL(pImage);
|
||||
xfree(pImage);
|
||||
|
||||
BANK_RESTORE;
|
||||
}
|
||||
|
@ -1040,7 +1040,7 @@ miBankCopy(
|
|||
|
||||
pGC->fExpose = fExpose;
|
||||
|
||||
DEALLOCATE_LOCAL(Queue);
|
||||
xfree(Queue);
|
||||
}
|
||||
|
||||
SCREEN_RESTORE;
|
||||
|
@ -1748,7 +1748,7 @@ miBankGetImage(
|
|||
|
||||
paddedWidth = PixmapBytePad(w,
|
||||
pScreenPriv->pScreenPixmap->drawable.depth);
|
||||
pBankImage = (char *)ALLOCATE_LOCAL(paddedWidth * h);
|
||||
pBankImage = (char *)xalloc(paddedWidth * h);
|
||||
|
||||
if (pBankImage)
|
||||
{
|
||||
|
@ -1768,7 +1768,7 @@ miBankGetImage(
|
|||
|
||||
BANK_RESTORE;
|
||||
|
||||
DEALLOCATE_LOCAL(pBankImage);
|
||||
xfree(pBankImage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1809,7 +1809,7 @@ miBankGetSpans(
|
|||
paddedWidth =
|
||||
PixmapBytePad(pScreenPriv->pScreenPixmap->drawable.width,
|
||||
pScreenPriv->pScreenPixmap->drawable.depth);
|
||||
pBankImage = (char *)ALLOCATE_LOCAL(paddedWidth);
|
||||
pBankImage = (char *)xalloc(paddedWidth);
|
||||
|
||||
if (pBankImage)
|
||||
{
|
||||
|
@ -1838,7 +1838,7 @@ miBankGetSpans(
|
|||
|
||||
BANK_RESTORE;
|
||||
|
||||
DEALLOCATE_LOCAL(pBankImage);
|
||||
xfree(pBankImage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1911,7 +1911,7 @@ miBankCopyWindow(
|
|||
if (dy < 0)
|
||||
{
|
||||
/* Sort boxes from bottom to top */
|
||||
pBoxNew1 = ALLOCATE_LOCAL_ARRAY(BoxRec, nBox);
|
||||
pBoxNew1 = xalloc_ARRAY(BoxRec, nBox);
|
||||
|
||||
if (pBoxNew1)
|
||||
{
|
||||
|
@ -1939,7 +1939,7 @@ miBankCopyWindow(
|
|||
if (dx < 0)
|
||||
{
|
||||
/* Sort boxes from right to left */
|
||||
pBoxNew2 = ALLOCATE_LOCAL_ARRAY(BoxRec, nBox);
|
||||
pBoxNew2 = xalloc_ARRAY(BoxRec, nBox);
|
||||
|
||||
if (pBoxNew2)
|
||||
{
|
||||
|
@ -1979,8 +1979,8 @@ miBankCopyWindow(
|
|||
|
||||
REGION_DESTROY(pScreen, pRgnDst);
|
||||
|
||||
DEALLOCATE_LOCAL(pBoxNew2);
|
||||
DEALLOCATE_LOCAL(pBoxNew1);
|
||||
xfree(pBoxNew2);
|
||||
xfree(pBoxNew1);
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
|
|
|
@ -143,21 +143,21 @@ miCopyArea(pSrcDrawable, pDstDrawable,
|
|||
}
|
||||
|
||||
pptFirst = ppt = (DDXPointPtr)
|
||||
ALLOCATE_LOCAL(heightSrc * sizeof(DDXPointRec));
|
||||
xalloc(heightSrc * sizeof(DDXPointRec));
|
||||
pwidthFirst = pwidth = (unsigned int *)
|
||||
ALLOCATE_LOCAL(heightSrc * sizeof(unsigned int));
|
||||
xalloc(heightSrc * sizeof(unsigned int));
|
||||
numRects = REGION_NUM_RECTS(prgnSrcClip);
|
||||
boxes = REGION_RECTS(prgnSrcClip);
|
||||
ordering = (unsigned int *)
|
||||
ALLOCATE_LOCAL(numRects * sizeof(unsigned int));
|
||||
xalloc(numRects * sizeof(unsigned int));
|
||||
if(!pptFirst || !pwidthFirst || !ordering)
|
||||
{
|
||||
if (ordering)
|
||||
DEALLOCATE_LOCAL(ordering);
|
||||
xfree(ordering);
|
||||
if (pwidthFirst)
|
||||
DEALLOCATE_LOCAL(pwidthFirst);
|
||||
xfree(pwidthFirst);
|
||||
if (pptFirst)
|
||||
DEALLOCATE_LOCAL(pptFirst);
|
||||
xfree(pptFirst);
|
||||
return (RegionPtr)NULL;
|
||||
}
|
||||
|
||||
|
@ -264,9 +264,9 @@ miCopyArea(pSrcDrawable, pDstDrawable,
|
|||
if(realSrcClip)
|
||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
||||
|
||||
DEALLOCATE_LOCAL(ordering);
|
||||
DEALLOCATE_LOCAL(pwidthFirst);
|
||||
DEALLOCATE_LOCAL(pptFirst);
|
||||
xfree(ordering);
|
||||
xfree(pwidthFirst);
|
||||
xfree(pptFirst);
|
||||
return prgnExposed;
|
||||
}
|
||||
|
||||
|
@ -433,12 +433,12 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
|
|||
dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv);
|
||||
ValidateGC((DrawablePtr)pPixmap, pGCT);
|
||||
miClearDrawable((DrawablePtr)pPixmap, pGCT);
|
||||
ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec));
|
||||
pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int));
|
||||
ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec));
|
||||
pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int));
|
||||
if(!pptFirst || !pwidthFirst)
|
||||
{
|
||||
if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst);
|
||||
if (pptFirst) DEALLOCATE_LOCAL(pptFirst);
|
||||
if (pwidthFirst) xfree(pwidthFirst);
|
||||
if (pptFirst) xfree(pptFirst);
|
||||
FreeScratchGC(pGCT);
|
||||
return;
|
||||
}
|
||||
|
@ -464,8 +464,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
|
|||
|
||||
(*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits,
|
||||
pptFirst, pwidthFirst, h, TRUE);
|
||||
DEALLOCATE_LOCAL(pwidthFirst);
|
||||
DEALLOCATE_LOCAL(pptFirst);
|
||||
xfree(pwidthFirst);
|
||||
xfree(pptFirst);
|
||||
|
||||
|
||||
/* Save current values from the client GC */
|
||||
|
@ -808,14 +808,14 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
|
|||
break;
|
||||
|
||||
case ZPixmap:
|
||||
ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec));
|
||||
pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int));
|
||||
ppt = pptFirst = (DDXPointPtr)xalloc(h * sizeof(DDXPointRec));
|
||||
pwidth = pwidthFirst = (int *)xalloc(h * sizeof(int));
|
||||
if(!pptFirst || !pwidthFirst)
|
||||
{
|
||||
if (pwidthFirst)
|
||||
DEALLOCATE_LOCAL(pwidthFirst);
|
||||
xfree(pwidthFirst);
|
||||
if (pptFirst)
|
||||
DEALLOCATE_LOCAL(pptFirst);
|
||||
xfree(pptFirst);
|
||||
return;
|
||||
}
|
||||
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,
|
||||
pwidthFirst, h, TRUE);
|
||||
DEALLOCATE_LOCAL(pwidthFirst);
|
||||
DEALLOCATE_LOCAL(pptFirst);
|
||||
xfree(pwidthFirst);
|
||||
xfree(pptFirst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
|
|||
|
||||
numRects = REGION_NUM_RECTS(pRgn);
|
||||
pBox = REGION_RECTS(pRgn);
|
||||
if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
|
||||
if(!(pEvent = (xEvent *)xalloc(numRects * sizeof(xEvent))))
|
||||
return;
|
||||
pe = pEvent;
|
||||
|
||||
|
@ -387,7 +387,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
|
|||
}
|
||||
TryClientEvents(client, pEvent, numRects,
|
||||
(Mask)0, NoEventMask, NullGrab);
|
||||
DEALLOCATE_LOCAL(pEvent);
|
||||
xfree(pEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -415,7 +415,7 @@ miSendExposures(pWin, pRgn, dx, dy)
|
|||
|
||||
pBox = REGION_RECTS(pRgn);
|
||||
numRects = REGION_NUM_RECTS(pRgn);
|
||||
if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
|
||||
if(!(pEvent = (xEvent *) xalloc(numRects * sizeof(xEvent))))
|
||||
return;
|
||||
|
||||
for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
|
||||
|
@ -445,7 +445,7 @@ miSendExposures(pWin, pRgn, dx, dy)
|
|||
win = PanoramiXFindIDByScrnum(XRT_WINDOW,
|
||||
pWin->drawable.id, scrnum);
|
||||
if(!win) {
|
||||
DEALLOCATE_LOCAL(pEvent);
|
||||
xfree(pEvent);
|
||||
return;
|
||||
}
|
||||
realWin = win->info[0].id;
|
||||
|
@ -462,7 +462,7 @@ miSendExposures(pWin, pRgn, dx, dy)
|
|||
|
||||
DeliverEvents(pWin, pEvent, numRects, NullWindow);
|
||||
|
||||
DEALLOCATE_LOCAL(pEvent);
|
||||
xfree(pEvent);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
|
@ -620,7 +620,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
|||
gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
|
||||
}
|
||||
|
||||
prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) *
|
||||
prect = (xRectangle *)xalloc(REGION_NUM_RECTS(prgn) *
|
||||
sizeof(xRectangle));
|
||||
if (!prect)
|
||||
return;
|
||||
|
@ -628,7 +628,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
|||
pGC = GetScratchGC(drawable->depth, drawable->pScreen);
|
||||
if (!pGC)
|
||||
{
|
||||
DEALLOCATE_LOCAL(prect);
|
||||
xfree(prect);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
|||
}
|
||||
prect -= numRects;
|
||||
(*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect);
|
||||
DEALLOCATE_LOCAL(prect);
|
||||
xfree(prect);
|
||||
|
||||
FreeScratchGC(pGC);
|
||||
}
|
||||
|
|
|
@ -551,13 +551,13 @@ miFillEllipseI(
|
|||
int *widths;
|
||||
int *wids;
|
||||
|
||||
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height);
|
||||
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height);
|
||||
if (!points)
|
||||
return;
|
||||
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height);
|
||||
widths = (int *)xalloc(sizeof(int) * arc->height);
|
||||
if (!widths)
|
||||
{
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(points);
|
||||
return;
|
||||
}
|
||||
miFillArcSetup(arc, &info);
|
||||
|
@ -575,8 +575,8 @@ miFillEllipseI(
|
|||
ADDSPANS();
|
||||
}
|
||||
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(widths);
|
||||
xfree(points);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -594,13 +594,13 @@ miFillEllipseD(
|
|||
int *widths;
|
||||
int *wids;
|
||||
|
||||
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height);
|
||||
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * arc->height);
|
||||
if (!points)
|
||||
return;
|
||||
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height);
|
||||
widths = (int *)xalloc(sizeof(int) * arc->height);
|
||||
if (!widths)
|
||||
{
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(points);
|
||||
return;
|
||||
}
|
||||
miFillArcDSetup(arc, &info);
|
||||
|
@ -618,8 +618,8 @@ miFillEllipseD(
|
|||
ADDSPANS();
|
||||
}
|
||||
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(widths);
|
||||
xfree(points);
|
||||
}
|
||||
|
||||
#define ADDSPAN(l,r) \
|
||||
|
@ -666,13 +666,13 @@ miFillArcSliceI(
|
|||
slw = arc->height;
|
||||
if (slice.flip_top || slice.flip_bot)
|
||||
slw += (arc->height >> 1) + 1;
|
||||
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw);
|
||||
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw);
|
||||
if (!points)
|
||||
return;
|
||||
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw);
|
||||
widths = (int *)xalloc(sizeof(int) * slw);
|
||||
if (!widths)
|
||||
{
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(points);
|
||||
return;
|
||||
}
|
||||
if (pGC->miTranslate)
|
||||
|
@ -703,8 +703,8 @@ miFillArcSliceI(
|
|||
}
|
||||
}
|
||||
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(widths);
|
||||
xfree(points);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -730,13 +730,13 @@ miFillArcSliceD(
|
|||
slw = arc->height;
|
||||
if (slice.flip_top || slice.flip_bot)
|
||||
slw += (arc->height >> 1) + 1;
|
||||
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw);
|
||||
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * slw);
|
||||
if (!points)
|
||||
return;
|
||||
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw);
|
||||
widths = (int *)xalloc(sizeof(int) * slw);
|
||||
if (!widths)
|
||||
{
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(points);
|
||||
return;
|
||||
}
|
||||
if (pGC->miTranslate)
|
||||
|
@ -767,8 +767,8 @@ miFillArcSliceD(
|
|||
}
|
||||
}
|
||||
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(widths);
|
||||
xfree(points);
|
||||
}
|
||||
|
||||
/* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
|
||||
|
|
|
@ -106,12 +106,12 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
|
|||
maxheight = max(maxheight, prect->height);
|
||||
}
|
||||
|
||||
pptFirst = (DDXPointPtr) ALLOCATE_LOCAL(maxheight * sizeof(DDXPointRec));
|
||||
pwFirst = (int *) ALLOCATE_LOCAL(maxheight * sizeof(int));
|
||||
pptFirst = (DDXPointPtr) xalloc(maxheight * sizeof(DDXPointRec));
|
||||
pwFirst = (int *) xalloc(maxheight * sizeof(int));
|
||||
if(!pptFirst || !pwFirst)
|
||||
{
|
||||
if (pwFirst) DEALLOCATE_LOCAL(pwFirst);
|
||||
if (pptFirst) DEALLOCATE_LOCAL(pptFirst);
|
||||
if (pwFirst) xfree(pwFirst);
|
||||
if (pptFirst) xfree(pptFirst);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,6 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
|
|||
1);
|
||||
prect++;
|
||||
}
|
||||
DEALLOCATE_LOCAL(pwFirst);
|
||||
DEALLOCATE_LOCAL(pptFirst);
|
||||
xfree(pwFirst);
|
||||
xfree(pptFirst);
|
||||
}
|
||||
|
|
|
@ -114,15 +114,15 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
|
|||
y = ymax - ymin + 1;
|
||||
if ((count < 3) || (y <= 0))
|
||||
return;
|
||||
ptsOut = FirstPoint = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * y);
|
||||
width = FirstWidth = (int *) ALLOCATE_LOCAL(sizeof(int) * y);
|
||||
Marked = (int *) ALLOCATE_LOCAL(sizeof(int) * count);
|
||||
ptsOut = FirstPoint = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * y);
|
||||
width = FirstWidth = (int *) xalloc(sizeof(int) * y);
|
||||
Marked = (int *) xalloc(sizeof(int) * count);
|
||||
|
||||
if(!ptsOut || !width || !Marked)
|
||||
{
|
||||
if (Marked) DEALLOCATE_LOCAL(Marked);
|
||||
if (width) DEALLOCATE_LOCAL(width);
|
||||
if (ptsOut) DEALLOCATE_LOCAL(ptsOut);
|
||||
if (Marked) xfree(Marked);
|
||||
if (width) xfree(width);
|
||||
if (ptsOut) xfree(ptsOut);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -236,9 +236,9 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
|
|||
/* Finally, fill the spans we've collected */
|
||||
(*pgc->ops->FillSpans)(dst, pgc,
|
||||
ptsOut-FirstPoint, FirstPoint, FirstWidth, 1);
|
||||
DEALLOCATE_LOCAL(Marked);
|
||||
DEALLOCATE_LOCAL(FirstWidth);
|
||||
DEALLOCATE_LOCAL(FirstPoint);
|
||||
xfree(Marked);
|
||||
xfree(FirstWidth);
|
||||
xfree(FirstPoint);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
|||
DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
|
||||
|
||||
nbyLine = BitmapBytePad(width);
|
||||
pbits = (unsigned char *)ALLOCATE_LOCAL(height*nbyLine);
|
||||
pbits = (unsigned char *)xalloc(height*nbyLine);
|
||||
if (!pbits)
|
||||
{
|
||||
(*pDrawable->pScreen->DestroyPixmap)(pPixmap);
|
||||
|
@ -190,7 +190,7 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
|||
x += pci->metrics.characterWidth;
|
||||
}
|
||||
(*pDrawable->pScreen->DestroyPixmap)(pPixmap);
|
||||
DEALLOCATE_LOCAL(pbits);
|
||||
xfree(pbits);
|
||||
FreeScratchGC(pGCtmp);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,12 +104,12 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
|
|||
dy = ymax - ymin + 1;
|
||||
if ((count < 3) || (dy < 0))
|
||||
return(TRUE);
|
||||
ptsOut = FirstPoint = (DDXPointPtr )ALLOCATE_LOCAL(sizeof(DDXPointRec)*dy);
|
||||
width = FirstWidth = (int *)ALLOCATE_LOCAL(sizeof(int) * dy);
|
||||
ptsOut = FirstPoint = (DDXPointPtr )xalloc(sizeof(DDXPointRec)*dy);
|
||||
width = FirstWidth = (int *)xalloc(sizeof(int) * dy);
|
||||
if(!FirstPoint || !FirstWidth)
|
||||
{
|
||||
if (FirstWidth) DEALLOCATE_LOCAL(FirstWidth);
|
||||
if (FirstPoint) DEALLOCATE_LOCAL(FirstPoint);
|
||||
if (FirstWidth) xfree(FirstWidth);
|
||||
if (FirstPoint) xfree(FirstPoint);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -174,8 +174,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
|
|||
/* in case we're called with non-convex polygon */
|
||||
if(i < 0)
|
||||
{
|
||||
DEALLOCATE_LOCAL(FirstWidth);
|
||||
DEALLOCATE_LOCAL(FirstPoint);
|
||||
xfree(FirstWidth);
|
||||
xfree(FirstPoint);
|
||||
return(TRUE);
|
||||
}
|
||||
while (i-- > 0)
|
||||
|
@ -209,8 +209,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
|
|||
(*pgc->ops->FillSpans)(dst, pgc,
|
||||
ptsOut-FirstPoint,FirstPoint,FirstWidth,
|
||||
1);
|
||||
DEALLOCATE_LOCAL(FirstWidth);
|
||||
DEALLOCATE_LOCAL(FirstPoint);
|
||||
xfree(FirstWidth);
|
||||
xfree(FirstPoint);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,13 +92,13 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
|||
return(TRUE);
|
||||
|
||||
if(!(pETEs = (EdgeTableEntry *)
|
||||
ALLOCATE_LOCAL(sizeof(EdgeTableEntry) * count)))
|
||||
xalloc(sizeof(EdgeTableEntry) * count)))
|
||||
return(FALSE);
|
||||
ptsOut = FirstPoint;
|
||||
width = FirstWidth;
|
||||
if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
|
||||
{
|
||||
DEALLOCATE_LOCAL(pETEs);
|
||||
xfree(pETEs);
|
||||
return(FALSE);
|
||||
}
|
||||
pSLL = ET.scanlines.next;
|
||||
|
@ -224,7 +224,7 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
|
|||
* Get any spans that we missed by buffering
|
||||
*/
|
||||
(*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1);
|
||||
DEALLOCATE_LOCAL(pETEs);
|
||||
xfree(pETEs);
|
||||
miFreeStorage(SLLBlock.next);
|
||||
return(TRUE);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
|
|||
DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
|
||||
ValidateGC(pDrawable, pGC);
|
||||
}
|
||||
if(!(pwidthInit = (int *)ALLOCATE_LOCAL(npt * sizeof(int))))
|
||||
if(!(pwidthInit = (int *)xalloc(npt * sizeof(int))))
|
||||
return;
|
||||
pwidth = pwidthInit;
|
||||
for(i = 0; i < npt; i++)
|
||||
|
@ -118,6 +118,6 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
|
|||
DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
|
||||
ValidateGC(pDrawable, pGC);
|
||||
}
|
||||
DEALLOCATE_LOCAL(pwidthInit);
|
||||
xfree(pwidthInit);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
|
|||
offset2 = pGC->lineWidth;
|
||||
offset1 = offset2 >> 1;
|
||||
offset3 = offset2 - offset1;
|
||||
tmp = (xRectangle *) ALLOCATE_LOCAL(ntmp * sizeof (xRectangle));
|
||||
tmp = (xRectangle *) xalloc(ntmp * sizeof (xRectangle));
|
||||
if (!tmp)
|
||||
return;
|
||||
t = tmp;
|
||||
|
@ -162,7 +162,7 @@ miPolyRectangle(pDraw, pGC, nrects, pRects)
|
|||
}
|
||||
}
|
||||
(*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
|
||||
DEALLOCATE_LOCAL ((pointer) tmp);
|
||||
xfree ((pointer) tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -528,7 +528,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
|
|||
xfree(points);
|
||||
xfree(widths);
|
||||
xfree(yspans);
|
||||
xfree(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */
|
||||
xfree(ysizes); /* use (DE)xalloc for these? */
|
||||
}
|
||||
|
||||
spanGroup->count = 0;
|
||||
|
|
|
@ -95,13 +95,13 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
|
|||
|
||||
if (!spanData)
|
||||
{
|
||||
pptInit = (DDXPointPtr) ALLOCATE_LOCAL (overall_height * sizeof(*ppt));
|
||||
pptInit = (DDXPointPtr) xalloc (overall_height * sizeof(*ppt));
|
||||
if (!pptInit)
|
||||
return;
|
||||
pwidthInit = (int *) ALLOCATE_LOCAL (overall_height * sizeof(*pwidth));
|
||||
pwidthInit = (int *) xalloc (overall_height * sizeof(*pwidth));
|
||||
if (!pwidthInit)
|
||||
{
|
||||
DEALLOCATE_LOCAL (pptInit);
|
||||
xfree (pptInit);
|
||||
return;
|
||||
}
|
||||
ppt = pptInit;
|
||||
|
@ -167,8 +167,8 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
|
|||
if (!spanData)
|
||||
{
|
||||
(*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE);
|
||||
DEALLOCATE_LOCAL (pwidthInit);
|
||||
DEALLOCATE_LOCAL (pptInit);
|
||||
xfree (pwidthInit);
|
||||
xfree (pptInit);
|
||||
if (pixel != oldPixel)
|
||||
{
|
||||
DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
|
||||
|
@ -1045,13 +1045,13 @@ miLineArc (
|
|||
}
|
||||
if (!spanData)
|
||||
{
|
||||
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * pGC->lineWidth);
|
||||
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
|
||||
if (!points)
|
||||
return;
|
||||
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * pGC->lineWidth);
|
||||
widths = (int *)xalloc(sizeof(int) * pGC->lineWidth);
|
||||
if (!widths)
|
||||
{
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(points);
|
||||
return;
|
||||
}
|
||||
oldPixel = pGC->fgPixel;
|
||||
|
@ -1086,8 +1086,8 @@ miLineArc (
|
|||
if (!spanData)
|
||||
{
|
||||
(*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE);
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(widths);
|
||||
xfree(points);
|
||||
if (pixel != oldPixel)
|
||||
{
|
||||
DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);
|
||||
|
|
|
@ -744,7 +744,7 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
|
|||
dospans = (pGC->fillStyle != FillSolid);
|
||||
if (dospans)
|
||||
{
|
||||
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * numPts);
|
||||
widths = (int *)xalloc(sizeof(int) * numPts);
|
||||
if (!widths)
|
||||
return;
|
||||
maxw = 0;
|
||||
|
@ -761,12 +761,12 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
|
|||
(unsigned char *) pGC->dash, (int)pGC->numInDashList,
|
||||
&dinfo.dashOffsetInit);
|
||||
}
|
||||
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * numPts);
|
||||
points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * numPts);
|
||||
if (!points)
|
||||
{
|
||||
if (dospans)
|
||||
{
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
xfree(widths);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -843,9 +843,9 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
|
|||
}
|
||||
}
|
||||
}
|
||||
DEALLOCATE_LOCAL(points);
|
||||
xfree(points);
|
||||
if (dospans)
|
||||
{
|
||||
DEALLOCATE_LOCAL(widths);
|
||||
xfree(widths);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,8 +155,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
|
|||
width = xright - xleft + 1;
|
||||
height = ybottom - ytop + 1;
|
||||
list_len = (height >= width) ? height : width;
|
||||
pspanInit = (DDXPointPtr)ALLOCATE_LOCAL(list_len * sizeof(DDXPointRec));
|
||||
pwidthInit = (int *)ALLOCATE_LOCAL(list_len * sizeof(int));
|
||||
pspanInit = (DDXPointPtr)xalloc(list_len * sizeof(DDXPointRec));
|
||||
pwidthInit = (int *)xalloc(list_len * sizeof(int));
|
||||
if (!pspanInit || !pwidthInit)
|
||||
return;
|
||||
|
||||
|
@ -359,8 +359,8 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
|
|||
(*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit,
|
||||
pwidthInit, FALSE);
|
||||
|
||||
DEALLOCATE_LOCAL(pwidthInit);
|
||||
DEALLOCATE_LOCAL(pspanInit);
|
||||
xfree(pwidthInit);
|
||||
xfree(pspanInit);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
|
|
Loading…
Reference in New Issue
Block a user