From: Martin Mares Date: Sun, 14 Jan 2001 18:46:08 +0000 (+0000) Subject: Renamed memory pool functions to "mp_*", so they don't clobber name space. X-Git-Tag: holmes-import~1596 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b7e3d06a00ca5c95df8202678da7e3b11037c6be;p=libucw.git Renamed memory pool functions to "mp_*", so they don't clobber name space. --- diff --git a/lib/pool.c b/lib/pool.c index b4783e87..6143c68a 100644 --- a/lib/pool.c +++ b/lib/pool.c @@ -1,7 +1,7 @@ /* * Sherlock Library -- Memory Pools (One-Time Allocation) * - * (c) 1997--1999 Martin Mares + * (c) 1997--2001 Martin Mares */ #include "lib/lib.h" @@ -15,7 +15,7 @@ struct memchunk { }; struct mempool * -new_pool(uns size) +mp_new(uns size) { struct mempool *p = xmalloc(sizeof(struct mempool)); @@ -29,7 +29,7 @@ new_pool(uns size) } void -free_pool(struct mempool *p) +mp_delete(struct mempool *p) { struct memchunk *c, *d; @@ -47,7 +47,7 @@ free_pool(struct mempool *p) } void -flush_pool(struct mempool *p) +mp_flush(struct mempool *p) { struct memchunk *c; @@ -61,7 +61,7 @@ flush_pool(struct mempool *p) } void * -pool_alloc(struct mempool *p, uns s) +mp_alloc(struct mempool *p, uns s) { if (s <= p->threshold) { diff --git a/lib/pools.h b/lib/pools.h index 95c8e17f..b8e6e964 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,27 @@ 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); -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; }