shithub: choc

Download patch

ref: e33dbd82381ace644f7ac4574a354e5764591b55
parent: 3f54daeaa3acf590569cb397eee24731f7de6c17
author: Simon Howard <fraggle@gmail.com>
date: Fri May 2 15:18:52 EDT 2008

Fix up some more code calling Z_Free instead of W_ReleaseLumpNum.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1135

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -243,6 +243,7 @@
 static void LoadDiskImage(void)
 {
     patch_t *disk;
+    char *disk_name;
     int y;
     char buf[20];
 
@@ -258,10 +259,12 @@
     }
 
     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);
     disk_image_h = SHORT(disk->height);
@@ -277,7 +280,7 @@
         memset(screens[0] + SCREENWIDTH * y, 0, disk_image_w);
     }
 
-    Z_Free(disk);
+    W_ReleaseLumpName(disk_name);
 }
 
 //
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -136,7 +136,7 @@
     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 @@
     }
 
     // Free buffer memory.
-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -194,7 +194,7 @@
 	    li->backsector = 0;
     }
 	
-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -222,7 +222,7 @@
 	ss->firstline = SHORT(ms->firstseg);
     }
 	
-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -256,7 +256,7 @@
 	ss->thinglist = NULL;
     }
 	
-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -293,7 +293,7 @@
 	}
     }
 	
-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -348,7 +348,7 @@
 	P_SpawnMapThing (mt);
     }
 	
-    Z_Free (data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -429,8 +429,8 @@
 	else
 	    ld->backsector = 0;
     }
-	
-    Z_Free (data);
+
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -460,8 +460,8 @@
 	sd->midtexture = R_TextureNumForName(msd->midtexture);
 	sd->sector = &sectors[SHORT(msd->sector)];
     }
-	
-    Z_Free (data);
+
+    W_ReleaseLumpNum(lump);
 }
 
 
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -491,7 +491,7 @@
 	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 @@
 
     Z_Free(patchlookup);
 
-    Z_Free (maptex1);
+    W_ReleaseLumpName(DEH_String("TEXTURE1"));
     if (maptex2)
-	Z_Free (maptex2);
+        W_ReleaseLumpName(DEH_String("TEXTURE2"));
     
     // Precalculate whatever possible.