diff src/video/gapi/SDL_gapivideo.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/gapi/SDL_gapivideo.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/video/gapi/SDL_gapivideo.c	Tue Feb 07 06:59:48 2006 +0000
@@ -177,7 +177,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);
@@ -190,11 +190,11 @@
 	/* Allocate the new list of modes, and fill in the new mode */
 	next_mode = gapi->SDL_nummodes[index];
 	gapi->SDL_modelist[index] = (SDL_Rect **)
-	       realloc(gapi->SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
+	       SDL_realloc(gapi->SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
 	if ( gapi->SDL_modelist[index] == NULL ) {
 		SDL_OutOfMemory();
 		gapi->SDL_nummodes[index] = 0;
-		free(mode);
+		SDL_free(mode);
 		return(-1);
 	}
 	gapi->SDL_modelist[index][next_mode] = mode;
@@ -211,8 +211,8 @@
 		FreeLibrary(g_hGapiLib);
 		g_hGapiLib = 0;
 	}
-	free(device->hidden);
-	free(device);
+	SDL_free(device->hidden);
+	SDL_free(device);
 }
 
 static SDL_VideoDevice *GAPI_CreateDevice(int devindex)
@@ -229,20 +229,20 @@
 	}
 
 	/* 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 = GAPI_VideoInit;
@@ -661,10 +661,10 @@
 	/* Allocate bitmap */
 	if(gapiBuffer) 
 	{
-		free(gapiBuffer);
+		SDL_free(gapiBuffer);
 		gapiBuffer = NULL;
 	}
-	gapiBuffer = malloc(video->h * video->pitch);
+	gapiBuffer = SDL_malloc(video->h * video->pitch);
 	video->pixels = gapiBuffer; 
 
 	if ( ! this->hidden->buffer ) {
@@ -672,7 +672,7 @@
 		return(NULL);
 	}
 
-	memset(gapiBuffer, 255, video->h * video->pitch);
+	SDL_memset(gapiBuffer, 255, video->h * video->pitch);
 	MoveWindow(SDL_Window, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), FALSE);
 	ShowWindow(SDL_Window, SW_SHOW);
 	SetForegroundWindow(SDL_Window);
@@ -738,7 +738,7 @@
 {
 	if( gapi->dstPixelStep == 1) /* optimized blitting on most devices */
 	{
-		memcpy(destPointer, srcPointer, width);
+		SDL_memcpy(destPointer, srcPointer, width);
 		return 1;
 	} else
 	{
@@ -761,7 +761,7 @@
 
 	if( step == 1 ) /* optimized blitting on most devices */
 	{
-		memcpy(destPointer, srcPointer, width * sizeof(PIXEL));
+		SDL_memcpy(destPointer, srcPointer, width * sizeof(PIXEL));
 		return 1;
 	}
 	else
@@ -1062,7 +1062,7 @@
 
 		if (this->screen->pixels != NULL)
 		{
-			free(this->screen->pixels);
+			SDL_free(this->screen->pixels);
 			this->screen->pixels = NULL;
 		}
 		if ( screen_icn ) {
@@ -1089,8 +1089,8 @@
 	for ( i=0; i<NUM_MODELISTS; ++i ) {
 		if ( gapi->SDL_modelist[i] != NULL ) {
 			for ( j=0; gapi->SDL_modelist[i][j]; ++j )
-				free(gapi->SDL_modelist[i][j]);
-			free(gapi->SDL_modelist[i]);
+				SDL_free(gapi->SDL_modelist[i][j]);
+			SDL_free(gapi->SDL_modelist[i]);
 			gapi->SDL_modelist[i] = NULL;
 		}
 	}