diff src/video/vgl/SDL_vglvideo.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
line wrap: on
line diff
--- a/src/video/vgl/SDL_vglvideo.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/video/vgl/SDL_vglvideo.c	Tue Feb 07 06:59:48 2006 +0000
@@ -108,8 +108,8 @@
 
 static void VGL_DeleteDevice(SDL_VideoDevice *device)
 {
-	free(device->hidden);
-	free(device);
+	SDL_free(device->hidden);
+	SDL_free(device);
 }
 
 static SDL_VideoDevice *VGL_CreateDevice(int devindex)
@@ -117,20 +117,20 @@
 	SDL_VideoDevice *device;
 
 	/* Initialize all variables that we clean on shutdown */
-	device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice));
+	device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
 	if ( device ) {
-		memset(device, 0, (sizeof *device));
+		SDL_memset(device, 0, (sizeof *device));
 		device->hidden = (struct SDL_PrivateVideoData *)
-				  malloc((sizeof *device->hidden));
+				  SDL_malloc((sizeof *device->hidden));
 	}
 	if ( (device == NULL) || (device->hidden == NULL) ) {
 		SDL_OutOfMemory();
 		if ( device ) {
-			free(device);
+			SDL_free(device);
 		}
 		return(0);
 	}
-	memset(device->hidden, 0, (sizeof *device->hidden));
+	SDL_memset(device->hidden, 0, (sizeof *device->hidden));
 
 	/* Set the function pointers */
 	device->VideoInit = VGL_VideoInit;
@@ -188,7 +188,7 @@
 	}
 
 	/* Set up the new video mode rectangle */
-	mode = (SDL_Rect *)malloc(sizeof *mode);
+	mode = (SDL_Rect *)SDL_malloc(sizeof *mode);
 	if (mode == NULL) {
 		SDL_OutOfMemory();
 		return -1;
@@ -201,11 +201,11 @@
 	/* Allocate the new list of modes, and fill in the new mode */
 	next_mode = SDL_nummodes[index];
 	SDL_modelist[index] = (SDL_Rect **)
-		realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
+		SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
 	if (SDL_modelist[index] == NULL) {
 		SDL_OutOfMemory();
 		SDL_nummodes[index] = 0;
-		free(mode);
+		SDL_free(mode);
 		return -1;
 	}
 	SDL_modelist[index][next_mode] = mode;
@@ -243,7 +243,7 @@
 	}
 
 	/* Enable mouse and keyboard support */
-	if (getenv("SDL_NO_RAWKBD") == NULL) {
+	if (SDL_getenv("SDL_NO_RAWKBD") == NULL) {
 		if (VGLKeyboardInit(VGL_CODEKEYS) != 0) {
 			SDL_SetError("Unable to initialize keyboard");
 			return -1;
@@ -340,7 +340,7 @@
 		return NULL;
 	}
 
-	VGLCurMode = realloc(VGLCurMode, sizeof(VGLMode));
+	VGLCurMode = SDL_realloc(VGLCurMode, sizeof(VGLMode));
 	VGLCurMode->ModeInfo = *VGLDisplay;
 	VGLCurMode->Depth = modes[i]->Depth;
 	VGLCurMode->ModeId = modes[i]->ModeId;
@@ -466,7 +466,7 @@
 	/* Reset the console video mode if we actually initialised one */
 	if (VGLCurMode != NULL) {
 		VGLEnd();
-		free(VGLCurMode);
+		SDL_free(VGLCurMode);
 		VGLCurMode = NULL;
 	}
 
@@ -480,9 +480,9 @@
 	for (i = 0; i < NUM_MODELISTS; i++) {
 		if (SDL_modelist[i] != NULL) {
 			for (j = 0; SDL_modelist[i][j] != NULL; ++j) {
-				free(SDL_modelist[i][j]);
+				SDL_free(SDL_modelist[i][j]);
 			}
-			free(SDL_modelist[i]);
+			SDL_free(SDL_modelist[i]);
 			SDL_modelist[i] = NULL;
 		}
 	}
@@ -508,7 +508,7 @@
   int adptype, i, modenum;
 
   if (modes == NULL) {
-    modes = malloc(sizeof(VGLMode *) * M_VESA_MODE_MAX);
+    modes = SDL_malloc(sizeof(VGLMode *) * M_VESA_MODE_MAX);
     bzero(modes, sizeof(VGLMode *) * M_VESA_MODE_MAX);
   }
   modesp = modes;
@@ -621,7 +621,7 @@
   }
 
   if (*modesp != NULL) {
-    free(*modesp);
+    SDL_free(*modesp);
     *modesp = NULL;
   }