From 733d42065f2c24505b3874ce51c18f6063c2b67e Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 5 Nov 2007 14:11:59 +0000 Subject: [PATCH] XFree86: Remove usage of alloca Replace with heap allocations. --- hw/xfree86/common/xf86Configure.c | 2 +- hw/xfree86/common/xf86sbusBus.c | 4 ++-- hw/xfree86/common/xf86xv.c | 4 ++-- hw/xfree86/dixmods/extmod/xf86vmode.c | 16 +++++++------- hw/xfree86/modes/xf86RandR12.c | 26 +++++++++++------------ hw/xfree86/shadowfb/shadow.c | 6 +++--- hw/xfree86/vgahw/vgaCmap.c | 12 +++++------ hw/xfree86/xaa/xaaBitBlt.c | 4 ++-- hw/xfree86/xaa/xaaCpyArea.c | 26 +++++++++++------------ hw/xfree86/xaa/xaaCpyWin.c | 4 ++-- hw/xfree86/xaa/xaaNonTEText.c | 4 ++-- hw/xfree86/xaa/xaaOverlay.c | 4 ++-- hw/xfree86/xaa/xaaOverlayDF.c | 8 +++---- hw/xfree86/xaa/xaaPCache.c | 16 +++++++------- hw/xfree86/xaa/xaaPict.c | 4 ++-- hw/xfree86/xaa/xaaTEGlyph.c | 8 +++---- hw/xfree86/xf4bpp/mfbimggblt.c | 4 ++-- hw/xfree86/xf4bpp/ppcCpArea.c | 30 +++++++++++++-------------- hw/xfree86/xf4bpp/ppcFillRct.c | 4 ++-- hw/xfree86/xf4bpp/ppcImg.c | 4 ++-- hw/xfree86/xf4bpp/ppcPixFS.c | 22 ++++++++++---------- hw/xfree86/xf4bpp/ppcWinFS.c | 22 ++++++++++---------- hw/xfree86/xf4bpp/ppcWindow.c | 6 +++--- hw/xfree86/xf8_32bpp/cfbcpyarea.c | 26 +++++++++++------------ hw/xfree86/xf8_32bpp/cfbwindow.c | 4 ++-- 25 files changed, 135 insertions(+), 135 deletions(-) diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 4c980a291..f896c29aa 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -823,7 +823,7 @@ DoConfigure() homebuf[PATH_MAX-1] = '\0'; home = homebuf; if (!(filename = - (char *)ALLOCATE_LOCAL(strlen(home) + + (char *)xalloc(strlen(home) + strlen(configfile) + 3))) if (home[0] == '/' && home[1] == '\0') diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c index 2e06ffac4..af2cd4a4c 100644 --- a/hw/xfree86/common/xf86sbusBus.c +++ b/hw/xfree86/common/xf86sbusBus.c @@ -622,7 +622,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, int i, index; sbusCmapPtr cmap; struct fbcmap fbcmap; - unsigned char *data = ALLOCATE_LOCAL(numColors*3); + unsigned char *data = xalloc(numColors*3); cmap = SBUSCMAPPTR(pScrn->pScreen); if (!cmap) return; @@ -643,7 +643,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, fbcmap.blue[fbcmap.count++] = colors[index].blue; } ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap); - DEALLOCATE_LOCAL(data); + xfree(data); } static Bool diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index 6abe31c2f..eac0d7e2c 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -1856,7 +1856,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes) REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y); - rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle)); + rects = xalloc(nbox * sizeof(xRectangle)); for(i = 0; i < nbox; i++, pbox++) { rects[i].x = pbox->x1; @@ -1869,7 +1869,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes) if (!pPriv) FreeGC(pGC, 0); - DEALLOCATE_LOCAL(rects); + xfree(rects); } _X_EXPORT void diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c index 44ec9f11d..3b054a829 100644 --- a/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -1323,14 +1323,14 @@ ProcXF86VidModeGetMonitor(ClientPtr client) rep.sequenceNumber = client->sequence; rep.nhsync = nHsync; rep.nvsync = nVrefresh; - hsyncdata = ALLOCATE_LOCAL(nHsync * sizeof(CARD32)); + hsyncdata = xalloc(nHsync * sizeof(CARD32)); if (!hsyncdata) { return BadAlloc; } - vsyncdata = ALLOCATE_LOCAL(nVrefresh * sizeof(CARD32)); + vsyncdata = xalloc(nVrefresh * sizeof(CARD32)); if (!vsyncdata) { - DEALLOCATE_LOCAL(hsyncdata); + xfree(hsyncdata); return BadAlloc; } @@ -1363,8 +1363,8 @@ ProcXF86VidModeGetMonitor(ClientPtr client) if (rep.modelLength) WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr); - DEALLOCATE_LOCAL(hsyncdata); - DEALLOCATE_LOCAL(vsyncdata); + xfree(hsyncdata); + xfree(vsyncdata); return (client->noClientException); } @@ -1448,11 +1448,11 @@ ProcXF86VidModeGetDotClocks(ClientPtr client) rep.flags = 0; if (!ClockProg) { - Clocks = ALLOCATE_LOCAL(numClocks * sizeof(int)); + Clocks = xalloc(numClocks * sizeof(int)); if (!Clocks) return BadValue; if (!VidModeGetClocks(stuff->screen, Clocks)) { - DEALLOCATE_LOCAL(Clocks); + xfree(Clocks); return BadValue; } } @@ -1479,7 +1479,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client) } } - DEALLOCATE_LOCAL(Clocks); + xfree(Clocks); return (client->noClientException); } diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 7169f74c8..fe21717f1 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -636,7 +636,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) DisplayModePtr mode = &crtc->mode; Bool ret; - randr_outputs = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr)); + randr_outputs = xalloc(config->num_output * sizeof (RROutputPtr)); if (!randr_outputs) return FALSE; x = crtc->x; @@ -671,7 +671,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) } ret = RRCrtcNotify (randr_crtc, randr_mode, x, y, rotation, numOutputs, randr_outputs); - DEALLOCATE_LOCAL(randr_outputs); + xfree(randr_outputs); return ret; } @@ -726,7 +726,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, xf86CrtcPtr *save_crtcs; Bool save_enabled = crtc->enabled; - save_crtcs = ALLOCATE_LOCAL(config->num_output * sizeof (xf86CrtcPtr)); + save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr)); if ((randr_mode != NULL) != crtc->enabled) changed = TRUE; else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode)) @@ -782,7 +782,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, xf86OutputPtr output = config->output[o]; output->crtc = save_crtcs[o]; } - DEALLOCATE_LOCAL(save_crtcs); + xfree(save_crtcs); return FALSE; } /* @@ -795,7 +795,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, } xf86DisableUnusedFunctions (pScrn); } - DEALLOCATE_LOCAL(save_crtcs); + xfree(save_crtcs); return xf86RandR12CrtcNotify (randr_crtc); } @@ -938,8 +938,8 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen) RRCrtcPtr randr_crtc; int nclone; - clones = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr)); - crtcs = ALLOCATE_LOCAL (config->num_crtc * sizeof (RRCrtcPtr)); + clones = xalloc(config->num_output * sizeof (RROutputPtr)); + crtcs = xalloc (config->num_crtc * sizeof (RRCrtcPtr)); for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -956,8 +956,8 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen) if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc)) { - DEALLOCATE_LOCAL (crtcs); - DEALLOCATE_LOCAL (clones); + xfree (crtcs); + xfree (clones); return FALSE; } @@ -993,13 +993,13 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen) } if (!RROutputSetClones (output->randr_output, clones, nclone)) { - DEALLOCATE_LOCAL (crtcs); - DEALLOCATE_LOCAL (clones); + xfree (crtcs); + xfree (clones); return FALSE; } } - DEALLOCATE_LOCAL (crtcs); - DEALLOCATE_LOCAL (clones); + xfree (crtcs); + xfree (clones); return TRUE; } diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c index 3511a635e..52fdcbef6 100644 --- a/hw/xfree86/shadowfb/shadow.c +++ b/hw/xfree86/shadowfb/shadow.c @@ -1035,7 +1035,7 @@ ShadowPolyRectangle( offset1 = offset2 >> 1; offset3 = offset2 - offset1; - pBoxInit = (BoxPtr)ALLOCATE_LOCAL(nRects * 4 * sizeof(BoxRec)); + pBoxInit = (BoxPtr)xalloc(nRects * 4 * sizeof(BoxRec)); pbox = pBoxInit; while(nRects--) { @@ -1086,7 +1086,7 @@ ShadowPolyRectangle( if(pPriv->preRefresh) (*pPriv->preRefresh)(pPriv->pScrn, num, pBoxInit); } else { - DEALLOCATE_LOCAL(pBoxInit); + xfree(pBoxInit); } } } @@ -1098,7 +1098,7 @@ ShadowPolyRectangle( } else if(num) { if(pPriv->postRefresh) (*pPriv->postRefresh)(pPriv->pScrn, num, pBoxInit); - DEALLOCATE_LOCAL(pBoxInit); + xfree(pBoxInit); } SHADOW_GC_OP_EPILOGUE(pGC); diff --git a/hw/xfree86/vgahw/vgaCmap.c b/hw/xfree86/vgahw/vgaCmap.c index 609376a57..44043c6c7 100644 --- a/hw/xfree86/vgahw/vgaCmap.c +++ b/hw/xfree86/vgahw/vgaCmap.c @@ -236,9 +236,9 @@ vgaInstallColormap(pmap) else entries = pmap->pVisual->ColormapEntries; - ppix = (Pixel *)ALLOCATE_LOCAL( entries * sizeof(Pixel)); - prgb = (xrgb *)ALLOCATE_LOCAL( entries * sizeof(xrgb)); - defs = (xColorItem *)ALLOCATE_LOCAL(entries * sizeof(xColorItem)); + ppix = (Pixel *)xalloc( entries * sizeof(Pixel)); + prgb = (xrgb *)xalloc( entries * sizeof(xrgb)); + defs = (xColorItem *)xalloc(entries * sizeof(xColorItem)); if ( oldmap != NOMAPYET) WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid); @@ -261,9 +261,9 @@ vgaInstallColormap(pmap) WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid); - DEALLOCATE_LOCAL(ppix); - DEALLOCATE_LOCAL(prgb); - DEALLOCATE_LOCAL(defs); + xfree(ppix); + xfree(prgb); + xfree(defs); } diff --git a/hw/xfree86/xaa/xaaBitBlt.c b/hw/xfree86/xaa/xaaBitBlt.c index 6c81f6413..ebba74e55 100644 --- a/hw/xfree86/xaa/xaaBitBlt.c +++ b/hw/xfree86/xaa/xaaBitBlt.c @@ -186,7 +186,7 @@ XAABitBlt( /* 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) @@ -201,7 +201,7 @@ XAABitBlt( } (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); } prgnExposed = NULL; diff --git a/hw/xfree86/xaa/xaaCpyArea.c b/hw/xfree86/xaa/xaaCpyArea.c index 89b4441ab..6c991e100 100644 --- a/hw/xfree86/xaa/xaaCpyArea.c +++ b/hw/xfree86/xaa/xaaCpyArea.c @@ -108,12 +108,12 @@ XAADoBitBlt( 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; @@ -145,14 +145,14 @@ XAADoBitBlt( 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; } @@ -183,12 +183,12 @@ XAADoBitBlt( xdir, ydir, pGC->alu, pGC->planemask); 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/hw/xfree86/xaa/xaaCpyWin.c b/hw/xfree86/xaa/xaaCpyWin.c index 1ff955c6c..ecdc9a3be 100644 --- a/hw/xfree86/xaa/xaaCpyWin.c +++ b/hw/xfree86/xaa/xaaCpyWin.c @@ -59,7 +59,7 @@ XAACopyWindow( pbox = REGION_RECTS(&rgnDst); nbox = REGION_NUM_RECTS(&rgnDst); if(!nbox || - !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { + !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) { REGION_UNINIT(pScreen, &rgnDst); return; } @@ -77,6 +77,6 @@ XAACopyWindow( XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, &(infoRec->ScratchGC), &rgnDst, pptSrc); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); REGION_UNINIT(pScreen, &rgnDst); } diff --git a/hw/xfree86/xaa/xaaNonTEText.c b/hw/xfree86/xaa/xaaNonTEText.c index a5608c922..d4661e879 100644 --- a/hw/xfree86/xaa/xaaNonTEText.c +++ b/hw/xfree86/xaa/xaaNonTEText.c @@ -291,7 +291,7 @@ PolyGlyphBltAsSingleBitmap ( pitch = (Right - Left + 31) >> 5; size = (pitch << 2) * (Bottom - Top); - block = (CARD32*)ALLOCATE_LOCAL(size); + block = (CARD32*)xalloc(size); bzero(block, size); topLine = 10000; botLine = -10000; @@ -350,7 +350,7 @@ PolyGlyphBltAsSingleBitmap ( nbox--; pbox++; } - DEALLOCATE_LOCAL(block); + xfree(block); } static void diff --git a/hw/xfree86/xaa/xaaOverlay.c b/hw/xfree86/xaa/xaaOverlay.c index 86b30ff22..273183e10 100644 --- a/hw/xfree86/xaa/xaaOverlay.c +++ b/hw/xfree86/xaa/xaaOverlay.c @@ -69,7 +69,7 @@ XAACopyWindow8_32( pbox = REGION_RECTS(&rgnDst); nbox = REGION_NUM_RECTS(&rgnDst); if(!nbox || - !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { + !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) { REGION_UNINIT(pScreen, &rgnDst); return; } @@ -87,7 +87,7 @@ XAACopyWindow8_32( XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, &(infoRec->ScratchGC), &rgnDst, pptSrc); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); REGION_UNINIT(pScreen, &rgnDst); if(freeReg) REGION_DESTROY(pScreen, borderClip); diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c index bf910982a..47599d7d3 100644 --- a/hw/xfree86/xaa/xaaOverlayDF.c +++ b/hw/xfree86/xaa/xaaOverlayDF.c @@ -358,7 +358,7 @@ XAAOverCopyWindow( nbox = REGION_NUM_RECTS(&rgnDst); if(nbox && - (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { + (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) { pbox = REGION_RECTS(&rgnDst); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { @@ -376,7 +376,7 @@ XAAOverCopyWindow( &(infoRec->ScratchGC), &rgnDst, pptSrc); } - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); } REGION_UNINIT(pScreen, &rgnDst); @@ -388,7 +388,7 @@ XAAOverCopyWindow( REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc); nbox = REGION_NUM_RECTS(&rgnDst); if(nbox && - (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))){ + (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))){ pbox = REGION_RECTS(&rgnDst); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { @@ -399,7 +399,7 @@ XAAOverCopyWindow( SWITCH_DEPTH(pScrn->depth); XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot, &(infoRec->ScratchGC), &rgnDst, pptSrc); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); } } REGION_UNINIT(pScreen, &rgnDst); diff --git a/hw/xfree86/xaa/xaaPCache.c b/hw/xfree86/xaa/xaaPCache.c index 441788cd8..d05aaf22c 100644 --- a/hw/xfree86/xaa/xaaPCache.c +++ b/hw/xfree86/xaa/xaaPCache.c @@ -1557,7 +1557,7 @@ XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix) pad = BitmapBytePad(pCache->w * bpp); dwords = pad >> 2; - dstPtr = data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h); + dstPtr = data = (unsigned char*)xalloc(pad * pCache->h); srcPtr = (unsigned char*)pPix->devPrivate.ptr; if(infoRec->ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) @@ -1588,7 +1588,7 @@ XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix) pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data, pad, bpp, pScrn->depth); - DEALLOCATE_LOCAL(data); + xfree(data); return pCache; } @@ -1967,7 +1967,7 @@ XAAWriteMono8x8PatternToCache( pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel); - data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h); + data = (unsigned char*)xalloc(pad * pCache->h); if(!data) return; if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) { @@ -1991,7 +1991,7 @@ XAAWriteMono8x8PatternToCache( (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth); - DEALLOCATE_LOCAL(data); + xfree(data); } void @@ -2012,7 +2012,7 @@ XAAWriteColor8x8PatternToCache( if(pixPriv->flags & REDUCIBLE_TO_2_COLOR) { CARD32* ptr; pad = BitmapBytePad(pCache->w); - data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h); + data = (unsigned char*)xalloc(pad * pCache->h); if(!data) return; if(infoRec->Color8x8PatternFillFlags & @@ -2037,7 +2037,7 @@ XAAWriteColor8x8PatternToCache( (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data, pad, pCache->fg, pCache->bg); - DEALLOCATE_LOCAL(data); + xfree(data); return; } @@ -2046,7 +2046,7 @@ XAAWriteColor8x8PatternToCache( w = min(8,pPix->drawable.width); pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel); - data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h); + data = (unsigned char*)xalloc(pad * pCache->h); if(!data) return; /* Write and expand horizontally. */ @@ -2085,7 +2085,7 @@ XAAWriteColor8x8PatternToCache( (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth); - DEALLOCATE_LOCAL(data); + xfree(data); } diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c index 55f0f6e99..74e90e3b6 100644 --- a/hw/xfree86/xaa/xaaPict.c +++ b/hw/xfree86/xaa/xaaPict.c @@ -471,7 +471,7 @@ XAACompositeSrcCopy (PicturePtr pSrc, REGION_UNINIT(pScreen, ®ion); return; } - pptSrc = ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); + pptSrc = xalloc(sizeof(DDXPointRec) * nbox); if (!pptSrc) { REGION_UNINIT(pScreen, ®ion); return; @@ -489,7 +489,7 @@ XAACompositeSrcCopy (PicturePtr pSrc, XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, ®ion, pptSrc); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); REGION_UNINIT(pScreen, ®ion); return; } diff --git a/hw/xfree86/xaa/xaaTEGlyph.c b/hw/xfree86/xaa/xaaTEGlyph.c index c8d65968b..cb60266ea 100644 --- a/hw/xfree86/xaa/xaaTEGlyph.c +++ b/hw/xfree86/xaa/xaaTEGlyph.c @@ -301,7 +301,7 @@ EXPNAME(XAATEGlyphRenderer3)( } dwords = ((3 * w + 31) >> 5) * h; - mem = (CARD32*)ALLOCATE_LOCAL(((w + 31) >> 3) * sizeof(char)); + mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char)); if (!mem) return; (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0); @@ -321,7 +321,7 @@ EXPNAME(XAATEGlyphRenderer3)( DrawTextScanline3(base, mem, w); } - DEALLOCATE_LOCAL(mem); + xfree(mem); if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && (dwords & 1)) { @@ -478,7 +478,7 @@ EXPNAME(XAATEGlyphRendererScanline3)( w += skipleft; x -= skipleft; - mem = (CARD32*)ALLOCATE_LOCAL(((w + 31) >> 3) * sizeof(char)); + mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char)); if (!mem) return; (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)( @@ -495,7 +495,7 @@ EXPNAME(XAATEGlyphRendererScanline3)( bufferNo = 0; } - DEALLOCATE_LOCAL(mem); + xfree(mem); THE_END: diff --git a/hw/xfree86/xf4bpp/mfbimggblt.c b/hw/xfree86/xf4bpp/mfbimggblt.c index bf53f4ce9..73e7ce064 100644 --- a/hw/xfree86/xf4bpp/mfbimggblt.c +++ b/hw/xfree86/xf4bpp/mfbimggblt.c @@ -355,7 +355,7 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop) int getWidth; /* bits to get from glyph */ #endif - if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS)))) + if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS)))) return; pdstBase = pdstBase + (widthDst * y) + (x >> PWSH); @@ -494,7 +494,7 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop) } } /* for each glyph */ } /* while nbox-- */ - DEALLOCATE_LOCAL(ppos); + xfree(ppos); break; } default: diff --git a/hw/xfree86/xf4bpp/ppcCpArea.c b/hw/xfree86/xf4bpp/ppcCpArea.c index 891ba4b89..9bdaf89e3 100644 --- a/hw/xfree86/xf4bpp/ppcCpArea.c +++ b/hw/xfree86/xf4bpp/ppcCpArea.c @@ -110,13 +110,13 @@ vga16DoBitblt 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; @@ -146,16 +146,16 @@ vga16DoBitblt 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; } @@ -207,13 +207,13 @@ vga16DoBitblt } if (pboxNew2) { - DEALLOCATE_LOCAL(pptNew2); - DEALLOCATE_LOCAL(pboxNew2); + xfree(pptNew2); + xfree(pboxNew2); } if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); + xfree(pptNew1); + xfree(pboxNew1); } } @@ -430,7 +430,7 @@ int dstx, dsty; 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); @@ -448,7 +448,7 @@ int dstx, dsty; vga16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask ); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); } prgnExposed = NULL; diff --git a/hw/xfree86/xf4bpp/ppcFillRct.c b/hw/xfree86/xf4bpp/ppcFillRct.c index 4be732fb5..3422c8092 100644 --- a/hw/xfree86/xf4bpp/ppcFillRct.c +++ b/hw/xfree86/xf4bpp/ppcFillRct.c @@ -106,7 +106,7 @@ xf4bppPolyFillRect(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; } @@ -211,5 +211,5 @@ xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit) xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase, pboxClippedBase, pGC); if (pboxClippedBase != stackRects) - DEALLOCATE_LOCAL(pboxClippedBase); + xfree(pboxClippedBase); } diff --git a/hw/xfree86/xf4bpp/ppcImg.c b/hw/xfree86/xf4bpp/ppcImg.c index 39d39c4a9..33c6b89c5 100644 --- a/hw/xfree86/xf4bpp/ppcImg.c +++ b/hw/xfree86/xf4bpp/ppcImg.c @@ -86,7 +86,7 @@ xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) DoChangeGC( pGC, GCPlaneMask | GCFunction, gcv, 0 ) ; ValidateGC( (DrawablePtr)pPixmap, pGC ) ; - pbits = (char *)ALLOCATE_LOCAL(w); + pbits = (char *)xalloc(w); for ( i = 0 ; i < h ; i++ ) { pt.x = sx ; @@ -102,7 +102,7 @@ xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) pDst += linelength ; } - DEALLOCATE_LOCAL(pbits) ; + xfree(pbits) ; (* pGC->pScreen->DestroyPixmap)( pPixmap ) ; FreeScratchGC( pGC ) ; return ; diff --git a/hw/xfree86/xf4bpp/ppcPixFS.c b/hw/xfree86/xf4bpp/ppcPixFS.c index f24168bb0..dfc648660 100644 --- a/hw/xfree86/xf4bpp/ppcPixFS.c +++ b/hw/xfree86/xf4bpp/ppcPixFS.c @@ -128,13 +128,13 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) return ; n = nInit * miFindMaxBand(pGC->pCompositeClip) ; - if ( !( pwidthFree = (int *) ALLOCATE_LOCAL( n * sizeof( int ) ) ) ) + if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) ) return ; pwidth = pwidthFree ; if ( !( pptFree = (DDXPointRec *) - ALLOCATE_LOCAL( n * sizeof( DDXPointRec ) ) ) ) { - DEALLOCATE_LOCAL( pwidth ) ; + xalloc( n * sizeof( DDXPointRec ) ) ) ) { + xfree( pwidth ) ; return ; } ppt = pptFree ; @@ -160,8 +160,8 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) *addrl = ( *addrl & npm ) | ( pm & DoRop( alu, fg, *addrl ) ) ; #endif /* PURDUE */ } - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } @@ -316,8 +316,8 @@ int fSorted ; ppt++ ; pwidth++ ; } - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } @@ -416,8 +416,8 @@ int fSorted ; #endif /* PURDUE */ } } - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } @@ -496,7 +496,7 @@ int fSorted ; #endif /* PURDUE */ } } - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } diff --git a/hw/xfree86/xf4bpp/ppcWinFS.c b/hw/xfree86/xf4bpp/ppcWinFS.c index e19ce0d40..78001d793 100644 --- a/hw/xfree86/xf4bpp/ppcWinFS.c +++ b/hw/xfree86/xf4bpp/ppcWinFS.c @@ -100,13 +100,13 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) return ; n = nInit * miFindMaxBand( pGC->pCompositeClip ) ; - if ( !( pwidthFree = (int *) ALLOCATE_LOCAL( n * sizeof( int ) ) ) ) + if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) ) return ; pwidth = pwidthFree ; if ( !( pptFree = (DDXPointRec *) - ALLOCATE_LOCAL( n * sizeof( DDXPointRec ) ) ) ) { - DEALLOCATE_LOCAL( pwidth ) ; + xalloc( n * sizeof( DDXPointRec ) ) ) ) { + xfree( pwidth ) ; return ; } ppt = pptFree ; @@ -122,8 +122,8 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) xf4bppFillSolid( (WindowPtr)pDrawable, fg, alu, pm, ppt->x, ppt->y, *pwidth, 1 ) ; - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } @@ -180,8 +180,8 @@ int fSorted ; xf4bppFillStipple( (WindowPtr)pDrawable, pTile, fg, alu, pm, ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ; - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } @@ -232,8 +232,8 @@ int fSorted ; xf4bppOpaqueStipple( (WindowPtr)pDrawable, pGC->stipple, fg, bg, alu, pm, ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ; - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } @@ -274,7 +274,7 @@ int fSorted ; xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm, ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ; - DEALLOCATE_LOCAL( pptFree ) ; - DEALLOCATE_LOCAL( pwidthFree ) ; + xfree( pptFree ) ; + xfree( pwidthFree ) ; return ; } diff --git a/hw/xfree86/xf4bpp/ppcWindow.c b/hw/xfree86/xf4bpp/ppcWindow.c index 8261af183..6165e04b6 100644 --- a/hw/xfree86/xf4bpp/ppcWindow.c +++ b/hw/xfree86/xf4bpp/ppcWindow.c @@ -123,7 +123,7 @@ xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc) /* walk source bottom to top */ /* keep ordering in each band, reverse order of bands */ if ( !( pboxNew = - (BoxPtr) ALLOCATE_LOCAL( sizeof( BoxRec ) * nbox ) ) ) + (BoxPtr) xalloc( sizeof( BoxRec ) * nbox ) ) ) return ; pboxBase = pboxNext = pbox+nbox - 1 ; while ( pboxBase >= pbox ) { @@ -158,7 +158,7 @@ xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc) else if ( dx < 0 ) { /* walk source right to left */ /* reverse order of rects in each band */ - if ( !( pboxNew = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox) ) ) + if ( !( pboxNew = (BoxPtr)xalloc(sizeof(BoxRec) * nbox) ) ) return ; pboxBase = pboxNext = pbox ; while (pboxBase < pbox+nbox) @@ -190,7 +190,7 @@ xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc) /* free up stuff */ if ( pboxNew ) - DEALLOCATE_LOCAL( pboxNew ) ; + xfree( pboxNew ) ; REGION_DESTROY(pWin->drawable.pScreen, prgnDst); } diff --git a/hw/xfree86/xf8_32bpp/cfbcpyarea.c b/hw/xfree86/xf8_32bpp/cfbcpyarea.c index c2eb1a04e..d8f0c6d76 100644 --- a/hw/xfree86/xf8_32bpp/cfbcpyarea.c +++ b/hw/xfree86/xf8_32bpp/cfbcpyarea.c @@ -433,12 +433,12 @@ cfb8_32DoBitBlt( 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; @@ -470,14 +470,14 @@ cfb8_32DoBitBlt( 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; } @@ -510,12 +510,12 @@ cfb8_32DoBitBlt( (*DoBlt)(SrcPtr,SrcPitch,DstPtr,DstPitch,nbox,pptSrc,pbox,xdir,ydir); 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/hw/xfree86/xf8_32bpp/cfbwindow.c b/hw/xfree86/xf8_32bpp/cfbwindow.c index 787cbdec6..2e6057f12 100644 --- a/hw/xfree86/xf8_32bpp/cfbwindow.c +++ b/hw/xfree86/xf8_32bpp/cfbwindow.c @@ -77,7 +77,7 @@ cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc) pbox = REGION_RECTS(&rgnDst); nbox = REGION_NUM_RECTS(&rgnDst); if(!nbox || - !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) + !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) { REGION_UNINIT(pScreen, &rgnDst); return; @@ -97,7 +97,7 @@ cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc) cfbDoBitblt8To8GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, &rgnDst, pptSrc, ~0); - DEALLOCATE_LOCAL(pptSrc); + xfree(pptSrc); REGION_UNINIT(pScreen, &rgnDst); if(freeReg) REGION_DESTROY(pScreen, borderClip);