diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-09 18:47:27 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-09 18:47:27 -0700 |
commit | f53f5a192025bec5547c2db16741e2a4eda20d74 (patch) | |
tree | ab944d7870a9e3b7557112044759e3ba3adfffb3 | |
parent | 0c4ffbec23de9a2b0da9310f1dfca50dcc1f7132 (diff) |
Use malloc/calloc/realloc/free directly
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r-- | src/tdfx_accel.c | 4 | ||||
-rw-r--r-- | src/tdfx_dga.c | 4 | ||||
-rw-r--r-- | src/tdfx_dri.c | 36 | ||||
-rw-r--r-- | src/tdfx_driver.c | 26 | ||||
-rw-r--r-- | src/tdfx_priv.c | 4 | ||||
-rw-r--r-- | src/tdfx_video.c | 28 |
6 files changed, 51 insertions, 51 deletions
diff --git a/src/tdfx_accel.c b/src/tdfx_accel.c index 6191aeb..c7aea8c 100644 --- a/src/tdfx_accel.c +++ b/src/tdfx_accel.c @@ -254,8 +254,8 @@ TDFXAccelInit(ScreenPtr pScreen) infoPtr->ScreenToScreenCopyFlags = commonFlags; /* When we're using the fifo we have to use indirect expansion */ - pTDFX->scanlineColorExpandBuffers[0] = xalloc((pScrn->virtualX+62)/32*4); - pTDFX->scanlineColorExpandBuffers[1] = xalloc((pScrn->virtualX+62)/32*4); + pTDFX->scanlineColorExpandBuffers[0] = malloc((pScrn->virtualX+62)/32*4); + pTDFX->scanlineColorExpandBuffers[1] = malloc((pScrn->virtualX+62)/32*4); infoPtr->NumScanlineColorExpandBuffers=2; infoPtr->ScanlineColorExpandBuffers=pTDFX->scanlineColorExpandBuffers; infoPtr->SetupForScanlineCPUToScreenColorExpandFill = diff --git a/src/tdfx_dga.c b/src/tdfx_dga.c index f88c09b..0fae286 100644 --- a/src/tdfx_dga.c +++ b/src/tdfx_dga.c @@ -48,10 +48,10 @@ TDFXDGAInit(ScreenPtr pScreen) pMode = firstMode = pScrn->modes; while (pMode) { - newmodes = xrealloc(modes, (num+1)*sizeof(DGAModeRec)); + newmodes = realloc(modes, (num+1)*sizeof(DGAModeRec)); if (!newmodes) { - xfree(modes); + free(modes); return FALSE; } modes = newmodes; diff --git a/src/tdfx_dri.c b/src/tdfx_dri.c index 220e910..f42e232 100644 --- a/src/tdfx_dri.c +++ b/src/tdfx_dri.c @@ -53,19 +53,19 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) case 16: numConfigs = 16; - if (!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), + if (!(pConfigs = (__GLXvisualConfig*)calloc(sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } - if (!(pTDFXConfigs = (TDFXConfigPrivPtr)xcalloc(sizeof(TDFXConfigPrivRec), + if (!(pTDFXConfigs = (TDFXConfigPrivPtr)calloc(sizeof(TDFXConfigPrivRec), numConfigs))) { - xfree(pConfigs); + free(pConfigs); return FALSE; } - if (!(pTDFXConfigPtrs = (TDFXConfigPrivPtr*)xcalloc(sizeof(TDFXConfigPrivPtr), + if (!(pTDFXConfigPtrs = (TDFXConfigPrivPtr*)calloc(sizeof(TDFXConfigPrivPtr), numConfigs))) { - xfree(pConfigs); - xfree(pTDFXConfigs); + free(pConfigs); + free(pTDFXConfigs); return FALSE; } for (i=0; i<numConfigs; i++) @@ -144,20 +144,20 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) case 32: numConfigs = 8; - pConfigs = (__GLXvisualConfig*) xcalloc(sizeof(__GLXvisualConfig), numConfigs); + pConfigs = (__GLXvisualConfig*) calloc(sizeof(__GLXvisualConfig), numConfigs); if (!pConfigs) return FALSE; - pTDFXConfigs = (TDFXConfigPrivPtr) xcalloc(sizeof(TDFXConfigPrivRec), numConfigs); + pTDFXConfigs = (TDFXConfigPrivPtr) calloc(sizeof(TDFXConfigPrivRec), numConfigs); if (!pTDFXConfigs) { - xfree(pConfigs); + free(pConfigs); return FALSE; } - pTDFXConfigPtrs = (TDFXConfigPrivPtr *) xcalloc(sizeof(TDFXConfigPrivPtr), numConfigs); + pTDFXConfigPtrs = (TDFXConfigPrivPtr *) calloc(sizeof(TDFXConfigPrivPtr), numConfigs); if (!pTDFXConfigPtrs) { - xfree(pConfigs); - xfree(pTDFXConfigs); + free(pConfigs); + free(pTDFXConfigs); return FALSE; } @@ -350,7 +350,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) { pDRIInfo->busIdString = DRICreatePCIBusID(pTDFX->PciInfo); } else { - pDRIInfo->busIdString = xalloc(64); + pDRIInfo->busIdString = malloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", ((pciConfigPtr)pTDFX->PciInfo->thisCard)->busnum, ((pciConfigPtr)pTDFX->PciInfo->thisCard)->devnum, @@ -395,7 +395,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pTDFXDRI = (TDFXDRIPtr)xcalloc(sizeof(TDFXDRIRec),1))) { + if (!(pTDFXDRI = (TDFXDRIPtr)calloc(sizeof(TDFXDRIRec),1))) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRI memory allocation failed, disabling DRI.\n"); DRIDestroyInfoRec(pTDFX->pDRIInfo); @@ -421,7 +421,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) { - xfree(pDRIInfo->devPrivate); + free(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; DRIDestroyInfoRec(pTDFX->pDRIInfo); pTDFX->pDRIInfo=0; @@ -483,14 +483,14 @@ TDFXDRICloseScreen(ScreenPtr pScreen) if (pTDFX->pDRIInfo) { if (pTDFX->pDRIInfo->devPrivate) { - xfree(pTDFX->pDRIInfo->devPrivate); + free(pTDFX->pDRIInfo->devPrivate); pTDFX->pDRIInfo->devPrivate=0; } DRIDestroyInfoRec(pTDFX->pDRIInfo); pTDFX->pDRIInfo=0; } - if (pTDFX->pVisualConfigs) xfree(pTDFX->pVisualConfigs); - if (pTDFX->pVisualConfigsPriv) xfree(pTDFX->pVisualConfigsPriv); + if (pTDFX->pVisualConfigs) free(pTDFX->pVisualConfigs); + if (pTDFX->pVisualConfigsPriv) free(pTDFX->pVisualConfigsPriv); } static Bool diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c index 8935505..673bbc7 100644 --- a/src/tdfx_driver.c +++ b/src/tdfx_driver.c @@ -306,7 +306,7 @@ static void TDFXFreeRec(ScrnInfoPtr pScrn) { if (!pScrn) return; if (!pScrn->driverPrivate) return; - xfree(pScrn->driverPrivate); + free(pScrn->driverPrivate); pScrn->driverPrivate=0; } @@ -429,7 +429,7 @@ TDFXProbe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); - xfree(devSections); + free(devSections); if (numUsed<=0) return FALSE; if (flags & PROBE_DETECT) @@ -457,7 +457,7 @@ TDFXProbe(DriverPtr drv, int flags) foundScreen = TRUE; } } - xfree(usedChips); + free(usedChips); return foundScreen; } @@ -927,7 +927,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) /* Process the options */ xf86CollectOptions(pScrn, NULL); - if (!(pTDFX->Options = xalloc(sizeof(TDFXOptions)))) + if (!(pTDFX->Options = malloc(sizeof(TDFXOptions)))) return FALSE; memcpy(pTDFX->Options, TDFXOptions, sizeof(TDFXOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTDFX->Options); @@ -1682,7 +1682,7 @@ TDFXInitWithBIOSData(ScrnInfoPtr pScrn) } #define T_B_SIZE (64 * 1024) - bios = xcalloc(T_B_SIZE, 1); + bios = calloc(T_B_SIZE, 1); if (!bios) return FALSE; @@ -1692,7 +1692,7 @@ TDFXInitWithBIOSData(ScrnInfoPtr pScrn) if (!xf86ReadPciBIOS(0, pTDFX->PciTag[0], 1, bios, T_B_SIZE)) { #if 0 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Bad BIOS read.\n"); - xfree(bios); + free(bios); return FALSE; #endif } @@ -1700,7 +1700,7 @@ TDFXInitWithBIOSData(ScrnInfoPtr pScrn) if (bios[0] != 0x55 || bios[1] != 0xAA) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Bad BIOS signature.\n"); - xfree(bios); + free(bios); return FALSE; } @@ -1744,7 +1744,7 @@ TDFXInitWithBIOSData(ScrnInfoPtr pScrn) pTDFX->writeLong(pTDFX, MISCINIT0, 0xF3); pTDFX->writeLong(pTDFX, MISCINIT0, uint[1]); - xfree(bios); + free(bios); return TRUE; } #endif @@ -2542,19 +2542,19 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pTDFX->AccelInfoRec) XAADestroyInfoRec(pTDFX->AccelInfoRec); pTDFX->AccelInfoRec=0; - if (pTDFX->DGAModes) xfree(pTDFX->DGAModes); + if (pTDFX->DGAModes) free(pTDFX->DGAModes); pTDFX->DGAModes=0; if (pTDFX->scanlineColorExpandBuffers[0]) - xfree(pTDFX->scanlineColorExpandBuffers[0]); + free(pTDFX->scanlineColorExpandBuffers[0]); pTDFX->scanlineColorExpandBuffers[0]=0; if (pTDFX->scanlineColorExpandBuffers[1]) - xfree(pTDFX->scanlineColorExpandBuffers[1]); + free(pTDFX->scanlineColorExpandBuffers[1]); pTDFX->scanlineColorExpandBuffers[1]=0; if (pTDFX->overlayAdaptor) - xfree(pTDFX->overlayAdaptor); + free(pTDFX->overlayAdaptor); pTDFX->overlayAdaptor=0; if (pTDFX->textureAdaptor) - xfree(pTDFX->textureAdaptor); + free(pTDFX->textureAdaptor); pTDFX->textureAdaptor=0; pScrn->vtSema=FALSE; diff --git a/src/tdfx_priv.c b/src/tdfx_priv.c index 3f3228b..5fca911 100644 --- a/src/tdfx_priv.c +++ b/src/tdfx_priv.c @@ -197,7 +197,7 @@ Bool TDFXInitFifo(ScreenPtr pScreen) #endif pTDFX->fifoBase = (uint32*)(pTDFX->FbBase+pTDFX->fifoOffset); #ifdef DEBUG_FIFO - pTDFX->fifoMirrorBase = xalloc(pTDFX->fifoSize); + pTDFX->fifoMirrorBase = malloc(pTDFX->fifoSize); pTDFX->fifoMirrorPtr = pTDFX->fifoMirrorBase; #endif pTDFX->sync=TDFXSyncFifo; @@ -215,7 +215,7 @@ void TDFXShutdownFifo(ScreenPtr pScreen) TDFXWriteLongMMIO(pTDFX, SST_FIFO_BASESIZE0, 0); pTDFX->sync=TDFXSync; #ifdef DEBUG_FIFO - if (pTDFX->fifoMirrorBase) xfree(pTDFX->fifoMirrorBase); + if (pTDFX->fifoMirrorBase) free(pTDFX->fifoMirrorBase); pTDFX->fifoMirrorBase=0; #endif } diff --git a/src/tdfx_video.c b/src/tdfx_video.c index 22be0d3..733e6c7 100644 --- a/src/tdfx_video.c +++ b/src/tdfx_video.c @@ -151,7 +151,7 @@ void TDFXInitVideo(ScreenPtr pScreen) adaptors = &newAdaptor; } else { newAdaptors = - xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); if(newAdaptors) { memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); @@ -166,7 +166,7 @@ void TDFXInitVideo(ScreenPtr pScreen) xf86XVScreenInit(pScreen, adaptors, num_adaptors); if(newAdaptors) - xfree(newAdaptors); + free(newAdaptors); } @@ -185,9 +185,9 @@ TDFXAllocAdaptor(ScrnInfoPtr pScrn, int numberPorts) if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) return NULL; - if(!(pPriv = xcalloc(1, sizeof(TDFXPortPrivRec) + (numberPorts * sizeof(DevUnion))))) + if(!(pPriv = calloc(1, sizeof(TDFXPortPrivRec) + (numberPorts * sizeof(DevUnion))))) { - xfree(adapt); + free(adapt); return NULL; } @@ -1185,18 +1185,18 @@ TDFXAllocateSurface( surface->width = w; surface->height = h; - if(!(surface->pitches = xalloc(sizeof(int)))) { + if(!(surface->pitches = malloc(sizeof(int)))) { xf86FreeOffscreenLinear(linear); return BadAlloc; } - if(!(surface->offsets = xalloc(sizeof(int)))) { - xfree(surface->pitches); + if(!(surface->offsets = malloc(sizeof(int)))) { + free(surface->pitches); xf86FreeOffscreenLinear(linear); return BadAlloc; } - if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { - xfree(surface->pitches); - xfree(surface->offsets); + if(!(pPriv = malloc(sizeof(OffscreenPrivRec)))) { + free(surface->pitches); + free(surface->offsets); xf86FreeOffscreenLinear(linear); return BadAlloc; } @@ -1239,9 +1239,9 @@ TDFXFreeSurface( if(pPriv->isOn) TDFXStopSurface(surface); xf86FreeOffscreenLinear(pPriv->linear); - xfree(surface->pitches); - xfree(surface->offsets); - xfree(surface->devPrivate.ptr); + free(surface->pitches); + free(surface->offsets); + free(surface->devPrivate.ptr); return Success; } @@ -1332,7 +1332,7 @@ TDFXInitOffscreenImages(ScreenPtr pScreen) XF86OffscreenImagePtr offscreenImages; /* need to free this someplace */ - if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + if(!(offscreenImages = malloc(sizeof(XF86OffscreenImageRec)))) return; offscreenImages[0].image = &OverlayImages[0]; |