diff options
Diffstat (limited to 'src/pool.h')
-rw-r--r-- | src/pool.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -76,6 +76,17 @@ extern void git_pool_swap(git_pool *a, git_pool *b); extern void *git_pool_malloc(git_pool *pool, uint32_t items); /** + * Allocate space and zero it out. + */ +GIT_INLINE(void *) git_pool_mallocz(git_pool *pool, uint32_t items) +{ + void *ptr = git_pool_malloc(pool, items); + if (ptr) + memset(ptr, 0, (size_t)items * (size_t)pool->item_size); + return ptr; +} + +/** * Allocate space and duplicate string data into it. * * This is allowed only for pools with item_size == sizeof(char) |