diff src/video/SDL_renderer_sw.c @ 1920:8a162bfdc838

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
author Sam Lantinga <slouken@libsdl.org>
date Sat, 22 Jul 2006 08:33:18 +0000
parents 092bd3a019c5
children 595ac54a8f9f
line wrap: on
line diff
--- a/src/video/SDL_renderer_sw.c	Wed Jul 19 08:46:57 2006 +0000
+++ b/src/video/SDL_renderer_sw.c	Sat Jul 22 08:33:18 2006 +0000
@@ -105,13 +105,12 @@
 {
     SDL_Texture *texture;
 
-    texture = (SDL_Texture *) SDL_malloc(sizeof(*texture));
+    texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
     if (!texture) {
         SDL_OutOfMemory();
         return NULL;
     }
 
-    SDL_zerop(texture);
     texture->format = format;
     texture->access = SDL_TextureAccess_Local;
     texture->w = w;
@@ -173,13 +172,12 @@
         return NULL;
     }
 
-    data = (SW_RenderData *) SDL_malloc(sizeof(*data));
+    data = (SW_RenderData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
         SW_DestroyRenderer(renderer);
         SDL_OutOfMemory();
         return NULL;
     }
-    SDL_zerop(data);
 
     renderer->CreateTexture = SW_CreateTexture;
     renderer->QueryTexturePixels = SW_QueryTexturePixels;