2 * Sherlock Library -- Memory Pools
4 * (c) 1997--2001 Martin Mares <mj@ucw.cz>
8 #define POOL_ALIGN CPU_STRUCT_ALIGN
13 struct memchunk *first, *current, **plast;
14 struct memchunk *first_large;
15 uns chunk_size, threshold;
18 struct mempool *mp_new(uns);
19 void mp_delete(struct mempool *);
20 void mp_flush(struct mempool *);
21 void *mp_alloc(struct mempool *, uns);
22 void *mp_alloc_zero(struct mempool *, uns);
24 static inline void *mp_alloc_fast(struct mempool *p, uns l)
26 byte *f = (void *) (((uns) p->free + POOL_ALIGN - 1) & ~(POOL_ALIGN - 1));
29 return mp_alloc(p, l);
34 static inline void *mp_alloc_fast_noalign(struct mempool *p, uns l)
39 return mp_alloc(p, l);