From 8f834d678453fba78b5779dc44af456dee5d8718 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Wed, 14 Feb 2018 23:16:16 +0000
Subject: [PATCH] added a quick Z_FreeTag function as a shortcut to
 Z_FreeTags(tag, tag) where both tags are the same

---
 src/hardware/hw_cache.c | 8 ++++----
 src/z_zone.c            | 5 +++++
 src/z_zone.h            | 1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c
index 78fc31afcc..beda40391e 100644
--- a/src/hardware/hw_cache.c
+++ b/src/hardware/hw_cache.c
@@ -581,8 +581,8 @@ void HWR_FreeTextureCache(void)
 
 	// free all hardware-converted graphics cached in the heap
 	// our gool is only the textures since user of the texture is the texture cache
-	Z_FreeTags(PU_HWRCACHE, PU_HWRCACHE);
-	Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRCACHE_UNLOCKED);
+	Z_FreeTag(PU_HWRCACHE);
+	Z_FreeTag(PU_HWRCACHE_UNLOCKED);
 
 	// Alam: free the Z_Blocks before freeing it's users
 
@@ -629,8 +629,8 @@ void HWR_SetPalette(RGBA_t *palette)
 	// now flush data texture cache so 32 bit texture are recomputed
 	if (patchformat == GR_RGBA || textureformat == GR_RGBA)
 	{
-		Z_FreeTags(PU_HWRCACHE, PU_HWRCACHE);
-		Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRCACHE_UNLOCKED);
+		Z_FreeTag(PU_HWRCACHE);
+		Z_FreeTag(PU_HWRCACHE_UNLOCKED);
 	}
 }
 
diff --git a/src/z_zone.c b/src/z_zone.c
index 4e9efef4b2..37ab3d5462 100644
--- a/src/z_zone.c
+++ b/src/z_zone.c
@@ -407,6 +407,11 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
 	}
 }
 
+void Z_FreeTag(INT32 tagnum)
+{
+	Z_FreeTags(tagnum, tagnum);
+}
+
 //
 // Z_CheckMemCleanup
 //
diff --git a/src/z_zone.h b/src/z_zone.h
index baadb44a60..57ad158cf3 100644
--- a/src/z_zone.h
+++ b/src/z_zone.h
@@ -59,6 +59,7 @@
 #define PU_HWRPATCHINFO_UNLOCKED 103
 
 void Z_Init(void);
+void Z_FreeTag(INT32 tagnum);
 void Z_FreeTags(INT32 lowtag, INT32 hightag);
 void Z_CheckMemCleanup(void);
 void Z_CheckHeap(INT32 i);
-- 
GitLab