[PATCH nv] Don't use libcwrappers for calloc and free

Tiago Vignatti tiago.vignatti at nokia.com
Tue May 25 03:33:53 PDT 2010


Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
So how we do to keep old servers compat now?

 src/g80_dac.c     |    2 +-
 src/g80_driver.c  |    6 +++---
 src/g80_output.c  |    2 +-
 src/g80_sor.c     |    4 ++--
 src/nv_cursor.c   |    6 +++---
 src/nv_dga.c      |    2 +-
 src/nv_driver.c   |   22 +++++++++++-----------
 src/nv_setup.c    |    6 +++---
 src/nv_video.c    |    8 ++++----
 src/riva_cursor.c |    4 ++--
 src/riva_dga.c    |    2 +-
 src/riva_driver.c |   14 +++++++-------
 12 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/src/g80_dac.c b/src/g80_dac.c
index 307e412..fb56f47 100644
--- a/src/g80_dac.c
+++ b/src/g80_dac.c
@@ -173,7 +173,7 @@ G80DacDestroy(xf86OutputPtr output)
 {
     G80OutputDestroy(output);
 
-    xfree(output->driver_private);
+    free(output->driver_private);
     output->driver_private = NULL;
 }
 
diff --git a/src/g80_driver.c b/src/g80_driver.c
index abdb37e..551abe3 100644
--- a/src/g80_driver.c
+++ b/src/g80_driver.c
@@ -80,7 +80,7 @@ static Bool
 G80GetRec(ScrnInfoPtr pScrn)
 {
     if(pScrn->driverPrivate == NULL)
-        pScrn->driverPrivate = xcalloc(sizeof(G80Rec), 1);
+        pScrn->driverPrivate = calloc(sizeof(G80Rec), 1);
 
     return (pScrn->driverPrivate != NULL);
 }
@@ -88,7 +88,7 @@ G80GetRec(ScrnInfoPtr pScrn)
 static void
 G80FreeRec(ScrnInfoPtr pScrn)
 {
-    xfree(pScrn->driverPrivate);
+    free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 }
 
@@ -263,7 +263,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
 
     /* Process options */
     xf86CollectOptions(pScrn, NULL);
-    if(!(pNv->Options = xalloc(sizeof(G80Options)))) goto fail;
+    if(!(pNv->Options = malloc(sizeof(G80Options)))) goto fail;
     memcpy(pNv->Options, G80Options, sizeof(G80Options));
     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pNv->Options);
 
diff --git a/src/g80_output.c b/src/g80_output.c
index 5744d94..2da99cb 100644
--- a/src/g80_output.c
+++ b/src/g80_output.c
@@ -291,7 +291,7 @@ G80I2CInit(ScrnInfoPtr pScrn, const char *name, const int port)
     if(xf86I2CBusInit(i2c)) {
         return i2c;
     } else {
-        xfree(i2c);
+        free(i2c);
         return NULL;
     }
 }
diff --git a/src/g80_sor.c b/src/g80_sor.c
index 185761f..314be96 100644
--- a/src/g80_sor.c
+++ b/src/g80_sor.c
@@ -169,7 +169,7 @@ G80SorDestroy(xf86OutputPtr output)
 
     xf86DeleteMode(&pPriv->nativeMode, pPriv->nativeMode);
 
-    xfree(output->driver_private);
+    free(output->driver_private);
     output->driver_private = NULL;
 }
 
@@ -505,7 +505,7 @@ G80CreateSor(ScrnInfoPtr pScrn, ORNum or, PanelType panelType)
         if(!pPriv->nativeMode) {
             xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                        "Failed to find LVDS native mode\n");
-            xfree(pPriv);
+            free(pPriv);
             return NULL;
         }
 
diff --git a/src/nv_cursor.c b/src/nv_cursor.c
index bf5adc0..823bb43 100644
--- a/src/nv_cursor.c
+++ b/src/nv_cursor.c
@@ -119,18 +119,18 @@ TransformCursor (NVPtr pNv)
     /* convert to color cursor */
     if(pNv->alphaCursor) {
        dwords = 64 * 64;
-       if(!(tmp = Xcalloc(dwords * 4))) return;
+       if(!(tmp = calloc(1, dwords * 4))) return;
        ConvertCursor8888(pNv, pNv->curImage, tmp);
     } else {
        dwords = (32 * 32) >> 1;
-       if(!(tmp = Xcalloc(dwords * 4))) return;
+       if(!(tmp = calloc(1, dwords * 4))) return;
        ConvertCursor1555(pNv, pNv->curImage, (CARD16*)tmp);
     }
 
     for(i = 0; i < dwords; i++)
         pNv->CURSOR[i] = tmp[i];
 
