diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-04-11 00:30:25 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-04-11 00:30:25 +0000 |
commit | 6ba0b0e9f46cedfa83813f1faf63ab4a24456e4d (patch) | |
tree | 52f1136888d2cd980a725e9e6d989fdb1e490ea5 /src/common/mempool.h | |
parent | d7359eb996218f4492a5583c34ab8ee7d9315e7d (diff) | |
download | tor-6ba0b0e9f46cedfa83813f1faf63ab4a24456e4d.tar.gz tor-6ba0b0e9f46cedfa83813f1faf63ab4a24456e4d.zip |
r12336@catbus: nickm | 2007-04-10 17:34:25 -0400
Unit tests and debugging for memory pool implementation.
svn:r9938
Diffstat (limited to 'src/common/mempool.h')
-rw-r--r-- | src/common/mempool.h | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/common/mempool.h b/src/common/mempool.h index 45e3646819..2ee32fb137 100644 --- a/src/common/mempool.h +++ b/src/common/mempool.h @@ -17,32 +17,18 @@ void mp_pool_release(void *item); mp_pool_t *mp_pool_new(size_t item_size, unsigned int n_per_chunk); void mp_pool_clean(mp_pool_t *pool); void mp_pool_destroy(mp_pool_t *pool); +void mp_pool_assert_ok(mp_pool_t *pool); #ifdef MEMPOOL_PRIVATE -typedef struct mp_allocated_t mp_allocated_t; typedef struct mp_chunk_t mp_chunk_t; /** DOCDOC */ -struct mp_chunk_t { - unsigned long magic; - mp_chunk_t *next; - mp_chunk_t *prev; - mp_pool_t *pool; - mp_allocated_t *first_free; - int n_allocated; - int capacity; - size_t mem_size; - char *next_mem; - char mem[1]; -}; - -/** DOCDOC */ struct mp_pool_t { mp_chunk_t *empty_chunks; mp_chunk_t *used_chunks; mp_chunk_t *full_chunks; int n_empty_chunks; - size_t new_chunk_capacity; + int new_chunk_capacity; size_t item_alloc_size; }; #endif |