mem.h
6fa79282
 /* $Id$
  *
  * memory related stuff (malloc & friends)
  * 
  */
 
 
 #ifndef mem_h
 #define mem_h
6bd84753
 #include "dprint.h"
6fa79282
 
 #ifdef PKG_MALLOC
 #include "q_malloc.h"
 
 extern struct qm_block* mem_block;
 
 
 #define pkg_malloc(s) qm_malloc(mem_block, s)
 #define pkg_free(p)   qm_free(mem_block, p)
 #define pkg_status()  qm_status(mem_block)
 
628e3a5a
 #elif defined(SHM_MEM) && defined(USE_SHM_MEM)
 
 #include "shm_mem.h"
 
21f03122
 #define pkg_malloc(s) shm_malloc(s)
 #define pkg_free(p)   shm_free(p)
 #define pkg_status()  shm_status()
628e3a5a
 
6fa79282
 #else
628e3a5a
 
6fa79282
 #include <stdlib.h>
 
6bd84753
 #define pkg_malloc(s) \
 	(  { void *v; v=malloc(s); \
 	   DBG("malloc %x size %d end %x\n", v, s, (unsigned int)v+s);\
 	   v; } )
 #define pkg_free(p)  do{ DBG("free %x\n", p); free(p); }while(0);
6fa79282
 #define pkg_status()
 
 #endif
 
 
 #endif