[PATCH 2/2 xgixp] Replace X{c, r, }alloc and Xfree for stdlib functions

Paulo Zanoni pzanoni at mandriva.com
Mon Dec 13 10:33:39 PST 2010


Signed-off-by: Paulo Zanoni <pzanoni at mandriva.com>
---
 src/xg47_cmdlist.c |    2 +-
 src/xg47_display.c |    6 +++---
 src/xg47_video.c   |   26 +++++++++++++-------------
 src/xgi_dga.c      |    6 +++---
 src/xgi_dri.c      |    4 ++--
 src/xgi_driver.c   |    8 ++++----
 src/xgi_hwmc.c     |    6 +++---
 src/xgi_option.c   |    2 +-
 8 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/xg47_cmdlist.c b/src/xg47_cmdlist.c
index 4c119df..1f8374c 100644
--- a/src/xg47_cmdlist.c
+++ b/src/xg47_cmdlist.c
@@ -138,7 +138,7 @@ void xg47_Cleanup(ScrnInfoPtr pScrn, struct xg47_CmdList *s_pCmdList)
                            s_pCmdList->command.ptr);
         }
 
-        xfree(s_pCmdList);
+        free(s_pCmdList);
     }
 }
 
diff --git a/src/xg47_display.c b/src/xg47_display.c
index 42c98e2..6c2b265 100644
--- a/src/xg47_display.c
+++ b/src/xg47_display.c
@@ -181,7 +181,7 @@ void
 xg47_crtc_destroy(xf86CrtcPtr crtc)
 {
     if (crtc->driver_private) {
-        xfree (crtc->driver_private);
+        free (crtc->driver_private);
     }
 }
 
@@ -193,14 +193,14 @@ xg47_CrtcInit(ScrnInfoPtr pScrn, unsigned dev_type)
     struct xg47_crtc_data *data;
 
 
-    data = xcalloc(sizeof(*data), 1);
+    data = calloc(sizeof(*data), 1);
     if (data == NULL) {
         return FALSE;
     }
 
     crtc = xf86CrtcCreate(pScrn, & xg47_crtc_funcs);
     if (crtc == NULL) {
-        xfree(data);
+        free(data);
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 
                    "Unable to create CRTC structure.\n");
         return;
