X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpools.h;h=3526aec0bfc9ed5627ded9464e4b33dfa2095106;hb=8ffdaed1c5f5bf4ad0914b8d17f14af51ce037a5;hp=95c8e17f9325a8112acac5a6b97c83e667567e45;hpb=1571781022499a9d0c32d249f89945d034d1cbff;p=libucw.git diff --git a/lib/pools.h b/lib/pools.h index 95c8e17f..3526aec0 100644 --- a/lib/pools.h +++ b/lib/pools.h @@ -1,7 +1,7 @@ /* * Sherlock Library -- Memory Pools * - * (c) 1997--1999 Martin Mares + * (c) 1997--2001 Martin Mares */ #ifndef POOL_ALIGN @@ -15,27 +15,28 @@ struct mempool { uns chunk_size, threshold; }; -struct mempool *new_pool(uns); -void free_pool(struct mempool *); -void flush_pool(struct mempool *); -void *pool_alloc(struct mempool *, uns); +struct mempool *mp_new(uns); +void mp_delete(struct mempool *); +void mp_flush(struct mempool *); +void *mp_alloc(struct mempool *, uns); +void *mp_alloc_zero(struct mempool *, uns); -static inline void *fast_alloc(struct mempool *p, uns l) +static inline void *mp_alloc_fast(struct mempool *p, uns l) { byte *f = (void *) (((uns) p->free + POOL_ALIGN - 1) & ~(POOL_ALIGN - 1)); byte *ee = f + l; if (ee > p->last) - return pool_alloc(p, l); + return mp_alloc(p, l); p->free = ee; return f; } -static inline void *fast_alloc_noalign(struct mempool *p, uns l) +static inline void *mp_alloc_fast_noalign(struct mempool *p, uns l) { byte *f = p->free; byte *ee = f + l; if (ee > p->last) - return pool_alloc(p, l); + return mp_alloc(p, l); p->free = ee; return f; }