[chocolate-doom] 30/83: Use zone memory functions instead of alloca/malloc/free

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:06:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.0.1
in repository chocolate-doom.

commit b500013f80419217013ada4211662e9bea2702e4
Author: Simon Howard <fraggle at gmail.com>
Date:   Thu Aug 4 18:40:22 2005 +0000

    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(-)

diff --git a/src/r_data.c b/src/r_data.c
index d85d7b5..8558a1e 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 ; i<nummappatches ; i++)
     {
@@ -578,6 +581,8 @@ void R_InitTextures (void)
 	totalwidth += texture->width;
     }
 
+    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 ; i<numsectors ; i++)
@@ -798,9 +803,11 @@ void R_PrecacheLevel (void)
 	    W_CacheLumpNum(lump, PU_CACHE);
 	}
     }
+
+    Z_Free(flatpresent);
     
     // Precache textures.
-    texturepresent = alloca(numtextures);
+    texturepresent = Z_Malloc(numtextures, PU_STATIC, NULL);
     memset (texturepresent,0, numtextures);
 	
     for (i=0 ; i<numsides ; i++)
@@ -833,9 +840,11 @@ void R_PrecacheLevel (void)
 	    W_CacheLumpNum(lump , PU_CACHE);
 	}
     }
+
+    Z_Free(texturepresent);
     
     // Precache sprites.
-    spritepresent = alloca(numsprites);
+    spritepresent = Z_Malloc(numsprites, PU_STATIC, NULL);
     memset (spritepresent,0, numsprites);
 	
     for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
@@ -861,6 +870,8 @@ void R_PrecacheLevel (void)
 	    }
 	}
     }
+
+    Z_Free(spritepresent);
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list