diff --git a/src/xg47_video.c b/src/xg47_video.c
index 8d66061..c2deb95 100644
--- a/src/xg47_video.c
+++ b/src/xg47_video.c
@@ -203,7 +203,7 @@ void XG47InitVideo(ScreenPtr pScreen)
         else
         {
             /* need to free this someplace */
-            newAdaptors = xalloc((numAdaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
+            newAdaptors = malloc((numAdaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
             if(newAdaptors)
             {
                 memcpy(newAdaptors, adaptors, numAdaptors * sizeof(XF86VideoAdaptorPtr));
@@ -218,7 +218,7 @@ void XG47InitVideo(ScreenPtr pScreen)
         xf86XVScreenInit(pScreen, adaptors, numAdaptors);
 
     if(newAdaptors)
-        xfree(newAdaptors);
+        free(newAdaptors);
 
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "XGI Video Init Successfully \n");
 }
@@ -230,7 +230,7 @@ static XF86VideoAdaptorPtr XG47SetupImageVideo(ScreenPtr pScreen)
     XGIPtr              pXGI = XGIPTR(pScrn);
     XGIPortPtr          pXGIPort = NULL;
 
-    pAdaptor = xcalloc(1, sizeof(XF86VideoAdaptorRec)
+    pAdaptor = calloc(1, sizeof(XF86VideoAdaptorRec)
                           + sizeof(XGIPortRec)
                           + sizeof(DevUnion));
     if(!pAdaptor)
@@ -363,7 +363,7 @@ static void XG47InitOffscreenImages(ScreenPtr pScreen)
     XF86OffscreenImagePtr pOffscreenImages;
 
     /* need to free this someplace */
-    if(!(pOffscreenImages = xalloc(sizeof(XF86OffscreenImageRec))))
+    if(!(pOffscreenImages = malloc(sizeof(XF86OffscreenImageRec))))
         return;
 
     pOffscreenImages[0].image = &XG47Images[0];
@@ -1366,21 +1366,21 @@ static int XG47AllocateSurface(ScrnInfoPtr pScrn,
     pSurface->width = w;
     pSurface->height = h;
 
-    if(!(pSurface->pitches = xalloc(sizeof(int))))
+    if(!(pSurface->pitches = malloc(sizeof(int))))
     {
         xf86FreeOffscreenLinear((FBLinearPtr)pSurface);
         return BadAlloc;
     }
-    if(!(pSurface->offsets = xalloc(sizeof(int))))
+    if(!(pSurface->offsets = malloc(sizeof(int))))
     {
-        xfree(pSurface->pitches);
+        free(pSurface->pitches);
         xf86FreeOffscreenLinear(pFBLinear);
       return BadAlloc;
     }
-    if(!(pOffscreenPriv = xalloc(sizeof(OffscreenPrivRec))))
+    if(!(pOffscreenPriv = malloc(sizeof(OffscreenPrivRec))))
     {
-        xfree(pSurface->pitches);
-        xfree(pSurface->offsets);
+        free(pSurface->pitches);
+        free(pSurface->offsets);
         xf86FreeOffscreenLinear(pFBLinear);
         return BadAlloc;
     }
@@ -1424,9 +1424,9 @@ static int XG47FreeSurface(XF86SurfacePtr pSurface)
         XG47StopSurface(pSurface);
     }
     xf86FreeOffscreenLinear(pOffscreenPriv->pFBLinear);
-    xfree(pSurface->pitches);
-    xfree(pSurface->offsets);
-    xfree(pSurface->devPrivate.ptr);
+    free(pSurface->pitches);
+    free(pSurface->offsets);
+    free(pSurface->devPrivate.ptr);
 
     return Success;
 }
diff --git a/src/xgi_dga.c b/src/xgi_dga.c
index e53d227..ac43850 100644
--- a/src/xgi_dga.c
+++ b/src/xgi_dga.c
@@ -76,18 +76,18 @@ Bool XGIDGAInit(ScreenPtr pScreen)
     {
         if(0 /*pScrn->displayWidth != pMode->HDisplay*/)
         {
-            pNewDgaModes = xrealloc(pDgaModes, (num + 2) * sizeof(DGAModeRec));
+            pNewDgaModes = realloc(pDgaModes, (num + 2) * sizeof(DGAModeRec));
             oneMore = TRUE;
         }
         else
         {
-            pNewDgaModes = xrealloc(pDgaModes, (num + 1) * sizeof(DGAModeRec));
+            pNewDgaModes = realloc(pDgaModes, (num + 1) * sizeof(DGAModeRec));
             oneMore = FALSE;
         }
 
         if(!pNewDgaModes)
         {
-            xfree(pDgaModes);
+            free(pDgaModes);
             return FALSE;
         }
         pDgaModes = pNewDgaModes;
diff --git a/src/xgi_dri.c b/src/xgi_dri.c
index 66b7274..0e73212 100644
--- a/src/xgi_dri.c
+++ b/src/xgi_dri.c
@@ -130,7 +130,7 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen)
     }
     dri_info->SAREASize = SAREA_MAX;
 
-    dri_priv = xcalloc(sizeof(struct xgi_dri_private), 1);
+    dri_priv = calloc(sizeof(struct xgi_dri_private), 1);
     dri_info->devPrivate = dri_priv;
 
     if (dri_priv == NULL) {
@@ -264,7 +264,7 @@ void XGIDRICloseScreen(ScreenPtr pScreen)
     /* De-allocate all DRI data structures */
     if (pXGI->dri_info) {
         if (pXGI->dri_info->devPrivate) {
-            xfree(pXGI->dri_info->devPrivate);
+            free(pXGI->dri_info->devPrivate);
             pXGI->dri_info->devPrivate = NULL;
         }
 
diff --git a/src/xgi_driver.c b/src/xgi_driver.c
index 77a14ff..1a4367d 100644
--- a/src/xgi_driver.c
+++ b/src/xgi_driver.c
@@ -530,7 +530,7 @@ static void XGIFreeRec(ScrnInfoPtr pScrn)
     {
         return;
     }
-    xfree(pScrn->driverPrivate);
+    free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 
 #if DBG_FLOW
@@ -1833,7 +1833,7 @@ Bool XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     if (pXGI->isShadowFB)
     {
         pXGI->shadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
-        pXGI->pShadow = xalloc(pXGI->shadowPitch * height);
+        pXGI->pShadow = malloc(pXGI->shadowPitch * height);
         displayWidth = pXGI->shadowPitch / (pScrn->bitsPerPixel >> 3);
         pFBStart = pXGI->pShadow;
     }
@@ -2274,13 +2274,13 @@ static Bool XGICloseScreen(int scrnIndex, ScreenPtr pScreen)
 
     if (pXGI->pShadow)
     {
-        xfree(pXGI->pShadow);
+        free(pXGI->pShadow);
         pXGI->pShadow = NULL;
     }
 
     if (pXGI->pDgaModes)
     {
-        xfree(pXGI->pDgaModes);
+        free(pXGI->pDgaModes);
         pXGI->pDgaModes = NULL;
     }
 
diff --git a/src/xgi_hwmc.c b/src/xgi_hwmc.c
index 8606ac9..3afb6de 100644
--- a/src/xgi_hwmc.c
+++ b/src/xgi_hwmc.c
@@ -226,7 +226,7 @@ int XGIXvMCCreateContext(ScrnInfoPtr pScrn, XvMCContextPtr pContext,
         return BadAlloc;
     }
 
-    *priv = xcalloc(1, sizeof(XGIXvMCCreateContextRec));
+    *priv = calloc(1, sizeof(XGIXvMCCreateContextRec));
     if (!*priv)
     {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -269,7 +269,7 @@ int XGIXvMCCreateSurface(ScrnInfoPtr pScrn,
     xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,"surface_type_id = %x width = %d, height = %d\n",
                pContext->surface_type_id, pContext->width, pContext->height);
 
-    *priv = (long *)xcalloc(1, sizeof(XGIXvMCCreateSurfaceRec));
+    *priv = (long *)calloc(1, sizeof(XGIXvMCCreateSurfaceRec));
     if (!*priv)
     {
         xf86DrvMsg(X_ERROR, pScrn->scrnIndex,
@@ -343,7 +343,7 @@ int XGIXvMCCreateSubpicture(ScrnInfoPtr pScrn,
     xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "subpicture_id = %x xvimage_id = %x width = %d, height = %d\n",
                pSubpicture->subpicture_id, pSubpicture->xvimage_id, pSubpicture->width, pSubpicture->height);
 
-    *priv = (long *)xcalloc(1, sizeof(XGIXvMCSubpictureRec));
+    *priv = (long *)calloc(1, sizeof(XGIXvMCSubpictureRec));
     if (!*priv)
     {
         xf86DrvMsg(X_ERROR, pScrn->scrnIndex,
diff --git a/src/xgi_option.c b/src/xgi_option.c
index b078e90..280692e 100644
--- a/src/xgi_option.c
+++ b/src/xgi_option.c
@@ -90,7 +90,7 @@ Bool XGIProcessOptions(ScrnInfoPtr pScrn)
 
     xf86CollectOptions(pScrn, NULL);
 
-    if (!(pXGI->pOptionInfo = xalloc(XGIOptionSize)))
+    if (!(pXGI->pOptionInfo = malloc(XGIOptionSize)))
         return FALSE;
     memcpy(pXGI->pOptionInfo, XGIOptions, XGIOptionSize);
 
-- 
1.7.1



More information about the xorg-devel mailing list