54 memset(m->used, 0, m->num);
55 memset(m->mem, 0, m->size * m->num);
63 for(i = 0; i < m->num; ++i) {
64 if(m->used[i] ==
false) {
68 return (
void *)((
char *)m->mem + (i * m->size));
85 ptr2 = (
char *)m->mem;
86 for(i = 0; i < m->num; ++i) {
87 if(ptr2 == (
char *)ptr) {
90 if (m->used[i] ==
false)
103 return (
char *)ptr >= (
char *)m->mem &&
104 (
char *)ptr < (
char *)m->mem + (m->num * m->size);
113 for(i = 0; i < m->num; ++i) {
114 if(m->used[i] ==
false) {
int memb_free(struct memb *m, void *ptr)
Deallocate a memory block from a memory block previously declared with MEMB().
size_t memb_numfree(struct memb *m)
Count free memory blocks.
int memb_inmemb(struct memb *m, void *ptr)
Check if a given address is within a memory area previously declared with MEMB().
void * memb_alloc(struct memb *m)
Allocate a memory block from a block of memory declared with MEMB().
void memb_init(struct memb *m)
Initialize a memory block that was declared with MEMB().
Memory block allocation routines.