From 784c3a1fa53771662b4656e193fb392cbb8c8452 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Tue, 1 May 2012 15:10:39 +0200 Subject: Replace x{{,re,c}alloc,free} with malloc/realloc/calloc/free --- src/apm_dga.c | 2 +- src/apm_driver.c | 20 ++++++++------------ src/apm_funcs.c | 4 ++-- src/apm_video.c | 11 +++++------ 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/apm_dga.c b/src/apm_dga.c index 30079e2..855c08e 100644 --- a/src/apm_dga.c +++ b/src/apm_dga.c @@ -103,7 +103,7 @@ SECOND_PASS: if(secondPitch) pitch = secondPitch; - if(!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)))) + if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec)))) break; modes = newmodes; diff --git a/src/apm_driver.c b/src/apm_driver.c index 078d443..2145207 100644 --- a/src/apm_driver.c +++ b/src/apm_driver.c @@ -189,10 +189,8 @@ ApmGetRec(ScrnInfoPtr pScrn) static void ApmFreeRec(ScrnInfoPtr pScrn) { - if (pScrn->driverPrivate) { - xfree(pScrn->driverPrivate); - pScrn->driverPrivate = NULL; - } + free(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; } @@ -300,7 +298,7 @@ ApmProbe(DriverPtr drv, int flags) } - xfree(DevSections); + free(DevSections); return foundScreen; } @@ -490,7 +488,7 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags) xf86CollectOptions(pScrn, NULL); /* Process the options */ - if (!(pApm->Options = xalloc(sizeof(ApmOptions)))) + if (!(pApm->Options = malloc(sizeof(ApmOptions)))) return FALSE; memcpy(pApm->Options, ApmOptions, sizeof(ApmOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pApm->Options); @@ -1154,7 +1152,7 @@ ApmSave(ScrnInfoPtr pScrn) * Save fonts */ if (!(hwp->SavedReg.Attribute[0x10] & 1)) { - if (pApm->FontInfo || (pApm->FontInfo = (pointer)xalloc(TEXT_AMOUNT))) { + if (pApm->FontInfo || (pApm->FontInfo = malloc(TEXT_AMOUNT))) { int locked; locked = ApmReadSeq(0x10); @@ -1705,7 +1703,7 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if(pApm->ShadowFB) { pApm->ShadowPitch = ((pScrn->virtualX * pScrn->bitsPerPixel >> 3) + 3) & ~3L; - pApm->ShadowPtr = xalloc(pApm->ShadowPitch * pScrn->virtualY); + pApm->ShadowPtr = malloc(pApm->ShadowPitch * pScrn->virtualY); FbBase = pApm->ShadowPtr; } else { pApm->ShadowPtr = NULL; @@ -2003,10 +2001,8 @@ ApmCloseScreen(int scrnIndex, ScreenPtr pScreen) if(pApm->CursorInfoRec) xf86DestroyCursorInfoRec(pApm->CursorInfoRec); pApm->CursorInfoRec = NULL; - if (pApm->DGAModes) - xfree(pApm->DGAModes); - if (pApm->adaptor) - xfree(pApm->adaptor); + free(pApm->DGAModes); + free(pApm->adaptor); pScrn->vtSema = FALSE; diff --git a/src/apm_funcs.c b/src/apm_funcs.c index 48e5ad6..29328d1 100644 --- a/src/apm_funcs.c +++ b/src/apm_funcs.c @@ -702,7 +702,7 @@ A(TEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int w, int h, dwords = (w2 + 31) >> 5; dwords <<= 2; - base0 = base = (CARD32*)xalloc(dwords * h); + base0 = base = malloc(dwords * h); if (!base) return; /* Should not happen : it's rather small... */ @@ -713,7 +713,7 @@ A(TEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int w, int h, A(WriteBitmap)(pScrn, x, y, w, h2, (unsigned char *)base0, dwords, skipleft, fg, bg, rop, planemask); - xfree(base0); + free(base0); } static void A(SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty, diff --git a/src/apm_video.c b/src/apm_video.c index d8b69fb..c87ffd0 100644 --- a/src/apm_video.c +++ b/src/apm_video.c @@ -53,7 +53,7 @@ void A(InitVideo)(ScreenPtr pScreen) if (pApm->Chipset >= AT24) { if ((newAdaptor = A(SetupImageVideo)(pScreen))) { - newAdaptors = xalloc((num_adaptors + 1) * + newAdaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); if(newAdaptors) { if(num_adaptors) @@ -70,8 +70,7 @@ void A(InitVideo)(ScreenPtr pScreen) if(num_adaptors) xf86XVScreenInit(pScreen, adaptors, num_adaptors); - if(freeAdaptors) - xfree(adaptors); + free(adaptors); } #ifndef APM_VIDEO_DEFINES @@ -300,9 +299,9 @@ A(SetupImageVideo)(ScreenPtr pScreen) XF86VideoAdaptorPtr adapt; ApmPortPrivPtr pPriv; - if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + - 2 * sizeof(ApmPortPrivRec) + - 2 * sizeof(DevUnion)))) + if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + + 2 * sizeof(ApmPortPrivRec) + + 2 * sizeof(DevUnion)))) return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; -- cgit v1.2.3