[PATCH] xf86-video-mga: replace deprecated X*alloc functions v2

Nicolas Kaiser nikai at nikai.net
Mon Apr 4 16:52:01 PDT 2011


Replace deprecated X*alloc functions.

v2: mga_dri.c: properly use numConfigs and sizes in calloc()

Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
---
 src/mga_dga.c    |    2 +-
 src/mga_dri.c    |   82 +++++++++++++++++++++++++++---------------------------
 src/mga_driver.c |   80 ++++++++++++++++++++++++++--------------------------
 src/mga_merge.c  |   22 +++++++-------
 src/mga_storm.c  |    2 +-
 src/mga_vga.c    |    6 ++--
 src/mga_video.c  |   28 +++++++++---------
 7 files changed, 111 insertions(+), 111 deletions(-)

diff --git a/src/mga_dga.c b/src/mga_dga.c
index d43b96d..224e4ba 100644
--- a/src/mga_dga.c
+++ b/src/mga_dga.c
@@ -111,7 +111,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/mga_dri.c b/src/mga_dri.c
index 2723dd8..b3a1bb8 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -92,24 +92,24 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen )
    case 16:
       numConfigs = 8;
 
-      pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig),
-						numConfigs );
+      pConfigs = (__GLXvisualConfig*)calloc( numConfigs,
+					     sizeof(__GLXvisualConfig) );
       if ( !pConfigs ) {
 	 return FALSE;
       }
 
-      pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec),
-						 numConfigs );
+      pMGAConfigs = (MGAConfigPrivPtr)calloc( numConfigs,
+					      sizeof(MGAConfigPrivRec) );
       if ( !pMGAConfigs ) {
-	 xfree( pConfigs );
+	 free( pConfigs );
 	 return FALSE;
       }
 
-      pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr),
-						     numConfigs );
+      pMGAConfigPtrs = (MGAConfigPrivPtr*)calloc( numConfigs,
+						  sizeof(MGAConfigPrivPtr) );
       if ( !pMGAConfigPtrs ) {
-	 xfree( pConfigs );
-	 xfree( pMGAConfigs );
+	 free( pConfigs );
+	 free( pMGAConfigs );
 	 return FALSE;
       }
 
@@ -183,24 +183,24 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen )
    case 32:
       numConfigs = 8;
 
-      pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig),
-						numConfigs );
+      pConfigs = (__GLXvisualConfig*)calloc( numConfigs,
+					     sizeof(__GLXvisualConfig) );
       if ( !pConfigs ) {
 	 return FALSE;
       }
 
-      pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec),
-						 numConfigs );
+      pMGAConfigs = (MGAConfigPrivPtr)calloc( numConfigs,
+					      sizeof(MGAConfigPrivRec) );
       if ( !pMGAConfigs ) {
-	 xfree( pConfigs );
+	 free( pConfigs );
 	 return FALSE;
       }
 
-      pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr),
-						     numConfigs );
+      pMGAConfigPtrs = (MGAConfigPrivPtr*)calloc( numConfigs,
+						  sizeof(MGAConfigPrivPtr) );
       if ( !pMGAConfigPtrs ) {
-	 xfree( pConfigs );
-	 xfree( pMGAConfigs );
+	 free( pConfigs );
+	 free( pMGAConfigs );
 	 return FALSE;
       }
 
