diff src/video/win32/SDL_d3drender.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 f3399f779a1d
line wrap: on
line diff
--- a/src/video/win32/SDL_d3drender.c	Wed Jul 19 08:46:57 2006 +0000
+++ b/src/video/win32/SDL_d3drender.c	Sat Jul 22 08:33:18 2006 +0000
@@ -239,20 +239,18 @@
     D3DPRESENT_PARAMETERS pparams;
     IDirect3DSwapChain9 *chain;
 
-    renderer = (SDL_Renderer *) SDL_malloc(sizeof(*renderer));
+    renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
     if (!renderer) {
         SDL_OutOfMemory();
         return NULL;
     }
-    SDL_zerop(renderer);
 
-    data = (D3D_RenderData *) SDL_malloc(sizeof(*data));
+    data = (D3D_RenderData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
         D3D_DestroyRenderer(renderer);
         SDL_OutOfMemory();
         return NULL;
     }
-    SDL_zerop(data);
 
     renderer->CreateTexture = D3D_CreateTexture;
     renderer->SetTexturePalette = D3D_SetTexturePalette;
@@ -379,12 +377,11 @@
     D3DPOOL pool;
     HRESULT result;
 
-    data = (D3D_TextureData *) SDL_malloc(sizeof(*data));
+    data = (D3D_TextureData *) SDL_calloc(1, sizeof(*data));
     if (!data) {
         SDL_OutOfMemory();
         return -1;
     }
-    SDL_zerop(data);
 
     texture->driverdata = data;