]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.c
- Added Mem_IsAllocated.
[xonotic/darkplaces.git] / zone.c
diff --git a/zone.c b/zone.c
index 03a6bfa3d0a029880641616d42abd802eb5dadc9..f58aa54a38a94d8356088ecb87dfd5834d9ca862 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -330,6 +330,19 @@ void _Mem_CheckSentinelsGlobal(const char *filename, int fileline)
 #endif
 }
 
+qboolean Mem_IsAllocated(mempool_t *pool, void *data)
+{
+       memheader_t *header;
+       memheader_t *target;
+
+    target = (memheader_t *)((qbyte *) data - sizeof(memheader_t));
+       for( header = pool->chain ; header ; header = header->next )
+               if( header == target )
+                       return true;
+       return false;
+}
+
+
 // used for temporary memory allocations around the engine, not for longterm
 // storage, if anything in this pool stays allocated during gameplay, it is
 // considered a leak