@@ -974,11 +974,11 @@ static void MGADRIMoveBuffersXAA(WindowPtr pParent, 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;
@@ -1009,14 +1009,14 @@ static void MGADRIMoveBuffersXAA(WindowPtr pParent, DDXPointRec ptOldOrg,
 
         if (nbox > 1) {
 	    /*reverse orderof 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) {
-	        if (pptNew2) xfree(pptNew2);
-	        if (pboxNew2) xfree(pboxNew2);
+	        if (pptNew2) free(pptNew2);
+	        if (pboxNew2) free(pboxNew2);
 	        if (pboxNew1) {
-		    xfree(pptNew1);
-		    xfree(pboxNew1);
+		    free(pptNew1);
+		    free(pboxNew1);
 		}
 	       return;
 	    }
@@ -1067,12 +1067,12 @@ static void MGADRIMoveBuffersXAA(WindowPtr pParent, DDXPointRec ptOldOrg,
     MGASelectBuffer(pScrn, MGA_FRONT);
 
     if (pboxNew2) {
-        xfree(pptNew2);
-        xfree(pboxNew2);
+        free(pptNew2);
+        free(pboxNew2);
     }
     if (pboxNew1) {
-        xfree(pptNew1);
-        xfree(pboxNew1);
+        free(pptNew1);
+        free(pboxNew1);
     }
 
     pMga->AccelInfoRec->NeedToSync = TRUE;
@@ -1151,7 +1151,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
    if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
       pDRIInfo->busIdString = DRICreatePCIBusID(pMga->PciInfo);
    } else {
-      pDRIInfo->busIdString = xalloc(64);
+      pDRIInfo->busIdString = malloc(64);
       sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d",
 #ifdef XSERVER_LIBPCIACCESS
 	       ((pMga->PciInfo->domain << 8) | pMga->PciInfo->bus),
@@ -1199,7 +1199,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
 
    pDRIInfo->SAREASize = SAREA_MAX;
 
-   pMGADRI = (MGADRIPtr)xcalloc( sizeof(MGADRIRec), 1 );
+   pMGADRI = (MGADRIPtr)calloc( 1, sizeof(MGADRIRec) );
    if ( !pMGADRI ) {
       DRIDestroyInfoRec( pMga->pDRIInfo );
       pMga->pDRIInfo = 0;
@@ -1209,9 +1209,9 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
    }
 
    pMGADRIServer = (MGADRIServerPrivatePtr)
-      xcalloc( sizeof(MGADRIServerPrivateRec), 1 );
+      calloc( 1, sizeof(MGADRIServerPrivateRec) );
    if ( !pMGADRIServer ) {
-      xfree( pMGADRI );
+      free( pMGADRI );
       DRIDestroyInfoRec( pMga->pDRIInfo );
       pMga->pDRIInfo = 0;
       xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
@@ -1250,9 +1250,9 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
    pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
 
    if ( !DRIScreenInit( pScreen, pDRIInfo, &pMga->drmFD ) ) {
-      xfree( pMGADRIServer );
+      free( pMGADRIServer );
       pMga->DRIServerInfo = 0;
-      xfree( pDRIInfo->devPrivate );
+      free( pDRIInfo->devPrivate );
       pDRIInfo->devPrivate = 0;
       DRIDestroyInfoRec( pMga->pDRIInfo );
       pMga->pDRIInfo = 0;
@@ -1496,20 +1496,20 @@ void MGADRICloseScreen( ScreenPtr pScreen )
 
    if ( pMga->pDRIInfo ) {
       if ( pMga->pDRIInfo->devPrivate ) {
-	 xfree( pMga->pDRIInfo->devPrivate );
+	 free( pMga->pDRIInfo->devPrivate );
 	 pMga->pDRIInfo->devPrivate = 0;
       }
       DRIDestroyInfoRec( pMga->pDRIInfo );
       pMga->pDRIInfo = 0;
    }
    if ( pMga->DRIServerInfo ) {
-      xfree( pMga->DRIServerInfo );
+      free( pMga->DRIServerInfo );
       pMga->DRIServerInfo = 0;
    }
    if ( pMga->pVisualConfigs ) {
-      xfree( pMga->pVisualConfigs );
+      free( pMga->pVisualConfigs );
    }
    if ( pMga->pVisualConfigsPriv ) {
-      xfree( pMga->pVisualConfigsPriv );
+      free( pMga->pVisualConfigsPriv );
    }
 }
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 7232c73..01bec70 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -646,7 +646,7 @@ MGAFreeRec(ScrnInfoPtr pScrn)
 {
     if (pScrn->driverPrivate == NULL)
 	return;
-    xfree(pScrn->driverPrivate);
+    free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 }
 
@@ -813,7 +813,7 @@ MGAProbe(DriverPtr drv, int flags)
 			            MGAChipsets, MGAPciChipsets, devSections,
 			            numDevSections, drv, &usedChips);
     /* Free it since we don't need that list after this */
-    xfree(devSections);
+    free(devSections);
     if (numUsed <= 0)
 	return FALSE;
 
@@ -971,7 +971,7 @@ MGAProbe(DriverPtr drv, int flags)
 	    }
         }
     }
-    xfree(usedChips);
+    free(usedChips);
 
     return foundScreen;
 }
@@ -1747,7 +1747,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 #endif
     }
 
-    if (!(pMga->Options = xalloc(sizeof(MGAOptions))))
+    if (!(pMga->Options = malloc(sizeof(MGAOptions))))
 	return FALSE;
     memcpy(pMga->Options, MGAOptions, sizeof(MGAOptions));
 
