diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-30 21:16:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-30 21:16:37 +0400 |
commit | 001259ccb6a8dbe0c70e4eb0f47a82b9b574d3b4 (patch) | |
tree | acb3aa815ebe1f3ce355e8677a78af8e6f89d0e7 /source/blender/blenlib/intern/BLI_mempool.c | |
parent | c69f2eaca97084e0e830756b574c9ec8a55c6643 (diff) |
warning/portability fixes.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_mempool.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 26d6f5af147..823841ef152 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -154,9 +154,11 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d first = pool->chunks.first; BLI_remlink(&pool->chunks, first); - for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) - pool->use_sysmalloc ? free(mpchunk->data) : MEM_freeN(mpchunk->data); - + for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + if(pool->use_sysmalloc) free(mpchunk->data); + else MEM_freeN(mpchunk->data); + } + pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks)); BLI_addtail(&pool->chunks, first); @@ -175,9 +177,18 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d void BLI_mempool_destroy(BLI_mempool *pool) { BLI_mempool_chunk *mpchunk=NULL; - for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) - pool->use_sysmalloc ? free(mpchunk->data) : MEM_freeN(mpchunk->data); - - pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks)); - pool->use_sysmalloc ? free(pool) : MEM_freeN(pool); + if(pool->use_sysmalloc) { + for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + free(mpchunk->data); + } + BLI_freelist(&(pool->chunks)); + free(pool); + } + else { + for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + MEM_freeN(mpchunk->data); + } + BLI_freelistN(&(pool->chunks)); + MEM_freeN(pool); + } } |