#ifndef _MEMPOOL_H_INCLUDED
#define _MEMPOOL_H_INCLUDED

#define MEMPOOL_BUFSIZE (8192-sizeof(unsigned)*3)
struct mempool_chunk {
  struct mempool_chunk *next;
  unsigned size;
  char buf[MEMPOOL_BUFSIZE];
};
struct mempool {
  struct mempool_chunk *chunk;
};

void mp_init(struct mempool *mp);
void *mp_alloc(struct mempool *mp, unsigned size);
void mp_free(struct mempool *mp);
char *mp_strdup(struct mempool *mp, const char *str);

#endif
