#ifndef _MEM_MODH
#define _MEM_MODH

#ifdef __cplusplus
extern "C" {
#endif

typedef struct link_item
{
    void *data;
} link_item;

typedef struct
{
    unsigned char count;
    unsigned char size;
    unsigned char free_index;
    void *buffer;
    link_item *freelist;
} memman;

void Memmod_Init(memman *me,unsigned char buf_count,unsigned short buf_size);
memman *Memmod_Create(unsigned char buf_count,unsigned short buf_size);
unsigned char* Memmod_GetBuffer(memman *me);
void *Memmod_Alloc(memman *me);
void Memmod_Free(memman *me,void *buffer);

#ifdef __cplusplus
}
#endif

#endif
