doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

z_zone.h (957B)


      1 #ifndef __Z_ZONE__
      2 #define __Z_ZONE__
      3 
      4 #include <stdio.h>
      5 
      6 #define PU_STATIC     1	
      7 #define PU_SOUND      2	
      8 #define PU_MUSIC      3	
      9 #define PU_DAVE       4	
     10 #define PU_LEVEL      50	
     11 #define PU_LEVSPEC    51      
     12 #define PU_PURGELEVEL 100
     13 #define PU_CACHE      101
     14 
     15 void  Z_Init(void);
     16 void* Z_Malloc(int size, int tag, void *ptr);
     17 void  Z_Free(void *ptr);
     18 void  Z_FreeTags(int lowtag, int hightag);
     19 void  Z_DumpHeap(int lowtag, int hightag);
     20 void  Z_FileDumpHeap(FILE *f);
     21 void  Z_CheckHeap(void);
     22 void  Z_ChangeTag2(void *ptr, int tag);
     23 int   Z_FreeMemory(void);
     24 
     25 typedef struct memblock_t memblock_t;
     26 
     27 struct memblock_t {
     28     int         size;	
     29     void**      user;	
     30     int         tag;	
     31     int         id;	
     32     memblock_t* next;
     33     memblock_t* prev;
     34 };
     35 
     36 #define Z_ChangeTag(p,t) \
     37 { \
     38       if (((memblock_t *)((byte*)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
     39 		  I_Error("Z_CT at "__FILE__":%i",__LINE__); \
     40 	  Z_ChangeTag2(p,t); \
     41 };
     42 
     43 #endif