X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=zone.h;h=b0dedc9dc2126ced5e04efc2513294e778462c21;hb=316549daf20e3a6a71841f87da516f7bb9cf340f;hp=2225ec7c7f47ea9275a9ad72b2f85a2d14dbfeb8;hpb=bd53aab2e0f8074511f9bbb85cabfb9a975cc0c9;p=xonotic%2Fdarkplaces.git diff --git a/zone.h b/zone.h index 2225ec7c..b0dedc9d 100644 --- 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;