@@ -2444,7 +2444,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
         switch(pMga->Chipset) {
 	case PCI_CHIP_MGA2064:
 	   if (!pMga->NoAccel) {
-		linePitches = xalloc(sizeof(Pitches1));
+		linePitches = malloc(sizeof(Pitches1));
 		memcpy(linePitches, Pitches1, sizeof(Pitches1));
 		minPitch = maxPitch = 0;
 	   }
@@ -2453,7 +2453,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	case PCI_CHIP_MGA2164_AGP:
 	case PCI_CHIP_MGA1064:
 	   if (!pMga->NoAccel) {
-		linePitches = xalloc(sizeof(Pitches2));
+		linePitches = malloc(sizeof(Pitches2));
 		memcpy(linePitches, Pitches2, sizeof(Pitches2));
 		minPitch = maxPitch = 0;
 	   }
@@ -2491,7 +2491,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 			      LOOKUP_BEST_REFRESH);
       
 	if (linePitches)
-	   xfree(linePitches);
+	   free(linePitches);
     }
 
     if (i < 1 && pMga->FBDev) {
@@ -2518,8 +2518,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 
     if(pMga->SecondCrtc == FALSE) {
 	
-        pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize());
-        pMga->pClientStruct = xalloc(sizeof(CLIENTDATA));
+        pMga->pBoard = malloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize());
+        pMga->pClientStruct = malloc(sizeof(CLIENTDATA));
         pMga->pClientStruct->pMga = (MGAPtr) pMga;
 
         MGAMapMem(pScrn);
@@ -2539,7 +2539,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
         MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA));
 	outMGAdac(MGA1064_MISC_CTL,MiscCtlReg);
         MGAUnmapMem(pScrn);
-        pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO));
+        pMga->pMgaHwInfo = malloc(sizeof(MGAHWINFO));
         MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo);
 
         /* copy the board handles */
@@ -2805,26 +2805,26 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	      MGACloseLibrary(pMga->pBoard);
 
 	      if (pMga->pBoard)
-	        xfree(pMga->pBoard);
+	        free(pMga->pBoard);
 	      if (pMga->pClientStruct)
-	        xfree(pMga->pClientStruct);
+	        free(pMga->pClientStruct);
 	      if (pMga->pMgaModeInfo)
-	        xfree(pMga->pMgaModeInfo);
+	        free(pMga->pMgaModeInfo);
 	      if (pMga->pMgaHwInfo)
-	        xfree(pMga->pMgaHwInfo);
+	        free(pMga->pMgaHwInfo);
 	      pMgaEnt->refCount = 0;
 	  }
       } else {
 	  MGACloseLibrary(pMga->pBoard);
 
 	  if (pMga->pBoard)
-	    xfree(pMga->pBoard);
+	    free(pMga->pBoard);
 	  if (pMga->pClientStruct)
-	    xfree(pMga->pClientStruct);
+	    free(pMga->pClientStruct);
 	  if (pMga->pMgaModeInfo)
-	    xfree(pMga->pMgaModeInfo);
+	    free(pMga->pMgaModeInfo);
 	  if (pMga->pMgaHwInfo)
-	    xfree(pMga->pMgaHwInfo);
+	    free(pMga->pMgaHwInfo);
       }
 
     );	/* MGA_HAL */
@@ -3039,7 +3039,7 @@ MGAFillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode)
     }
 
     /*FIXME: causes segfault elsewhere if not commented*/
-    /*if(!pMga->pMgaModeInfo)*/ pMga->pMgaModeInfo = xalloc(sizeof(MGAMODEINFO));
+    /*if(!pMga->pMgaModeInfo)*/ pMga->pMgaModeInfo = malloc(sizeof(MGAMODEINFO));
     pMga->pMgaModeInfo->flOutput = 0;
     pMga->pMgaModeInfo->ulDeskWidth = pScrn->virtualX;
     pMga->pMgaModeInfo->ulDeskHeight = pScrn->virtualY;