-    xfree(tmp);
+    free(tmp);
 }
 
 static void
diff --git a/src/nv_dga.c b/src/nv_dga.c
index ccbbf4d..7f8561b 100644
--- a/src/nv_dga.c
+++ b/src/nv_dga.c
@@ -69,7 +69,7 @@ SECOND_PASS:
 	    if(secondPitch)
 		pitch = secondPitch; 
 
-	    if(!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec))))
+	    if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
 		break;
 
 	    modes = newmodes;
diff --git a/src/nv_driver.c b/src/nv_driver.c
index e10ae0c..3063633 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -629,7 +629,7 @@ NVFreeRec(ScrnInfoPtr pScrn)
 {
     if (pScrn->driverPrivate == NULL)
         return;
-    xfree(pScrn->driverPrivate);
+    free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 }
 
@@ -847,7 +847,7 @@ static Bool NVKernelModesettingEnabled(struct pci_device *device)
     busIdString = DRICreatePCIBusID(device);
 
     ret = drmCheckModesettingSupported(busIdString);
-    xfree(busIdString);
+    free(busIdString);
 
     return (ret == 0);
 }
@@ -994,8 +994,8 @@ NVProbe(DriverPtr drv, int flags)
 	}    
     }
 
-    xfree(devSections);
-    xfree(usedChips);
+    free(devSections);
+    free(usedChips);
 
     return foundScreen;
 }
@@ -1177,13 +1177,13 @@ NVCloseScreen(int scrnIndex, ScreenPtr pScreen)
     if (pNv->CursorInfoRec)
         xf86DestroyCursorInfoRec(pNv->CursorInfoRec);
     if (pNv->ShadowPtr)
-        xfree(pNv->ShadowPtr);
+        free(pNv->ShadowPtr);
     if (pNv->DGAModes)
-        xfree(pNv->DGAModes);
+        free(pNv->DGAModes);
     if (pNv->overlayAdaptor)
-	xfree(pNv->overlayAdaptor);
+	free(pNv->overlayAdaptor);
     if (pNv->blitAdaptor)
-        xfree(pNv->blitAdaptor);
+        free(pNv->blitAdaptor);
 
     pScrn->vtSema = FALSE;
     pScreen->CloseScreen = pNv->CloseScreen;
@@ -1306,7 +1306,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
             return FALSE;
 
         i = pEnt->index;
-        xfree(pEnt);
+        free(pEnt);
 
         nvProbeDDC(pScrn, i);
         return TRUE;
@@ -1503,7 +1503,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     xf86CollectOptions(pScrn, NULL);
 
     /* Process the options */
-    if (!(pNv->Options = xalloc(sizeof(NVOptions))))
+    if (!(pNv->Options = malloc(sizeof(NVOptions))))
 	return FALSE;
     memcpy(pNv->Options, NVOptions, sizeof(NVOptions));
     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pNv->Options);
@@ -2439,7 +2439,7 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     if(pNv->ShadowFB) {
  	pNv->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
-        pNv->ShadowPtr = xalloc(pNv->ShadowPitch * shadowHeight);
+        pNv->ShadowPtr = malloc(pNv->ShadowPitch * shadowHeight);
 	displayWidth = pNv->ShadowPitch / (pScrn->bitsPerPixel >> 3);
         FBStart = pNv->ShadowPtr;
     } else {
diff --git a/src/nv_setup.c b/src/nv_setup.c
index 132a96b..c11427f 100644
--- a/src/nv_setup.c
+++ b/src/nv_setup.c
@@ -668,11 +668,11 @@ NVCommonSetup(ScrnInfoPtr pScrn)
               (!monitorA->features.input_type && !pNv->FlatPanel))
            {
                if(monitorB) { 
-                  xfree(monitorB);
+                  free(monitorB);
                   monitorB = NULL;
                }
            } else {
-              xfree(monitorA);
+              free(monitorA);
               monitorA = NULL;
            }
        }
@@ -681,7 +681,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
            if((monitorB->features.input_type && !pNv->FlatPanel) ||
               (!monitorB->features.input_type && pNv->FlatPanel)) 
            {
-              xfree(monitorB);
+              free(monitorB);
            } else {
               monitorA = monitorB;
            }
diff --git a/src/nv_video.c b/src/nv_video.c
index 6b13e5f..ad267bf 100644
--- a/src/nv_video.c
+++ b/src/nv_video.c
@@ -315,7 +315,7 @@ void NVInitVideo (ScreenPtr pScreen)
         if(overlayAdaptor) size++;
         if(blitAdaptor)    size++;
 
