#define __TMALLOC_H__
#include <sys/types.h>
+#include "tools.h"
void * tmalloc(size_t size);
void * trealloc(void * ptr, size_t size);
char data[1];
} MemoryChunk;
-#define MEMCHNKHDRSZ ( sizeof(u_int32_t)*2 + sizeof(MemoryChunk*) )
+#define MEMCHNKHDRSZ offsetof(MemoryChunk, data)
typedef struct MemoryContext {
u_int32_t flags;
#define MCASHDRSZ ( sizeof(size_t) + sizeof(MemoryContext*) )
#define MCMAGICKNUMBER (0xFE0FBEEF)
-#define TYPEALIGN(ALIGNVAL,LEN) \
- (((long) (LEN) + (ALIGNVAL-1)) & ~((long) (ALIGNVAL-1)))
-
-#define PTRALIGN(LEN) TYPEALIGN(sizeof(void*), (LEN))
-
MemoryContext *allocMemoryContext(MemoryContext* parent, int flags);
void freeMemoryContext(MemoryContext* cntx);
void* mcalloc(MemoryContext *cntx, size_t size);