foxygit / doom Log in
commit e33dbd82381ace644f7ac4574a354e5764591b55
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Fri May 2 19:18:52 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Fri May 2 19:18:52 2008 +0000

    Fix up some more code calling Z_Free instead of W_ReleaseLumpNum.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1135
---
 src/i_video.c |  9 ++++++---
 src/p_setup.c | 22 +++++++++++-----------
 src/r_data.c  |  6 +++---
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 7222d1b0..0fe25736 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -243,6 +243,7 @@ static void UpdateFocus(void)
 static void LoadDiskImage(void)
 {
     patch_t *disk;
+    char *disk_name;
     int y;
     char buf[20];

@@ -258,9 +259,11 @@ static void LoadDiskImage(void)
     }

     if (M_CheckParm("-cdrom") > 0)
-        disk = (patch_t *) W_CacheLumpName(DEH_String("STCDROM"), PU_STATIC);
+        disk_name = DEH_String("STCDROM");
     else
-        disk = (patch_t *) W_CacheLumpName(DEH_String("STDISK"), PU_STATIC);
+        disk_name = DEH_String("STDISK");
+
+    disk = W_CacheLumpName(disk_name, PU_STATIC);

     V_DrawPatch(0, 0, 0, disk);
     disk_image_w = SHORT(disk->width);
@@ -277,7 +280,7 @@ static void LoadDiskImage(void)
         memset(screens[0] + SCREENWIDTH * y, 0, disk_image_w);
     }

-    Z_Free(disk);
+    W_ReleaseLumpName(disk_name);
 }

 //
diff --git a/src/p_setup.c b/src/p_setup.c
index f692658a..446bba49 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -136,7 +136,7 @@ void P_LoadVertexes (int lump)
     vertexes = Z_Malloc (numvertexes*sizeof(vertex_t),PU_LEVEL,0);

     // Load data into cache.
-    data = W_CacheLumpNum (lump,PU_STATIC);
+    data = W_CacheLumpNum (lump, PU_STATIC);

     ml = (mapvertex_t *)data;
     li = vertexes;
@@ -150,7 +150,7 @@ void P_LoadVertexes (int lump)
     }

     // Free buffer memory.
-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }


@@ -194,7 +194,7 @@ void P_LoadSegs (int lump)
 	    li->backsector = 0;
     }

-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }


@@ -222,7 +222,7 @@ void P_LoadSubsectors (int lump)
 	ss->firstline = SHORT(ms->firstseg);
     }

-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }


@@ -256,7 +256,7 @@ void P_LoadSectors (int lump)
 	ss->thinglist = NULL;
     }

-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }


@@ -293,7 +293,7 @@ void P_LoadNodes (int lump)
 	}
     }

-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }


@@ -348,7 +348,7 @@ void P_LoadThings (int lump)
 	P_SpawnMapThing (mt);
     }

-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }


@@ -429,8 +429,8 @@ void P_LoadLineDefs (int lump)
 	else
 	    ld->backsector = 0;
     }
-
-    Z_Free (data);
+
+    W_ReleaseLumpNum(lump);
 }


@@ -460,8 +460,8 @@ void P_LoadSideDefs (int lump)
 	sd->midtexture = R_TextureNumForName(msd->midtexture);
 	sd->sector = &sectors[SHORT(msd->sector)];
     }
-
-    Z_Free (data);
+
+    W_ReleaseLumpNum(lump);
 }


diff --git a/src/r_data.c b/src/r_data.c
index 2b11d82c..d03becd5 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -491,7 +491,7 @@ void R_InitTextures (void)
 	strncpy (name,name_p+i*8, 8);
 	patchlookup[i] = W_CheckNumForName (name);
     }
-    Z_Free (names);
+    W_ReleaseLumpName(DEH_String("PNAMES"));

     // Load the map texture definitions from textures.lmp.
     // The data is contained in one or two lumps,
@@ -603,9 +603,9 @@ void R_InitTextures (void)

     Z_Free(patchlookup);

-    Z_Free (maptex1);
+    W_ReleaseLumpName(DEH_String("TEXTURE1"));
     if (maptex2)
-	Z_Free (maptex2);
+        W_ReleaseLumpName(DEH_String("TEXTURE2"));

     // Precalculate whatever possible.