@@ -3514,15 +3514,15 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
        MGA_HAL(
        if(pMgaEnt->refCount == 1) {
 	   CARD8 MiscCtlReg;
-	  pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize());
-	  pMga->pClientStruct = xalloc(sizeof(CLIENTDATA));
+	  pMga->pBoard = malloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize());
+	  pMga->pClientStruct = malloc(sizeof(CLIENTDATA));
 	  pMga->pClientStruct->pMga = (MGAPtr) pMga;
 	  
 	  /* wrapping OpenLibrary to fix broken registers. MATROX: hint,hint.*/
           MiscCtlReg = inMGAdac(MGA1064_MISC_CTL);
 	  MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA));
 	  outMGAdac(MGA1064_MISC_CTL,MiscCtlReg);
-	  pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO));
+	  pMga->pMgaHwInfo = malloc(sizeof(MGAHWINFO));
 	  MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo);
 
 	  /* Detecting for type of display */
@@ -3556,15 +3556,15 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	CARD8 MiscCtlReg;
 
 	  MGA_HAL(
-	  pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize());
-	  pMga->pClientStruct = xalloc(sizeof(CLIENTDATA));
+	  pMga->pBoard = malloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize());
+	  pMga->pClientStruct = malloc(sizeof(CLIENTDATA));
 	  pMga->pClientStruct->pMga = (MGAPtr) pMga;
 
 	  MiscCtlReg = inMGAdac(MGA1064_MISC_CTL);
 	  /* wrapping OpenLibrary to fix broken registers. MATROX: hint,hint.*/
 	  MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA));
 	  outMGAdac(MGA1064_MISC_CTL,MiscCtlReg);
-	  pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO));
+	  pMga->pMgaHwInfo = malloc(sizeof(MGAHWINFO));
 	  MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo);
 	  );	/* MGA_HAL */
 #endif
@@ -3687,7 +3687,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     if(pMga->ShadowFB) {
  	pMga->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
-	pMga->ShadowPtr = xalloc(pMga->ShadowPitch * height);
+	pMga->ShadowPtr = malloc(pMga->ShadowPitch * height);
 	displayWidth = pMga->ShadowPitch / (pScrn->bitsPerPixel >> 3);
         FBStart = pMga->ShadowPtr;
     } else {
@@ -4241,25 +4241,25 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
 	 MGACloseLibrary(pMga->pBoard);
 
 	 if (pMga->pBoard)
-	   xfree(pMga->pBoard);
+	   free(pMga->pBoard);
 	 if (pMga->pClientStruct)
-	   xfree(pMga->pClientStruct);
+	   free(pMga->pClientStruct);
 	 if (pMga->pMgaModeInfo)
-	   xfree(pMga->pMgaModeInfo);
+	   free(pMga->pMgaModeInfo);
 	 if (pMga->pMgaHwInfo)
-	   xfree(pMga->pMgaHwInfo);
+	   free(pMga->pMgaHwInfo);
       }
    } else {
       MGACloseLibrary(pMga->pBoard);
 
       if (pMga->pBoard)
-	xfree(pMga->pBoard);
+	free(pMga->pBoard);
       if (pMga->pClientStruct)
-	xfree(pMga->pClientStruct);
+	free(pMga->pClientStruct);
       if (pMga->pMgaModeInfo)
-	xfree(pMga->pMgaModeInfo);
+	free(pMga->pMgaModeInfo);
       if (pMga->pMgaHwInfo)
-	xfree(pMga->pMgaHwInfo);
+	free(pMga->pMgaHwInfo);
    }
    );	/* MGA_HAL */
 #endif
@@ -4271,21 +4271,21 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
 #ifdef USE_EXA
     if (pMga->ExaDriver) {
 	exaDriverFini(pScreen);
-	xfree(pMga->ExaDriver);
+	free(pMga->ExaDriver);
     }
 #endif
     if (pMga->CursorInfoRec)
     	xf86DestroyCursorInfoRec(pMga->CursorInfoRec);
     if (pMga->ShadowPtr)
-	xfree(pMga->ShadowPtr);
+	free(pMga->ShadowPtr);
     if (pMga->DGAModes)
-	xfree(pMga->DGAModes);
+	free(pMga->DGAModes);
     if (pMga->adaptor)
-	xfree(pMga->adaptor);
+	free(pMga->adaptor);
     if (pMga->portPrivate)
-	xfree(pMga->portPrivate);
+	free(pMga->portPrivate);
     if (pMga->ScratchBuffer)
-	xfree(pMga->ScratchBuffer);
+	free(pMga->ScratchBuffer);
 
     pScrn->vtSema = FALSE;
 