-        if((newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*)))) {
+        if((newAdaptors = malloc(size * sizeof(XF86VideoAdaptorPtr*)))) {
             if(num_adaptors) {
                  memcpy(newAdaptors, adaptors,
                         num_adaptors * sizeof(XF86VideoAdaptorPtr));
@@ -336,7 +336,7 @@ void NVInitVideo (ScreenPtr pScreen)
         xf86XVScreenInit(pScreen, adaptors, num_adaptors);
 
     if (newAdaptors)
-	xfree(newAdaptors);    
+	free(newAdaptors);    
 }
 
 
@@ -349,7 +349,7 @@ NVSetupBlitVideo (ScreenPtr pScreen)
     NVPortPrivPtr       pPriv;
     int         i;
 
-    if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
+    if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
                              sizeof(NVPortPrivRec) +
                              (sizeof(DevUnion) * NUM_BLIT_PORTS))))
     {
@@ -411,7 +411,7 @@ NVSetupOverlayVideo (ScreenPtr pScreen)
     XF86VideoAdaptorPtr adapt;
     NVPortPrivPtr       pPriv;
     
-    if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + 
+    if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
                              sizeof(NVPortPrivRec) + 
                              sizeof(DevUnion))))
     {
diff --git a/src/riva_cursor.c b/src/riva_cursor.c
index 35d6a58..a9c614e 100644
--- a/src/riva_cursor.c
+++ b/src/riva_cursor.c
@@ -72,13 +72,13 @@ RivaTransformCursor (RivaPtr pRiva)
     int i, dwords;
 
     dwords = (32 * 32) >> 1;
-    if(!(tmp = Xcalloc(dwords * 4))) return;
+    if(!(tmp = calloc(1, dwords * 4))) return;
     RivaConvertCursor1555(pRiva, pRiva->curImage, (CARD16*)tmp);
 
     for(i = 0; i < dwords; i++)
         pRiva->riva.CURSOR[i] = tmp[i];
 
-    xfree(tmp);
+    free(tmp);
 }
 
 static void
diff --git a/src/riva_dga.c b/src/riva_dga.c
index c6f2d92..7a984f1 100644
--- a/src/riva_dga.c
+++ b/src/riva_dga.c
@@ -69,7 +69,7 @@ SECOND_PASS:
 	    if(secondPitch)
 		pitch = secondPitch; 
 
-	    if(!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec))))
+	    if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
 		break;
 
 	    modes = newmodes;
diff --git a/src/riva_driver.c b/src/riva_driver.c
index afe0972..e33a7f3 100644
--- a/src/riva_driver.c
+++ b/src/riva_driver.c
@@ -121,7 +121,7 @@ RivaFreeRec(ScrnInfoPtr pScrn)
 {
     if (pScrn->driverPrivate == NULL)
         return;
-    xfree(pScrn->driverPrivate);
+    free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 }
 
@@ -261,11 +261,11 @@ RivaCloseScreen(int scrnIndex, ScreenPtr pScreen)
     if (pRiva->CursorInfoRec)
         xf86DestroyCursorInfoRec(pRiva->CursorInfoRec);
     if (pRiva->ShadowPtr)
-        xfree(pRiva->ShadowPtr);
+        free(pRiva->ShadowPtr);
     if (pRiva->DGAModes)
-        xfree(pRiva->DGAModes);
+        free(pRiva->DGAModes);
     if ( pRiva->expandBuffer )
-        xfree(pRiva->expandBuffer);
+        free(pRiva->expandBuffer);
 
     pScrn->vtSema = FALSE;
     pScreen->CloseScreen = pRiva->CloseScreen;
@@ -345,7 +345,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
             return FALSE;
 
         i = pEnt->index;
-        xfree(pEnt);
+        free(pEnt);
 
         rivaProbeDDC(pScrn, i);
         return TRUE;
@@ -492,7 +492,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
     xf86CollectOptions(pScrn, NULL);
 
     /* Process the options */
-    if (!(pRiva->Options = xalloc(sizeof(RivaOptions))))
+    if (!(pRiva->Options = malloc(sizeof(RivaOptions))))
 	return FALSE;
     memcpy(pRiva->Options, RivaOptions, sizeof(RivaOptions));
     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pRiva->Options);
@@ -1103,7 +1103,7 @@ RivaScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     if(pRiva->ShadowFB) {
  	pRiva->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
-        pRiva->ShadowPtr = xalloc(pRiva->ShadowPitch * height);
+        pRiva->ShadowPtr = malloc(pRiva->ShadowPitch * height);
 	displayWidth = pRiva->ShadowPitch / (pScrn->bitsPerPixel >> 3);
         FBStart = pRiva->ShadowPtr;
     } else {
-- 
1.6.0.4



More information about the xorg-devel mailing list