From b500013f80419217013ada4211662e9bea2702e4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 4 Aug 2005 18:40:22 +0000 Subject: Use zone memory functions instead of alloca/malloc/free Subversion-branch: /trunk/chocolate-doom Subversion-revision: 36 --- src/r_data.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/r_data.c b/src/r_data.c index d85d7b58..8558a1ef 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: r_data.c 25 2005-07-23 23:07:04Z fraggle $ +// $Id: r_data.c 36 2005-08-04 18:40:22Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -22,6 +22,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.6 2005/08/04 18:40:22 fraggle +// Use zone memory functions instead of alloca/malloc/free +// // Revision 1.5 2005/07/23 23:07:04 fraggle // Add back previously removed printfs as '.'s for startup progress bar // @@ -47,7 +50,7 @@ static const char -rcsid[] = "$Id: r_data.c 25 2005-07-23 23:07:04Z fraggle $"; +rcsid[] = "$Id: r_data.c 36 2005-08-04 18:40:22Z fraggle $"; #include "i_system.h" #include "z_zone.h" @@ -337,7 +340,7 @@ void R_GenerateLookup (int texnum) // that are covered by more than one patch. // Fill in the lump / offset, so columns // with only a single patch are all done. - patchcount = (byte *) malloc(texture->width); + patchcount = (byte *) Z_Malloc(texture->width, PU_STATIC, NULL); memset (patchcount, 0, texture->width); patch = texture->patches; @@ -390,7 +393,7 @@ void R_GenerateLookup (int texnum) } } - free(patchcount); + Z_Free(patchcount); } @@ -468,7 +471,7 @@ void R_InitTextures (void) names = W_CacheLumpName ("PNAMES", PU_STATIC); nummappatches = LONG ( *((int *)names) ); name_p = names+4; - patchlookup = alloca (nummappatches*sizeof(*patchlookup)); + patchlookup = Z_Malloc(nummappatches*sizeof(*patchlookup), PU_STATIC, NULL); for (i=0 ; iwidth; } + Z_Free(patchlookup); + Z_Free (maptex1); if (maptex2) Z_Free (maptex2); @@ -778,7 +783,7 @@ void R_PrecacheLevel (void) return; // Precache flats. - flatpresent = alloca(numflats); + flatpresent = Z_Malloc(numflats, PU_STATIC, NULL); memset (flatpresent,0,numflats); for (i=0 ; inext) @@ -861,6 +870,8 @@ void R_PrecacheLevel (void) } } } + + Z_Free(spritepresent); } -- cgit v1.2.3