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...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401340
This commit is contained in:
Sam Lantinga 2006-02-07 06:59:48 +00:00
parent 00f6d8e5e3
commit 5d53175e4d
212 changed files with 1840 additions and 1884 deletions

View file

@ -43,12 +43,12 @@ SDL_PixelFormat *SDL_AllocFormat(int bpp,
Uint32 mask;
/* Allocate an empty pixel format structure */
format = malloc(sizeof(*format));
format = SDL_malloc(sizeof(*format));
if ( format == NULL ) {
SDL_OutOfMemory();
return(NULL);
}
memset(format, 0, sizeof(*format));
SDL_memset(format, 0, sizeof(*format));
format->alpha = SDL_ALPHA_OPAQUE;
/* Set up the format */
@ -125,14 +125,14 @@ SDL_PixelFormat *SDL_AllocFormat(int bpp,
#ifdef DEBUG_PALETTE
fprintf(stderr,"bpp=%d ncolors=%d\n",bpp,ncolors);
#endif
format->palette = (SDL_Palette *)malloc(sizeof(SDL_Palette));
format->palette = (SDL_Palette *)SDL_malloc(sizeof(SDL_Palette));
if ( format->palette == NULL ) {
SDL_FreeFormat(format);
SDL_OutOfMemory();
return(NULL);
}
(format->palette)->ncolors = ncolors;
(format->palette)->colors = (SDL_Color *)malloc(
(format->palette)->colors = (SDL_Color *)SDL_malloc(
(format->palette)->ncolors*sizeof(SDL_Color));
if ( (format->palette)->colors == NULL ) {
SDL_FreeFormat(format);
@ -217,7 +217,7 @@ SDL_PixelFormat *SDL_AllocFormat(int bpp,
format->palette->colors[1].b = 0x00;
} else {
/* Create an empty palette */
memset((format->palette)->colors, 0,
SDL_memset((format->palette)->colors, 0,
(format->palette)->ncolors*sizeof(SDL_Color));
}
}
@ -255,11 +255,11 @@ void SDL_FreeFormat(SDL_PixelFormat *format)
if ( format ) {
if ( format->palette ) {
if ( format->palette->colors ) {
free(format->palette->colors);
SDL_free(format->palette->colors);
}
free(format->palette);
SDL_free(format->palette);
}
free(format);
SDL_free(format);
}
}
/*
@ -438,7 +438,7 @@ static Uint8 *Map1to1(SDL_Palette *src, SDL_Palette *dst, int *identical)
if ( identical ) {
if ( src->ncolors <= dst->ncolors ) {
/* If an identical palette, no need to map */
if ( memcmp(src->colors, dst->colors, src->ncolors*
if ( SDL_memcmp(src->colors, dst->colors, src->ncolors*
sizeof(SDL_Color)) == 0 ) {
*identical = 1;
return(NULL);
@ -446,7 +446,7 @@ static Uint8 *Map1to1(SDL_Palette *src, SDL_Palette *dst, int *identical)
}
*identical = 0;
}
map = (Uint8 *)malloc(src->ncolors);
map = (Uint8 *)SDL_malloc(src->ncolors);
if ( map == NULL ) {
SDL_OutOfMemory();
return(NULL);
@ -466,7 +466,7 @@ static Uint8 *Map1toN(SDL_Palette *src, SDL_PixelFormat *dst)
unsigned alpha;
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
map = (Uint8 *)malloc(src->ncolors*bpp);
map = (Uint8 *)SDL_malloc(src->ncolors*bpp);
if ( map == NULL ) {
SDL_OutOfMemory();
return(NULL);
@ -490,7 +490,7 @@ static Uint8 *MapNto1(SDL_PixelFormat *src, SDL_Palette *dst, int *identical)
/* SDL_DitherColors does not initialize the 'unused' component of colors,
but Map1to1 compares it against dst, so we should initialize it. */
memset(colors, 0, sizeof(colors));
SDL_memset(colors, 0, sizeof(colors));
dithered.ncolors = 256;
SDL_DitherColors(colors, 8);
@ -503,21 +503,21 @@ SDL_BlitMap *SDL_AllocBlitMap(void)
SDL_BlitMap *map;
/* Allocate the empty map */
map = (SDL_BlitMap *)malloc(sizeof(*map));
map = (SDL_BlitMap *)SDL_malloc(sizeof(*map));
if ( map == NULL ) {
SDL_OutOfMemory();
return(NULL);
}
memset(map, 0, sizeof(*map));
SDL_memset(map, 0, sizeof(*map));
/* Allocate the software blit data */
map->sw_data = (struct private_swaccel *)malloc(sizeof(*map->sw_data));
map->sw_data = (struct private_swaccel *)SDL_malloc(sizeof(*map->sw_data));
if ( map->sw_data == NULL ) {
SDL_FreeBlitMap(map);
SDL_OutOfMemory();
return(NULL);
}
memset(map->sw_data, 0, sizeof(*map->sw_data));
SDL_memset(map->sw_data, 0, sizeof(*map->sw_data));
/* It's ready to go */
return(map);
@ -530,7 +530,7 @@ void SDL_InvalidateMap(SDL_BlitMap *map)
map->dst = NULL;
map->format_version = (unsigned int)-1;
if ( map->table ) {
free(map->table);
SDL_free(map->table);
map->table = NULL;
}
}
@ -615,8 +615,8 @@ void SDL_FreeBlitMap(SDL_BlitMap *map)
if ( map ) {
SDL_InvalidateMap(map);
if ( map->sw_data != NULL ) {
free(map->sw_data);
SDL_free(map->sw_data);
}
free(map);
SDL_free(map);
}
}