[PATCH xf86-video-trident 1/2] Convert x+m/calloc/free to m/calloc/free.

Mikhail Gusarov dottedmag at dottedmag.net
Fri Oct 22 22:24:57 PDT 2010


Twas brillig at 21:04:53 22.10.2010 UTC-04 when twoerner at gmail.com did gyre and gimble:

 TW> From: Trevor Woerner <twoerner at gmail.com>

Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

 TW> Signed-off-by: Trevor Woerner <twoerner at gmail.com>
 TW> ---
 TW>  src/trident_dga.c    |    6 +++---
 TW>  src/trident_driver.c |   20 ++++++++++----------
 TW>  src/trident_video.c  |   26 +++++++++++++-------------
 TW>  3 files changed, 26 insertions(+), 26 deletions(-)

 TW> diff --git a/src/trident_dga.c b/src/trident_dga.c
 TW> index 78fa8f4..dd836a6 100644
 TW> --- a/src/trident_dga.c
 TW> +++ b/src/trident_dga.c
 TW> @@ -83,15 +83,15 @@ TRIDENTDGAInit(ScreenPtr pScreen)
 TW>     while(pMode) {
 TW>  
 TW>          if(0 /*pScrn->displayWidth != pMode->HDisplay*/) {
 TW> -            newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec));
 TW> +            newmodes = realloc(modes, (num + 2) * sizeof(DGAModeRec));
 TW>              oneMore = TRUE;
 TW>          } else {
 TW> -            newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));
 TW> +            newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec));
 TW>              oneMore = FALSE;
 TW>          }
 TW>  
 TW>          if(!newmodes) {
 TW> -           xfree(modes);
 TW> +           free(modes);
 TW>             return FALSE;
 TW>          }
 TW>          modes = newmodes;
 TW> diff --git a/src/trident_driver.c b/src/trident_driver.c
 TW> index 31cbb83..ecf99f0 100644
 TW> --- a/src/trident_driver.c
 TW> +++ b/src/trident_driver.c
 TW> @@ -560,7 +560,7 @@ TRIDENTFreeRec(ScrnInfoPtr pScrn)
 TW>  {
 TW>      if (pScrn->driverPrivate == NULL)
 TW>          return;
 TW> -    xfree(pScrn->driverPrivate);
 TW> +    free(pScrn->driverPrivate);
 TW>      pScrn->driverPrivate = NULL;
 TW>  }
 TW>  
 TW> @@ -900,7 +900,7 @@ TRIDENTProbe(DriverPtr drv, int flags)
 TW>                      foundScreen = TRUE;
 TW>                  }
 TW>              }
 TW> -            xfree(usedChips);
 TW> +            free(usedChips);
 TW>          }
 TW>      }
 TW>  
 TW> @@ -933,11 +933,11 @@ TRIDENTProbe(DriverPtr drv, int flags)
 TW>                  foundScreen = TRUE;
 TW>              }
 TW>          }
 TW> -        xfree(usedChips);
 TW> +        free(usedChips);
 TW>      }
 TW>  #endif    
 TW>  
 TW> -    xfree(devSections);
 TW> +    free(devSections);
 TW>      return foundScreen;
 TW>  }
 TW>          
 TW> @@ -1163,7 +1163,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
 TW>      xf86CollectOptions(pScrn, NULL);
 TW>  
 TW>      /* Process the options */
 TW> -    if (!(pTrident->Options = xalloc(sizeof(TRIDENTOptions))))
 TW> +    if (!(pTrident->Options = malloc(sizeof(TRIDENTOptions))))
 TW>          return FALSE;
 TW>      memcpy(pTrident->Options, TRIDENTOptions, sizeof(TRIDENTOptions));
 TW>      xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTrident->Options);
 TW> @@ -2868,7 +2868,7 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 TW>  
 TW>      if(pTrident->ShadowFB) {
 TW>           pTrident->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
 TW> -        pTrident->ShadowPtr = xalloc(pTrident->ShadowPitch * height);
 TW> +        pTrident->ShadowPtr = malloc(pTrident->ShadowPitch * height);
 TW>          displayWidth = pTrident->ShadowPitch / (pScrn->bitsPerPixel >> 3);
 TW>          FBStart = pTrident->ShadowPtr;
 TW>      } else {
 TW> @@ -2958,7 +2958,7 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 TW>                  (miBankProcPtr)TVGA8900SetReadWrite;
 TW>          if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY,
 TW>                                   pScrn->displayWidth, pBankInfo)) {
 TW> -            xfree(pBankInfo);
 TW> +            free(pBankInfo);
 TW>              pBankInfo = NULL;
 TW>              if (pTrident->pVbe)
 TW>                      vbeFree(pTrident->pVbe);
 TW> @@ -3238,15 +3238,15 @@ TRIDENTCloseScreen(int scrnIndex, ScreenPtr pScreen)
 TW>          XAADestroyInfoRec(pTrident->AccelInfoRec);
 TW>      if (pTrident->EXADriverPtr) {
 TW>          exaDriverFini(pScreen);
 TW> -        xfree(pTrident->EXADriverPtr);
 TW> +        free(pTrident->EXADriverPtr);
 TW>          pTrident->EXADriverPtr = NULL;
 TW>      }        
 TW>      if (pTrident->CursorInfoRec)
 TW>          xf86DestroyCursorInfoRec(pTrident->CursorInfoRec);
 TW>      if (pTrident->ShadowPtr)
 TW> -        xfree(pTrident->ShadowPtr);
 TW> +        free(pTrident->ShadowPtr);
 TW>      if (pTrident->DGAModes)
 TW> -        xfree(pTrident->DGAModes);
 TW> +        free(pTrident->DGAModes);
 TW>      pScrn->vtSema = FALSE;
 TW>  
 TW>      if(pTrident->BlockHandler)
 TW> diff --git a/src/trident_video.c b/src/trident_video.c
 TW> index 0c5497b..1ed7db2 100644
 TW> --- a/src/trident_video.c
 TW> +++ b/src/trident_video.c
 TW> @@ -125,7 +125,7 @@ void TRIDENTInitVideo(ScreenPtr pScreen)
 TW>              adaptors = &newAdaptor;
 TW>          } else {
 TW>              newAdaptors =  /* need to free this someplace */
 TW> -                xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
 TW> +                malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
 TW>              if(newAdaptors) {
 TW>                  memcpy(newAdaptors, adaptors, num_adaptors * 
 TW>                                          sizeof(XF86VideoAdaptorPtr));
 TW> @@ -140,7 +140,7 @@ void TRIDENTInitVideo(ScreenPtr pScreen)
 TW>          xf86XVScreenInit(pScreen, adaptors, num_adaptors);
 TW>  
 TW>      if(newAdaptors)
 TW> -        xfree(newAdaptors);
 TW> +        free(newAdaptors);
 TW>  
 TW>      if (pTrident->videoFlags)
 TW>          xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,
 TW> @@ -321,7 +321,7 @@ TRIDENTSetupImageVideo(ScreenPtr pScreen)
 TW>      XF86VideoAdaptorPtr adapt;
 TW>      TRIDENTPortPrivPtr pPriv;
 TW>  
 TW> -    if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
 TW> +    if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
 TW>                              sizeof(TRIDENTPortPrivRec) +
 TW>                              sizeof(DevUnion))))
 TW>          return NULL;
 TW> @@ -978,18 +978,18 @@ TRIDENTAllocateSurface(
 TW>      surface->width = w;
 TW>      surface->height = h;
 TW>  
 TW> -    if(!(surface->pitches = xalloc(sizeof(int)))) {
 TW> +    if(!(surface->pitches = malloc(sizeof(int)))) {
 TW>          xf86FreeOffscreenLinear(linear);
 TW>          return BadAlloc;
 TW>      }
 TW> -    if(!(surface->offsets = xalloc(sizeof(int)))) {
 TW> -        xfree(surface->pitches);
 TW> +    if(!(surface->offsets = malloc(sizeof(int)))) {
 TW> +        free(surface->pitches);
 TW>          xf86FreeOffscreenLinear(linear);
 TW>          return BadAlloc;
 TW>      }
 TW> -    if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) {
 TW> -        xfree(surface->pitches);
 TW> -        xfree(surface->offsets);
 TW> +    if(!(pPriv = malloc(sizeof(OffscreenPrivRec)))) {
 TW> +        free(surface->pitches);
 TW> +        free(surface->offsets);
 TW>          xf86FreeOffscreenLinear(linear);
 TW>          return BadAlloc;
 TW>      }
 TW> @@ -1034,9 +1034,9 @@ TRIDENTFreeSurface(
 TW>      if(pPriv->isOn)
 TW>          TRIDENTStopSurface(surface);
 TW>      xf86FreeOffscreenLinear(pPriv->linear);
 TW> -    xfree(surface->pitches);
 TW> -    xfree(surface->offsets);
 TW> -    xfree(surface->devPrivate.ptr);
 TW> +    free(surface->pitches);
 TW> +    free(surface->offsets);
 TW> +    free(surface->devPrivate.ptr);
 TW>  
 TW>      return Success;
 TW>  }
 TW> @@ -1128,7 +1128,7 @@ TRIDENTInitOffscreenImages(ScreenPtr pScreen)
 TW>      XF86OffscreenImagePtr offscreenImages;
 TW>  
 TW>      /* need to free this someplace */
 TW> -    if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec))))
 TW> +    if(!(offscreenImages = malloc(sizeof(XF86OffscreenImageRec))))
 TW>          return;
 TW>  
 TW>      offscreenImages[0].image = &Images[0];
 TW> -- 
 TW> 1.7.3.1.127.g1bb28

 TW> _______________________________________________
 TW> xorg-devel at lists.x.org: X.Org development
 TW> Archives: http://lists.x.org/archives/xorg-devel
 TW> Info: http://lists.x.org/mailman/listinfo/xorg-devel

-- 
  http://fossarchy.blogspot.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101023/28c59450/attachment.pgp>


More information about the xorg-devel mailing list