[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58390] trunk/blender/source/blender/ blenlib/intern/BLI_mempool.c: optimization: avoid extra loop in BLI_mempool_destroy().
Campbell Barton
ideasman42 at gmail.com
Fri Jul 19 12:40:58 CEST 2013
Revision: 58390
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58390
Author: campbellbarton
Date: 2013-07-19 10:40:57 +0000 (Fri, 19 Jul 2013)
Log Message:
-----------
optimization: avoid extra loop in BLI_mempool_destroy(). free the list inline.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
Modified: trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_mempool.c 2013-07-19 10:40:52 UTC (rev 58389)
+++ trunk/blender/source/blender/blenlib/intern/BLI_mempool.c 2013-07-19 10:40:57 UTC (rev 58390)
@@ -437,19 +437,22 @@
void BLI_mempool_destroy(BLI_mempool *pool)
{
BLI_mempool_chunk *mpchunk = NULL;
+ BLI_mempool_chunk *mpchunk_next;
if (pool->flag & BLI_MEMPOOL_SYSMALLOC) {
- for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
+ for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk_next) {
+ mpchunk_next = mpchunk->next;
free(mpchunk->data);
+ free(mpchunk);
}
- BLI_freelist(&(pool->chunks));
free(pool);
}
else {
- for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
+ for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk_next) {
+ mpchunk_next = mpchunk->next;
MEM_freeN(mpchunk->data);
+ MEM_freeN(mpchunk);
}
- BLI_freelistN(&(pool->chunks));
MEM_freeN(pool);
}
}
More information about the Bf-blender-cvs
mailing list