summaryrefslogtreecommitdiff
path: root/src/pool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pool.h')
-rw-r--r--src/pool.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pool.h b/src/pool.h
index 05d33924..dee6ecda 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -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)