]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.h
Refactor game/mod cvar defaults
[xonotic/darkplaces.git] / zone.h
diff --git a/zone.h b/zone.h
index 2225ec7c7f47ea9275a9ad72b2f85a2d14dbfeb8..b0dedc9dc2126ced5e04efc2513294e778462c21 100644 (file)
--- a/zone.h
+++ b/zone.h
@@ -117,6 +117,13 @@ qbool Mem_IsAllocated(mempool_t *pool, const void *data);
 
 char *_Mem_strdup(mempool_t *pool, const char *s, const char *filename, int fileline);
 
+/// Returns the current size of an allocation
+// not a macro so that it doesn't allow the size to be changed.
+static inline size_t Mem_Size(void *data)
+{
+       return ((memheader_t *)((unsigned char *)data - sizeof(memheader_t)))->size;
+}
+
 typedef struct memexpandablearray_array_s
 {
        unsigned char *data;