diff src/video/SDL_surface.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 450721ad5436
children 604d73db6802
line wrap: on
line diff
--- a/src/video/SDL_surface.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/video/SDL_surface.c	Tue Feb 07 06:59:48 2006 +0000
@@ -77,7 +77,7 @@
 	}
 
 	/* Allocate the surface */
-	surface = (SDL_Surface *)malloc(sizeof(*surface));
+	surface = (SDL_Surface *)SDL_malloc(sizeof(*surface));
 	if ( surface == NULL ) {
 		SDL_OutOfMemory();
 		return(NULL);
@@ -103,7 +103,7 @@
 	}
 	surface->format = SDL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask);
 	if ( surface->format == NULL ) {
-		free(surface);
+		SDL_free(surface);
 		return(NULL);
 	}
 	if ( Amask ) {
@@ -125,14 +125,14 @@
 	if ( ((flags&SDL_HWSURFACE) == SDL_SWSURFACE) || 
 				(video->AllocHWSurface(this, surface) < 0) ) {
 		if ( surface->w && surface->h ) {
-			surface->pixels = malloc(surface->h*surface->pitch);
+			surface->pixels = SDL_malloc(surface->h*surface->pitch);
 			if ( surface->pixels == NULL ) {
 				SDL_FreeSurface(surface);
 				SDL_OutOfMemory();
 				return(NULL);
 			}
 			/* This is important for bitmaps */
-			memset(surface->pixels, 0, surface->h*surface->pitch);
+			SDL_memset(surface->pixels, 0, surface->h*surface->pitch);
 		}
 	}
 
@@ -615,7 +615,7 @@
 		} else {
 #ifdef __powerpc__
 			/*
-			 * memset() on PPC (both glibc and codewarrior) uses
+			 * SDL_memset() on PPC (both glibc and codewarrior) uses
 			 * the dcbz (Data Cache Block Zero) instruction, which
 			 * causes an alignment exception if the destination is
 			 * uncachable, so only use it on software surfaces
@@ -627,7 +627,7 @@
 					 * efficient to uncached video memory
 					 */
 					double fill;
-					memset(&fill, color, (sizeof fill));
+					SDL_memset(&fill, color, (sizeof fill));
 					for(y = dstrect->h; y; y--) {
 						Uint8 *d = row;
 						unsigned n = x;
@@ -679,7 +679,7 @@
 #endif /* __powerpc__ */
 			{
 				for(y = dstrect->h; y; y--) {
-					memset(row, color, x);
+					SDL_memset(row, color, x);
 					row += dst->pitch;
 				}
 			}
@@ -711,7 +711,7 @@
 			for ( y=dstrect->h; y; --y ) {
 				Uint8 *pixels = row;
 				for ( x=dstrect->w; x; --x ) {
-					memcpy(pixels, &color, 3);
+					SDL_memcpy(pixels, &color, 3);
 					pixels += 3;
 				}
 				row += dst->pitch;
@@ -832,7 +832,7 @@
 
 	/* Copy the palette if any */
 	if ( format->palette && convert->format->palette ) {
-		memcpy(convert->format->palette->colors,
+		SDL_memcpy(convert->format->palette->colors,
 				format->palette->colors,
 				format->palette->ncolors*sizeof(SDL_Color));
 		convert->format->palette->ncolors = format->palette->ncolors;
@@ -934,9 +934,9 @@
 	}
 	if ( surface->pixels &&
 	     ((surface->flags & SDL_PREALLOC) != SDL_PREALLOC) ) {
-		free(surface->pixels);
+		SDL_free(surface->pixels);
 	}
-	free(surface);
+	SDL_free(surface);
 #ifdef CHECK_LEAKS
 	--surfaces_allocated;
 #endif