]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/bspfile.c
Merge commit 'ee4b663ef7227a42b5eb051698265bed514ab3c0' into master-merge
[xonotic/netradiant.git] / tools / quake3 / common / bspfile.c
index 9214550a8a517452aea9e26c0aaf782850c2ab8a..c65da46d593dfa9dbd3b9dba7c2d34d6edb8e284 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+   Copyright (C) 1999-2007 id Software, Inc. and contributors.
    For a list of contributors, see the accompanying CONTRIBUTORS file.
 
    This file is part of GtkRadiant.
@@ -96,9 +96,7 @@ void SetLightBytes( int n ){
                return;
        }
 
-       lightBytes = safe_malloc_info( numLightBytes, "SetLightBytes" );
-
-       memset( lightBytes, 0, numLightBytes );
+       lightBytes = safe_malloc0_info( numLightBytes, "SetLightBytes" );
 }
 
 void SetGridPoints( int n ){
@@ -112,9 +110,7 @@ void SetGridPoints( int n ){
                return;
        }
 
-       gridData = safe_malloc_info( numGridPoints * 8, "SetGridPoints" );
-
-       memset( gridData, 0, numGridPoints * 8 );
+       gridData = safe_malloc0_info( numGridPoints * 8, "SetGridPoints" );
 }
 
 void IncDrawVerts(){
@@ -152,9 +148,7 @@ void SetDrawVerts( int n ){
        numDrawVerts = n;
        numDrawVertsBuffer = numDrawVerts;
 
-       drawVerts = safe_malloc_info( sizeof( drawVert_t ) * numDrawVertsBuffer, "IncDrawVerts" );
-
-       memset( drawVerts, 0, n * sizeof( drawVert_t ) );
+       drawVerts = safe_malloc0_info( sizeof( drawVert_t ) * numDrawVertsBuffer, "IncDrawVerts" );
 }
 
 void SetDrawSurfacesBuffer(){
@@ -164,9 +158,7 @@ void SetDrawSurfacesBuffer(){
 
        numDrawSurfacesBuffer = MAX_MAP_DRAW_SURFS;
 
-       drawSurfaces = safe_malloc_info( sizeof( dsurface_t ) * numDrawSurfacesBuffer, "IncDrawSurfaces" );
-
-       memset( drawSurfaces, 0, MAX_MAP_DRAW_SURFS * sizeof( drawVert_t ) );
+       drawSurfaces = safe_malloc0_info( sizeof( dsurface_t ) * numDrawSurfacesBuffer, "IncDrawSurfaces" );
 }
 
 void SetDrawSurfaces( int n ){
@@ -177,9 +169,7 @@ void SetDrawSurfaces( int n ){
        numDrawSurfaces = n;
        numDrawSurfacesBuffer = numDrawSurfaces;
 
-       drawSurfaces = safe_malloc_info( sizeof( dsurface_t ) * numDrawSurfacesBuffer, "IncDrawSurfaces" );
-
-       memset( drawSurfaces, 0, n * sizeof( drawVert_t ) );
+       drawSurfaces = safe_malloc0_info( sizeof( dsurface_t ) * numDrawSurfacesBuffer, "IncDrawSurfaces" );
 }
 
 void BspFilesCleanup(){
@@ -294,10 +284,7 @@ void SwapBSPFile( void ) {
    =============
  */
 int GetLumpElements( dheader_t  *header, int lump, int size ) {
-       int length, ofs;
-
-       length = header->lumps[lump].filelen;
-       ofs = header->lumps[lump].fileofs;
+       int length = header->lumps[lump].filelen;
 
        if ( length % size ) {
                Error( "LoadBSPFile: odd lump size" );
@@ -525,8 +512,7 @@ void StripTrailing( char *e ) {
 epair_t *ParseEpair( void ) {
        epair_t *e;
 
-       e = safe_malloc( sizeof( epair_t ) );
-       memset( e, 0, sizeof( epair_t ) );
+       e = safe_malloc0( sizeof( epair_t ) );
 
        if ( strlen( token ) >= MAX_KEY - 1 ) {
                Error( "ParseEpar: token too long" );