Mercurial > sdl-ios-xcode
diff src/video/SDL_pixels.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_pixels.c Mon Feb 06 17:28:04 2006 +0000 +++ b/src/video/SDL_pixels.c Tue Feb 07 06:59:48 2006 +0000 @@ -43,12 +43,12 @@ 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 @@ #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 @@ 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 @@ 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 @@ 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 @@ } *identical = 0; } - map = (Uint8 *)malloc(src->ncolors); + map = (Uint8 *)SDL_malloc(src->ncolors); if ( map == NULL ) { SDL_OutOfMemory(); return(NULL); @@ -466,7 +466,7 @@ 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 @@ /* 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 *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 @@ 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 @@ if ( map ) { SDL_InvalidateMap(map); if ( map->sw_data != NULL ) { - free(map->sw_data); + SDL_free(map->sw_data); } - free(map); + SDL_free(map); } }