X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fpools.h;h=ff9250dcb5f3d0d7dd80f0ef4e5ccb5abe62b684;hb=c49e8f00da4d1f214621a19364c64e30fa4afc7c;hp=ea3fbddf0d50f94008b1da79227d12e41172b925;hpb=6d3f0167feb4d66ace66963200726439cb4a3914;p=libucw.git diff --git a/lib/pools.h b/lib/pools.h index ea3fbddf..ff9250dc 100644 --- a/lib/pools.h +++ b/lib/pools.h @@ -1,7 +1,10 @@ /* * Sherlock Library -- Memory Pools * - * (c) 1997--2001 Martin Mares + * (c) 1997--2004 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. */ #ifndef _SHERLOCK_POOLS_H @@ -23,6 +26,7 @@ void mp_delete(struct mempool *); void mp_flush(struct mempool *); void *mp_alloc(struct mempool *, uns); void *mp_alloc_zero(struct mempool *, uns); +char *mp_strdup(struct mempool *, char *); static inline void *mp_alloc_fast(struct mempool *p, uns l) { @@ -44,4 +48,17 @@ static inline void *mp_alloc_fast_noalign(struct mempool *p, uns l) return f; } +static inline void * +mp_start_string(struct mempool *p, uns l) +{ + ASSERT(l <= p->chunk_size); + return mp_alloc(p, l); +} + +static inline void +mp_end_string(struct mempool *p, void *stop) +{ + p->free = stop; +} + #endif