[PATCH xf86-video-mach64] Remove libc wrappers for malloc, realloc and free.

Alex Deucher alexdeucher at gmail.com
Wed Jan 19 15:10:57 PST 2011


On Wed, Jan 19, 2011 at 3:35 PM, Cyril Brulebois <kibi at debian.org> wrote:
> Signed-off-by: Cyril Brulebois <kibi at debian.org>

Reviewed-by: Alex Deucher <alexdeucher at gmail.com>

> ---
>  src/aticonfig.c      |    2 +-
>  src/aticonsole.c     |   10 ++++----
>  src/atidga.c         |    2 +-
>  src/atidri.c         |   54 +++++++++++++++++++++++++-------------------------
>  src/atii2c.c         |    8 +++---
>  src/atimach64exa.c   |    2 +-
>  src/atimach64i2c.c   |    2 +-
>  src/atimach64probe.c |    4 +-
>  src/atimach64xv.c    |    8 +++---
>  src/atimode.c        |    2 +-
>  src/atipreinit.c     |    2 +-
>  src/atiscreen.c      |    8 +++---
>  12 files changed, 52 insertions(+), 52 deletions(-)
>
> diff --git a/src/aticonfig.c b/src/aticonfig.c
> index 9102497..621e79e 100644
> --- a/src/aticonfig.c
> +++ b/src/aticonfig.c
> @@ -502,5 +502,5 @@ ATIProcessOptions
>  #endif
>     }
>
> -    xfree(PublicOption);
> +    free(PublicOption);
>  }
> diff --git a/src/aticonsole.c b/src/aticonsole.c
> index 6e742d9..50cc6e1 100644
> --- a/src/aticonsole.c
> +++ b/src/aticonsole.c
> @@ -799,19 +799,19 @@ ATIFreeScreen
>
>  #ifndef AVOID_CPIO
>
> -    xfree(pATI->OldHW.frame_buffer);
> -    xfree(pATI->NewHW.frame_buffer);
> +    free(pATI->OldHW.frame_buffer);
> +    free(pATI->NewHW.frame_buffer);
>
>  #endif /* AVOID_CPIO */
>
> -    xfree(pATI->pShadow);
> +    free(pATI->pShadow);
>
>  #ifndef AVOID_DGA
>
> -    xfree(pATI->pDGAMode);
> +    free(pATI->pDGAMode);
>
>  #endif /* AVOID_DGA */
>
> -    xfree(pATI);
> +    free(pATI);
>     pScreenInfo->driverPrivate = NULL;
>  }
> diff --git a/src/atidga.c b/src/atidga.c
> index fb6d1d7..c1cd163 100644
> --- a/src/atidga.c
> +++ b/src/atidga.c
> @@ -324,7 +324,7 @@ ATIDGAAddModes
>             if ((modePitch * bitsPerPixel * pMode->VDisplay) <= videoBits)
>             {
>                 /* Stop generating modes on out-of-memory conditions */
> -                pDGAMode = xrealloc(pATI->pDGAMode,
> +                pDGAMode = realloc(pATI->pDGAMode,
>                     (pATI->nDGAMode + 1) * SizeOf(DGAModeRec));
>                 if (!pDGAMode)
>                     break;
> diff --git a/src/atidri.c b/src/atidri.c
> index 15d0014..9c6719b 100644
> --- a/src/atidri.c
> +++ b/src/atidri.c
> @@ -109,14 +109,14 @@ static Bool ATIInitVisualConfigs( ScreenPtr pScreen )
>       pATIConfigs = (ATIConfigPrivPtr)
>         xnfcalloc( sizeof(ATIConfigPrivRec), numConfigs );
>       if ( !pATIConfigs ) {
> -        xfree( pConfigs );
> +        free( pConfigs );
>         return FALSE;
>       }
>       pATIConfigPtrs = (ATIConfigPrivPtr*)
>         xnfcalloc( sizeof(ATIConfigPrivPtr), numConfigs );
>       if ( !pATIConfigPtrs ) {
> -        xfree( pConfigs );
> -        xfree( pATIConfigs );
> +        free( pConfigs );
> +        free( pATIConfigs );
>         return FALSE;
>       }
>
> @@ -190,14 +190,14 @@ static Bool ATIInitVisualConfigs( ScreenPtr pScreen )
>       pATIConfigs = (ATIConfigPrivPtr)
>         xnfcalloc( sizeof(ATIConfigPrivRec), numConfigs );
>       if ( !pATIConfigs ) {
> -        xfree( pConfigs );
> +        free( pConfigs );
>         return FALSE;
>       }
>       pATIConfigPtrs = (ATIConfigPrivPtr*)
>         xnfcalloc( sizeof(ATIConfigPrivPtr), numConfigs );
>       if ( !pATIConfigPtrs ) {
> -        xfree( pConfigs );
> -        xfree( pATIConfigs );
> +        free( pConfigs );
> +        free( pATIConfigs );
>         return FALSE;
>       }
>
> @@ -553,11 +553,11 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg,
>
>        if (nbox > 1) {
>            /* Keep ordering in each band, reverse order of bands */
> -           pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
> +           pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec)*nbox);
>            if (!pboxNew1) return;
> -           pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
> +           pptNew1 = (DDXPointPtr)malloc(sizeof(DDXPointRec)*nbox);
>            if (!pptNew1) {
> -               xfree(pboxNew1);
> +               free(pboxNew1);
>                return;
>            }
>            pboxBase = pboxNext = pbox+nbox-1;
> @@ -588,13 +588,13 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg,
>
>        if (nbox > 1) {
>            /* reverse order of rects in each band */
> -           pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
> -           pptNew2  = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
> +           pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec)*nbox);
> +           pptNew2  = (DDXPointPtr)malloc(sizeof(DDXPointRec)*nbox);
>            if (!pboxNew2 || !pptNew2) {
> -               xfree(pptNew2);
> -               xfree(pboxNew2);
> -               xfree(pptNew1);
> -               xfree(pboxNew1);
> +               free(pptNew2);
> +               free(pboxNew2);
> +               free(pptNew1);
> +               free(pboxNew1);
>                return;
>            }
>            pboxBase = pboxNext = pbox;
> @@ -665,10 +665,10 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg,
>     outf(SRC_OFF_PITCH, pATI->NewHW.dst_off_pitch);
>     outf(DST_OFF_PITCH, pATI->NewHW.src_off_pitch);
>
> -    xfree(pptNew2);
> -    xfree(pboxNew2);
> -    xfree(pptNew1);
> -    xfree(pboxNew1);
> +    free(pptNew2);
> +    free(pboxNew2);
> +    free(pptNew1);
> +    free(pboxNew1);
>
>     ATIDRIMarkSyncInt(pScreenInfo);
>  #endif
> @@ -1237,7 +1237,7 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen )
>    if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
>       pDRIInfo->busIdString = DRICreatePCIBusID(pATI->PCIInfo);
>    } else {
> -      pDRIInfo->busIdString = xalloc( 64 );
> +      pDRIInfo->busIdString = malloc( 64 );
>       sprintf( pDRIInfo->busIdString,
>               "PCI:%d:%d:%d",
>               PCI_DEV_BUS(pATI->PCIInfo),
> @@ -1283,7 +1283,7 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen )
>    pATIDRIServer = (ATIDRIServerInfoPtr)
>       xnfcalloc( sizeof(ATIDRIServerInfoRec), 1 );
>    if ( !pATIDRIServer ) {
> -      xfree( pATIDRI );
> +      free( pATIDRI );
>       DRIDestroyInfoRec( pATI->pDRIInfo );
>       pATI->pDRIInfo = NULL;
>       xf86DrvMsg( pScreenInfo->scrnIndex, X_ERROR,
> @@ -1322,9 +1322,9 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen )
>    pATI->have3DWindows = FALSE;
>
>    if ( !DRIScreenInit( pScreen, pDRIInfo, &pATI->drmFD ) ) {
> -      xfree( pATIDRIServer );
> +      free( pATIDRIServer );
>       pATI->pDRIServerInfo = NULL;
> -      xfree( pDRIInfo->devPrivate );
> +      free( pDRIInfo->devPrivate );
>       pDRIInfo->devPrivate = NULL;
>       DRIDestroyInfoRec( pDRIInfo );
>       pDRIInfo = NULL;
> @@ -1619,22 +1619,22 @@ void ATIDRICloseScreen( ScreenPtr pScreen )
>    /* De-allocate all DRI data structures */
>    if ( pATI->pDRIInfo ) {
>       if ( pATI->pDRIInfo->devPrivate ) {
> -        xfree( pATI->pDRIInfo->devPrivate );
> +        free( pATI->pDRIInfo->devPrivate );
>         pATI->pDRIInfo->devPrivate = NULL;
>       }
>       DRIDestroyInfoRec( pATI->pDRIInfo );
>       pATI->pDRIInfo = NULL;
>    }
>    if ( pATI->pDRIServerInfo ) {
> -      xfree( pATI->pDRIServerInfo );
> +      free( pATI->pDRIServerInfo );
>       pATI->pDRIServerInfo = NULL;
>    }
>    if ( pATI->pVisualConfigs ) {
> -      xfree( pATI->pVisualConfigs );
> +      free( pATI->pVisualConfigs );
>       pATI->pVisualConfigs = NULL;
>    }
>    if ( pATI->pVisualConfigsPriv ) {
> -      xfree( pATI->pVisualConfigsPriv );
> +      free( pATI->pVisualConfigsPriv );
>       pATI->pVisualConfigsPriv = NULL;
>    }
>  }
> diff --git a/src/atii2c.c b/src/atii2c.c
> index a13d647..6e3a7ef 100644
> --- a/src/atii2c.c
> +++ b/src/atii2c.c
> @@ -324,7 +324,7 @@ ATICreateI2CBusRec
>     if (!(pI2CBus = xf86CreateI2CBusRec()))
>     {
>         xf86DrvMsg(iScreen, X_WARNING, "Unable to allocate I2C Bus record.\n");
> -        xfree(pATII2C);
> +        free(pATII2C);
>         return NULL;
>     }
>
> @@ -348,7 +348,7 @@ ATICreateI2CBusRec
>     xf86DrvMsg(iScreen, X_WARNING,
>         "I2C bus %s initialisation failure.\n", BusName);
>     xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE);
> -    xfree(pATII2C);
> +    free(pATII2C);
>     return NULL;
>  }
>
> @@ -392,8 +392,8 @@ ATII2CFreeScreen
>         pATII2C = pI2CBus->DriverPrivate.ptr;
>
>         xf86DestroyI2CBusRec(pI2CBus, TRUE, TRUE);
> -        xfree(pATII2C);
> +        free(pATII2C);
>     }
>
> -    xfree(ppI2CBus);
> +    free(ppI2CBus);
>  }
> diff --git a/src/atimach64exa.c b/src/atimach64exa.c
> index 67c5f22..a3e49bf 100644
> --- a/src/atimach64exa.c
> +++ b/src/atimach64exa.c
> @@ -686,7 +686,7 @@ Bool ATIMach64ExaInit(ScreenPtr pScreen)
>               pATI->RenderAccelEnabled ? "enabled" : "disabled");
>
>     if (!exaDriverInit(pScreen, pATI->pExa)) {
> -       xfree(pATI->pExa);
> +       free(pATI->pExa);
>        pATI->pExa = NULL;
>        return FALSE;
>     }
> diff --git a/src/atimach64i2c.c b/src/atimach64i2c.c
> index 0f7d797..2f243e5 100644
> --- a/src/atimach64i2c.c
> +++ b/src/atimach64i2c.c
> @@ -347,7 +347,7 @@ ATITVAddOnProbe
>         return TRUE;
>     }
>
> -    xfree(pI2CDev);
> +    free(pI2CDev);
>     return FALSE;
>  }
>
> diff --git a/src/atimach64probe.c b/src/atimach64probe.c
> index 2d554e1..0117920 100644
> --- a/src/atimach64probe.c
> +++ b/src/atimach64probe.c
> @@ -234,7 +234,7 @@ Mach64Probe(DriverPtr pDriver, int flags)
>                                     Mach64Chipsets, Mach64PciChipsets,
>                                     devSections, numDevSections,
>                                     pDriver, &usedChips);
> -    xfree(devSections);
> +    free(devSections);
>
>     if (numUsed <= 0)
>         return FALSE;
> @@ -248,7 +248,7 @@ Mach64Probe(DriverPtr pDriver, int flags)
>         }
>     }
>
> -    xfree(usedChips);
> +    free(usedChips);
>
>     return ProbeSuccess;
>  }
> diff --git a/src/atimach64xv.c b/src/atimach64xv.c
> index 2c9b812..66bd953 100644
> --- a/src/atimach64xv.c
> +++ b/src/atimach64xv.c
> @@ -1467,8 +1467,8 @@ ATIMach64XVInitialiseAdaptor
>     if (pppAdaptor)
>         *pppAdaptor = ppAdaptor;
>     else {
> -        xfree(ppAdaptor[0]);
> -        xfree(ppAdaptor);
> +        free(ppAdaptor[0]);
> +        free(ppAdaptor);
>     }
>
>     return 1;
> @@ -1505,9 +1505,9 @@ ATIXVFreeAdaptorInfo
>         return;
>
>     while (nAdaptor > 0)
> -        xfree(ppAdaptor[--nAdaptor]);
> +        free(ppAdaptor[--nAdaptor]);
>
> -    xfree(ppAdaptor);
> +    free(ppAdaptor);
>  }
>
>  /*
> diff --git a/src/atimode.c b/src/atimode.c
> index d1b3198..00817f0 100644
> --- a/src/atimode.c
> +++ b/src/atimode.c
> @@ -114,7 +114,7 @@ ATISwap
>         if (!pATIHW->frame_buffer)
>         {
>             pATIHW->frame_buffer =
> -                (pointer)xalloc(pATIHW->nBank * pATIHW->nPlane * 0x00010000U);
> +                (pointer)malloc(pATIHW->nBank * pATIHW->nPlane * 0x00010000U);
>             if (!pATIHW->frame_buffer)
>             {
>                 xf86DrvMsg(iScreen, X_WARNING,
> diff --git a/src/atipreinit.c b/src/atipreinit.c
> index 34b851c..2776a48 100644
> --- a/src/atipreinit.c
> +++ b/src/atipreinit.c
> @@ -560,7 +560,7 @@ ATIPreInit
>     pATI->Chip = pEntity->chipset;
>     pVideo = xf86GetPciInfoForEntity(pATI->iEntity);
>
> -    xfree(pEntity);
> +    free(pEntity);
>
>  #ifndef XSERVER_LIBPCIACCESS
>     if (!pResources)
> diff --git a/src/atiscreen.c b/src/atiscreen.c
> index cf79c37..f8e23c9 100644
> --- a/src/atiscreen.c
> +++ b/src/atiscreen.c
> @@ -388,7 +388,7 @@ ATIScreenInit
>     {
>         pATI->FBBytesPerPixel = pATI->bitsPerPixel >> 3;
>         pATI->FBPitch = PixmapBytePad(pATI->displayWidth, pATI->depth);
> -        if ((pATI->pShadow = xalloc(pATI->FBPitch * pScreenInfo->virtualY)))
> +        if ((pATI->pShadow = malloc(pATI->FBPitch * pScreenInfo->virtualY)))
>         {
>             pFB = pATI->pShadow;
>         }
> @@ -646,7 +646,7 @@ ATICloseScreen
>     if (pATI->pExa)
>     {
>         exaDriverFini(pScreen);
> -        xfree(pATI->pExa);
> +        free(pATI->pExa);
>         pATI->pExa = NULL;
>     }
>  #endif
> @@ -669,13 +669,13 @@ ATICloseScreen
>  #ifdef USE_XAA
>     if (!pATI->useEXA)
>     {
> -        xfree(pATI->ExpansionBitmapScanlinePtr[1]);
> +        free(pATI->ExpansionBitmapScanlinePtr[1]);
>         pATI->ExpansionBitmapScanlinePtr[0] = NULL;
>         pATI->ExpansionBitmapScanlinePtr[1] = NULL;
>     }
>  #endif
>
> -    xfree(pATI->pShadow);
> +    free(pATI->pShadow);
>     pATI->pShadow = NULL;
>     pScreenInfo->pScreen = NULL;
>
> --
> 1.7.2.3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list