diff --git a/src/shared/mempool.c b/src/shared/mempool.c index b39a37f2db4..d5d98d88294 100644 --- a/src/shared/mempool.c +++ b/src/shared/mempool.c @@ -74,6 +74,15 @@ void* mempool_alloc_tile(struct mempool *mp) { return ((uint8_t*) mp->first_pool) + ALIGN(sizeof(struct pool)) + i*mp->tile_size; } +void* mempool_alloc0_tile(struct mempool *mp) { + void *p; + + p = mempool_alloc_tile(mp); + if (p) + memzero(p, mp->tile_size); + return p; +} + void mempool_free_tile(struct mempool *mp, void *p) { * (void**) p = mp->freelist; mp->freelist = p; diff --git a/src/shared/mempool.h b/src/shared/mempool.h index 8b0bf381bf7..42f473bee10 100644 --- a/src/shared/mempool.h +++ b/src/shared/mempool.h @@ -34,6 +34,7 @@ struct mempool { }; void* mempool_alloc_tile(struct mempool *mp); +void* mempool_alloc0_tile(struct mempool *mp); void mempool_free_tile(struct mempool *mp, void *p); #define DEFINE_MEMPOOL(pool_name, tile_type, alloc_at_least) \