From: Martin Mares Date: Sun, 21 Jan 2001 11:07:58 +0000 (+0000) Subject: Introduced mp_alloc_zero(). X-Git-Tag: holmes-import~1582 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=2fbd0bc2b1bd00d48ea7f6852e6684b3c01dbce4;p=libucw.git Introduced mp_alloc_zero(). --- diff --git a/lib/pool.c b/lib/pool.c index 6143c68a..4eea7bf7 100644 --- a/lib/pool.c +++ b/lib/pool.c @@ -8,6 +8,7 @@ #include "lib/pools.h" #include +#include struct memchunk { struct memchunk *next; @@ -97,3 +98,11 @@ mp_alloc(struct mempool *p, uns s) return c->data; } } + +void * +mp_alloc_zero(struct mempool *p, uns s) +{ + void *x = mp_alloc(p, s); + bzero(x, s); + return x; +} diff --git a/lib/pools.h b/lib/pools.h index b8e6e964..3526aec0 100644 --- a/lib/pools.h +++ b/lib/pools.h @@ -19,6 +19,7 @@ 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 *mp_alloc_fast(struct mempool *p, uns l) {