Convert SDL_malloc to SDL_calloc if appropriate, slightly faster on operating systems which map the zero page for memory allocations.

OpenGL renderer in progress

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401965
This commit is contained in:
Sam Lantinga 2006-07-22 08:33:18 +00:00
parent 2b538200ba
commit 2fe561616a
9 changed files with 218 additions and 212 deletions

View file

@ -42,12 +42,11 @@ SDL_CreateRGBSurface(Uint32 flags,
SDL_Surface *surface;
/* Allocate the surface */
surface = (SDL_Surface *) SDL_malloc(sizeof(*surface));
surface = (SDL_Surface *) SDL_calloc(1, sizeof(*surface));
if (surface == NULL) {
SDL_OutOfMemory();
return NULL;
}
SDL_zerop(surface);
surface->format = SDL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask);
if (!surface->format) {