diff --git a/src/mga_merge.c b/src/mga_merge.c
index 1fd0572..7121d05 100644
--- a/src/mga_merge.c
+++ b/src/mga_merge.c
@@ -70,9 +70,9 @@ CopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest, DisplayModePtr i, DisplayM
     DisplayModePtr mode;
     int dx = 0,dy = 0;
     /* start with first node */
-    mode = xalloc(sizeof(DisplayModeRec));
+    mode = malloc(sizeof(DisplayModeRec));
     memcpy(mode,i, sizeof(DisplayModeRec));
-    mode->Private = xalloc(sizeof(MergedDisplayModeRec));
+    mode->Private = malloc(sizeof(MergedDisplayModeRec));
     ((MergedDisplayModePtr)mode->Private)->Monitor1 = i;
     ((MergedDisplayModePtr)mode->Private)->Monitor2 = j;
     ((MergedDisplayModePtr)mode->Private)->Monitor2Pos = srel;
@@ -242,7 +242,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
     MgaScrn2Rel Monitor2Pos;
 
     xf86DrvMsg(pScrn1->scrnIndex, X_INFO, "==== Start of second screen initialization ====\n");
-    pScrn = xalloc(sizeof(ScrnInfoRec));
+    pScrn = malloc(sizeof(ScrnInfoRec));
     memcpy(pScrn,pScrn1,sizeof(ScrnInfoRec));
    
     pScrn->driverPrivate = NULL; 
@@ -276,7 +276,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
 
     /* Set pScrn->monitor */
     {
-        pScrn->monitor = xalloc(sizeof(MonRec));
+        pScrn->monitor = malloc(sizeof(MonRec));
         /* copy everything we don't care about */
         memcpy(pScrn->monitor,pScrn1->monitor,sizeof(MonRec));
         pScrn->monitor->DDC = NULL;   /*FIXME:have to try this */ 
@@ -494,7 +494,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
         switch(pMga->Chipset) {
 	case PCI_CHIP_MGA2064:
 	   if (!pMga->NoAccel) {
-		linePitches = xalloc(sizeof(Pitches1));
+		linePitches = malloc(sizeof(Pitches1));
 		memcpy(linePitches, Pitches1, sizeof(Pitches1));
 		minPitch = maxPitch = 0;
 	   }
@@ -503,7 +503,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
 	case PCI_CHIP_MGA2164_AGP:
 	case PCI_CHIP_MGA1064:
 	   if (!pMga->NoAccel) {
-		linePitches = xalloc(sizeof(Pitches2));
+		linePitches = malloc(sizeof(Pitches2));
 		memcpy(linePitches, Pitches2, sizeof(Pitches2));
 		minPitch = maxPitch = 0;
 	   }
@@ -539,7 +539,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
 			      LOOKUP_BEST_REFRESH);
         
 	if (linePitches)
-	   xfree(linePitches);
+	   free(linePitches);
     }
 
 
@@ -918,10 +918,10 @@ MGACloseScreenMerged(int scrnIndex, ScreenPtr pScreen) {
     ScrnInfoPtr pScrn2 = pMga->pScrn2;
 
     if(pScrn2) {
-        xfree(pScrn2->monitor);
+        free(pScrn2->monitor);
         pScrn2->monitor = NULL;
 
-        xfree(pScrn2);
+        free(pScrn2);
         pMga->pScrn2 = NULL;
     }
 
@@ -930,8 +930,8 @@ MGACloseScreenMerged(int scrnIndex, ScreenPtr pScreen) {
         do {
             DisplayModePtr p = pScrn1->currentMode->next; 
             if(pScrn1->currentMode->Private) 
-                xfree(pScrn1->currentMode->Private);
-            xfree(pScrn1->currentMode);
+                free(pScrn1->currentMode->Private);
+            free(pScrn1->currentMode);
             pScrn1->currentMode = p;
         }while( pScrn1->currentMode != pScrn1->modes);
     }
diff --git a/src/mga_storm.c b/src/mga_storm.c
index db7fae7..f0e6194 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -583,7 +583,7 @@ Bool mgaAccelInit( ScreenPtr pScreen )
     BoxRec AvailFBArea;
     int i;
 
-    pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel) + 127) >> 3);
+    pMga->ScratchBuffer = malloc(((pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel) + 127) >> 3);
     if(!pMga->ScratchBuffer) return FALSE;
 
     pMga->AccelInfoRec = infoPtr = XAACreateInfoRec();
