[PATCH s3virge] Replace deprecated x(c/re)alloc/xfree with m/c/realloc/free

Alex Deucher alexdeucher at gmail.com
Tue Dec 27 07:11:22 PST 2011


On Mon, Dec 26, 2011 at 12:04 PM, Tormod Volden <lists.tormod at gmail.com> wrote:
> From: Tormod Volden <debian.tormod at gmail.com>
>
> sed -i 's/xalloc/malloc/g; s/xcalloc/calloc/g; s/xrealloc/realloc/g;
>  s/xfree(/free(/g'
>
> Also added a missing unistd.h include for usleep().
>
> Signed-off-by: Tormod Volden <debian.tormod at gmail.com>

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

> ---
>
>
>  src/s3v_accel.c  |    1 +
>  src/s3v_dga.c    |    6 +++---
>  src/s3v_driver.c |   16 ++++++++--------
>  src/s3v_xv.c     |    8 ++++----
>  4 files changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/src/s3v_accel.c b/src/s3v_accel.c
> index 528ab8a..2e6d798 100644
> --- a/src/s3v_accel.c
> +++ b/src/s3v_accel.c
> @@ -28,6 +28,7 @@ in this Software without prior written authorization from the XFree86 Project.
>  #include "config.h"
>  #endif
>
> +#include <unistd.h>
>  #include "s3v.h"
>
>  #include "miline.h"
> diff --git a/src/s3v_dga.c b/src/s3v_dga.c
> index 7ad42db..57d05ef 100644
> --- a/src/s3v_dga.c
> +++ b/src/s3v_dga.c
> @@ -116,15 +116,15 @@ S3VDGAInit(ScreenPtr pScreen)
>           to be rewritten to accommodate depth changes in DGA mode */
>
>        if(0 /*pScrn->displayWidth != pMode->HDisplay*/) {
> -           newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec));
> +           newmodes = realloc(modes, (num + 2) * sizeof(DGAModeRec));
>            oneMore = TRUE;
>        } else {
> -           newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));
> +           newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec));
>            oneMore = FALSE;
>        }
>
>        if(!newmodes) {
> -          xfree(modes);
> +          free(modes);
>           return FALSE;
>        }
>        modes = newmodes;
> diff --git a/src/s3v_driver.c b/src/s3v_driver.c
> index 0440014..5f64be1 100644
> --- a/src/s3v_driver.c
> +++ b/src/s3v_driver.c
> @@ -383,7 +383,7 @@ S3VFreeRec(ScrnInfoPtr pScrn)
>     PVERB5("   S3VFreeRec\n");
>     if (pScrn->driverPrivate == NULL)
>        return;
> -    xfree(pScrn->driverPrivate);
> +    free(pScrn->driverPrivate);
>     pScrn->driverPrivate = NULL;
>  }
>
> @@ -435,7 +435,7 @@ S3VProbe(DriverPtr drv, int flags)
>                                    numDevSections, drv, &usedChips);
>
>     /* Free it since we don't need that list after this */
> -    xfree(devSections);
> +    free(devSections);
>     if (numUsed <= 0)
>        return FALSE;
>
> @@ -463,7 +463,7 @@ S3VProbe(DriverPtr drv, int flags)
>            foundScreen = TRUE;
>        }
>     }
> -    xfree(usedChips);
> +    free(usedChips);
>     PVERB5("   S3VProbe end\n");
>     return foundScreen;
>  }
> @@ -601,7 +601,7 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
>     }
>
>     /* Process the options */
> -    if (!(ps3v->Options = xalloc(sizeof(S3VOptions))))
> +    if (!(ps3v->Options = malloc(sizeof(S3VOptions))))
>        return FALSE;
>     memcpy(ps3v->Options, S3VOptions, sizeof(S3VOptions));
>     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ps3v->Options);
> @@ -797,7 +797,7 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
>
>  #ifndef XSERVER_LIBPCIACCESS
>     if (pEnt->resources) {
> -       xfree(pEnt);
> +       free(pEnt);
>        S3VFreeRec(pScrn);
>        return FALSE;
>     }
> @@ -851,7 +851,7 @@ S3VPreInit(ScrnInfoPtr pScrn, int flags)
>     } else {
>         ps3v->ChipRev = PCI_DEV_REVISION(ps3v->PciInfo);
>     }
> -    xfree(pEnt);
> +    free(pEnt);
>
>     /*
>      * This shouldn't happen because such problems should be caught in
> @@ -2526,7 +2526,7 @@ S3VInternalScreenInit( int scrnIndex, ScreenPtr pScreen)
>
>   if(ps3v->shadowFB) {
>       ps3v->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
> -      ps3v->ShadowPtr = xalloc(ps3v->ShadowPitch * height);
> +      ps3v->ShadowPtr = malloc(ps3v->ShadowPitch * height);
>       displayWidth = ps3v->ShadowPitch / (pScrn->bitsPerPixel >> 3);
>       FBStart = ps3v->ShadowPtr;
>   } else {
> @@ -3310,7 +3310,7 @@ S3VCloseScreen(int scrnIndex, ScreenPtr pScreen)
>   if (ps3v->AccelInfoRec)
>     XAADestroyInfoRec(ps3v->AccelInfoRec);
>   if (ps3v->DGAModes)
> -       xfree(ps3v->DGAModes);
> +       free(ps3v->DGAModes);
>
>   pScrn->vtSema = FALSE;
>
> diff --git a/src/s3v_xv.c b/src/s3v_xv.c
> index 7e7c243..cc836d4 100644
> --- a/src/s3v_xv.c
> +++ b/src/s3v_xv.c
> @@ -137,7 +137,7 @@ void S3VInitVideo(ScreenPtr pScreen)
>            adaptors = &newAdaptor;
>        } else {
>            newAdaptors =  /* need to free this someplace */
> -               xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
> +               malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
>            if(newAdaptors) {
>                memcpy(newAdaptors, adaptors, num_adaptors *
>                                        sizeof(XF86VideoAdaptorPtr));
> @@ -152,7 +152,7 @@ void S3VInitVideo(ScreenPtr pScreen)
>         xf86XVScreenInit(pScreen, adaptors, num_adaptors);
>
>     if(newAdaptors)
> -       xfree(newAdaptors);
> +       free(newAdaptors);
>  }
>
>  /* client libraries expect an encoding */
> @@ -301,10 +301,10 @@ S3VAllocAdaptor(ScrnInfoPtr pScrn)
>     if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn)))
>        return NULL;
>
> -    if(!(pPriv = xcalloc(1, sizeof(S3VPortPrivRec)  +
> +    if(!(pPriv = calloc(1, sizeof(S3VPortPrivRec)  +
>                        (sizeof(DevUnion) * S3V_MAX_PORTS))))
>     {
> -       xfree(adapt);
> +       free(adapt);
>        return NULL;
>     }
>
> --
> 1.7.7.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