[PATCH xf86-video-trident] Fix up deprecated/obsolete code.

Trevor Woerner twoerner at gmail.com
Thu Jul 29 09:38:57 PDT 2010


From: Trevor Woerner <twoerner at gmail.com>

The compile issues several warnings regarding obsolete or deprecated
code (moving away from Xalloc(), Xcalloc(), Xfree() etc...). This
change removes all such warnings.

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

diff --git a/src/trident_dga.c b/src/trident_dga.c
index 78fa8f4..dd836a6 100644
--- a/src/trident_dga.c
+++ b/src/trident_dga.c
@@ -83,15 +83,15 @@ TRIDENTDGAInit(ScreenPtr pScreen)
    while(pMode) {
 
 	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/trident_driver.c b/src/trident_driver.c
index 31cbb83..9192800 100644
--- a/src/trident_driver.c
+++ b/src/trident_driver.c
@@ -63,7 +63,7 @@
 
 #ifdef XFreeXDGA
 #define _XF86DGA_SERVER_
-#include <X11/extensions/xf86dgastr.h>
+#include <X11/extensions/xf86dgaproto.h>
 #endif
 
 #include "globals.h"
@@ -560,7 +560,7 @@ TRIDENTFreeRec(ScrnInfoPtr pScrn)
 {
     if (pScrn->driverPrivate == NULL)
 	return;
-    xfree(pScrn->driverPrivate);
+    free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 }
 
@@ -900,7 +900,7 @@ TRIDENTProbe(DriverPtr drv, int flags)
 		    foundScreen = TRUE;
 		}
 	    }
-	    xfree(usedChips);
+	    free(usedChips);
 	}
     }
 
@@ -937,7 +937,7 @@ TRIDENTProbe(DriverPtr drv, int flags)
     }
 #endif    
 
-    xfree(devSections);
+    free(devSections);
     return foundScreen;
 }
 	
@@ -1163,7 +1163,7 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags)
     xf86CollectOptions(pScrn, NULL);
 
     /* Process the options */
-    if (!(pTrident->Options = xalloc(sizeof(TRIDENTOptions))))
+    if (!(pTrident->Options = malloc(sizeof(TRIDENTOptions))))
 	return FALSE;
     memcpy(pTrident->Options, TRIDENTOptions, sizeof(TRIDENTOptions));
     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTrident->Options);
@@ -2868,7 +2868,7 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     if(pTrident->ShadowFB) {
  	pTrident->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
-        pTrident->ShadowPtr = xalloc(pTrident->ShadowPitch * height);
+        pTrident->ShadowPtr = malloc(pTrident->ShadowPitch * height);
 	displayWidth = pTrident->ShadowPitch / (pScrn->bitsPerPixel >> 3);
         FBStart = pTrident->ShadowPtr;
     } else {
@@ -3238,15 +3238,15 @@ TRIDENTCloseScreen(int scrnIndex, ScreenPtr pScreen)
 	XAADestroyInfoRec(pTrident->AccelInfoRec);
     if (pTrident->EXADriverPtr) {
 	exaDriverFini(pScreen);
-	xfree(pTrident->EXADriverPtr);
+	free(pTrident->EXADriverPtr);
 	pTrident->EXADriverPtr = NULL;
     }	
     if (pTrident->CursorInfoRec)
 	xf86DestroyCursorInfoRec(pTrident->CursorInfoRec);
     if (pTrident->ShadowPtr)
-	xfree(pTrident->ShadowPtr);
+	free(pTrident->ShadowPtr);
     if (pTrident->DGAModes)
-	xfree(pTrident->DGAModes);
+	free(pTrident->DGAModes);
     pScrn->vtSema = FALSE;
 
     if(pTrident->BlockHandler)
diff --git a/src/trident_video.c b/src/trident_video.c
index 0c5497b..1ed7db2 100644
--- a/src/trident_video.c
+++ b/src/trident_video.c
@@ -125,7 +125,7 @@ void TRIDENTInitVideo(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));
@@ -140,7 +140,7 @@ void TRIDENTInitVideo(ScreenPtr pScreen)
         xf86XVScreenInit(pScreen, adaptors, num_adaptors);
 
     if(newAdaptors)
-	xfree(newAdaptors);
+	free(newAdaptors);
 
     if (pTrident->videoFlags)
 	xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,
@@ -321,7 +321,7 @@ TRIDENTSetupImageVideo(ScreenPtr pScreen)
     XF86VideoAdaptorPtr adapt;
     TRIDENTPortPrivPtr pPriv;
 
-    if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
+    if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
 			    sizeof(TRIDENTPortPrivRec) +
 			    sizeof(DevUnion))))
 	return NULL;
@@ -978,18 +978,18 @@ TRIDENTAllocateSurface(
     surface->width = w;
     surface->height = h;
 
-    if(!(surface->pitches = xalloc(sizeof(int)))) {
+    if(!(surface->pitches = malloc(sizeof(int)))) {
 	xf86FreeOffscreenLinear(linear);
 	return BadAlloc;
     }
-    if(!(surface->offsets = xalloc(sizeof(int)))) {
-	xfree(surface->pitches);
+    if(!(surface->offsets = malloc(sizeof(int)))) {
+	free(surface->pitches);
 	xf86FreeOffscreenLinear(linear);
 	return BadAlloc;
     }
-    if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) {
-	xfree(surface->pitches);
-	xfree(surface->offsets);
+    if(!(pPriv = malloc(sizeof(OffscreenPrivRec)))) {
+	free(surface->pitches);
+	free(surface->offsets);
 	xf86FreeOffscreenLinear(linear);
 	return BadAlloc;
     }
@@ -1034,9 +1034,9 @@ TRIDENTFreeSurface(
     if(pPriv->isOn)
 	TRIDENTStopSurface(surface);
     xf86FreeOffscreenLinear(pPriv->linear);
-    xfree(surface->pitches);
-    xfree(surface->offsets);
-    xfree(surface->devPrivate.ptr);
+    free(surface->pitches);
+    free(surface->offsets);
+    free(surface->devPrivate.ptr);
 
     return Success;
 }
@@ -1128,7 +1128,7 @@ TRIDENTInitOffscreenImages(ScreenPtr pScreen)
     XF86OffscreenImagePtr offscreenImages;
 
     /* need to free this someplace */
-    if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec))))
+    if(!(offscreenImages = malloc(sizeof(XF86OffscreenImageRec))))
 	return;
 
     offscreenImages[0].image = &Images[0];
-- 
1.7.1



More information about the xorg-devel mailing list