diff --git a/src/mga_vga.c b/src/mga_vga.c
index 9f00b3d..0ac8bf7 100644
--- a/src/mga_vga.c
+++ b/src/mga_vga.c
@@ -197,17 +197,17 @@ MGAG200SESaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
     hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */
     hwp->writeGr(hwp, 0x05, 0x00);  /* write mode 0, read mode 0 */
     hwp->writeGr(hwp, 0x06, 0x05);  /* set graphics */
-    if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) {
+    if (hwp->FontInfo1 || (hwp->FontInfo1 = malloc(FONT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
 	hwp->writeGr(hwp, 0x04, 0x02);  /* read plane 2 */
 	slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
     }
-    if (hwp->FontInfo2 || (hwp->FontInfo2 = xalloc(FONT_AMOUNT))) {
+    if (hwp->FontInfo2 || (hwp->FontInfo2 = malloc(FONT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
 	hwp->writeGr(hwp, 0x04, 0x03);  /* read plane 3 */
 	slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
     }
-    if (hwp->TextInfo || (hwp->TextInfo = xalloc(2 * TEXT_AMOUNT))) {
+    if (hwp->TextInfo || (hwp->TextInfo = malloc(2 * TEXT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
 	hwp->writeGr(hwp, 0x04, 0x00);  /* read plane 0 */
 	slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
diff --git a/src/mga_video.c b/src/mga_video.c
index a69c973..d251370 100644
--- a/src/mga_video.c
+++ b/src/mga_video.c
@@ -132,7 +132,7 @@ void MGAInitVideo(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));
@@ -147,7 +147,7 @@ void MGAInitVideo(ScreenPtr pScreen)
         xf86XVScreenInit(pScreen, adaptors, num_adaptors);
 
     if(newAdaptors)
-	xfree(newAdaptors);
+	free(newAdaptors);
 }
 
 /* client libraries expect an encoding */
@@ -231,10 +231,10 @@ MGAAllocAdaptor(ScrnInfoPtr pScrn, Bool doublebuffer)
     if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn)))
 	return NULL;
 
-    if(!(pPriv = xcalloc(1, sizeof(MGAPortPrivRec) + 
+    if(!(pPriv = calloc(1, sizeof(MGAPortPrivRec) + 
 			(sizeof(DevUnion) * MGA_MAX_PORTS)))) 
     {
-	xfree(adapt);
+	free(adapt);
 	return NULL;
     }
 
@@ -1082,18 +1082,18 @@ MGAAllocateSurface(
     surface->width = w;
     surface->height = h;
 
-    if(!(surface->pitches = xalloc(sizeof(int)))) {
+    if(!(surface->pitches = malloc(sizeof(int)))) {
         MGAFreeMemory(pScrn, surface_memory);
 	return BadAlloc;
     }
-    if(!(surface->offsets = xalloc(sizeof(int)))) {
-	xfree(surface->pitches);
+    if(!(surface->offsets = malloc(sizeof(int)))) {
+	free(surface->pitches);
         MGAFreeMemory(pScrn, surface_memory);
 	return BadAlloc;
     }
-    if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) {
-	xfree(surface->pitches);
-	xfree(surface->offsets);
+    if(!(pPriv = malloc(sizeof(OffscreenPrivRec)))) {
+	free(surface->pitches);
+	free(surface->offsets);
         MGAFreeMemory(pScrn, surface_memory);
 	return BadAlloc;
     }
@@ -1137,9 +1137,9 @@ MGAFreeSurface(
     if(pPriv->isOn)
 	MGAStopSurface(surface);
     MGAFreeMemory(pScrn, pPriv->surface_memory);
-    xfree(surface->pitches);
-    xfree(surface->offsets);
-    xfree(surface->devPrivate.ptr);
+    free(surface->pitches);
+    free(surface->offsets);
+    free(surface->devPrivate.ptr);
 
     return Success;
 }
@@ -1231,7 +1231,7 @@ MGAInitOffscreenImages(ScreenPtr pScreen)
     XF86OffscreenImagePtr offscreenImages;
 
     /* need to free this someplace */
-    if(!(offscreenImages = xalloc(num * sizeof(XF86OffscreenImageRec))))
+    if(!(offscreenImages = malloc(num * sizeof(XF86OffscreenImageRec))))
 	return;
 
     offscreenImages[0].image = &Images[0];
-- 
1.7.3.4


More information about the xorg-devel mailing list