diff options
author | Jameson Miller <jamill@microsoft.com> | 2018-07-02 19:49:35 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-07-03 10:58:27 -0700 |
commit | 0e58301d8199208d1e48b9f64c4ad1089a355905 (patch) | |
tree | f9446f211b964774ad876430bcfa2ff3008b81b7 /mem-pool.h | |
parent | 158dfeff3dc1d155b84e68b265a9b6c265717e1e (diff) | |
download | git-0e58301d8199208d1e48b9f64c4ad1089a355905.tar.gz |
mem-pool: fill out functionality
Add functions for:
- combining two memory pools
- determining if a memory address is within the range managed by a
memory pool
These functions will be used by future commits.
Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mem-pool.h')
-rw-r--r-- | mem-pool.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mem-pool.h b/mem-pool.h index f75b3365d5..adeefdcb28 100644 --- a/mem-pool.h +++ b/mem-pool.h @@ -41,4 +41,17 @@ void *mem_pool_alloc(struct mem_pool *pool, size_t len); */ void *mem_pool_calloc(struct mem_pool *pool, size_t count, size_t size); +/* + * Move the memory associated with the 'src' pool to the 'dst' pool. The 'src' + * pool will be empty and not contain any memory. It still needs to be free'd + * with a call to `mem_pool_discard`. + */ +void mem_pool_combine(struct mem_pool *dst, struct mem_pool *src); + +/* + * Check if a memory pointed at by 'mem' is part of the range of + * memory managed by the specified mem_pool. + */ +int mem_pool_contains(struct mem_pool *mem_pool, void *mem); + #endif |