summaryrefslogtreecommitdiff
path: root/pool.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-18 18:48:50 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-18 18:48:50 +0000
commitae7ec5cd0d9eb0a137c8a3cf9e7ca99679768a87 (patch)
tree07455a17b9de0227444751069ab0ca9276a82252 /pool.c
parent24ef4ce560cc3e0b4e45fe15fae839ce8071bec9 (diff)
downloadopenttd-ae7ec5cd0d9eb0a137c8a3cf9e7ca99679768a87.tar.xz
(svn r4471) - Pools: Add a facility for calling a custom function during pool block clean up.
Diffstat (limited to 'pool.c')
-rw-r--r--pool.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pool.c b/pool.c
index 9b340e3f2..828aa87d9 100644
--- a/pool.c
+++ b/pool.c
@@ -16,8 +16,12 @@ void CleanPool(MemoryPool *pool)
DEBUG(misc, 4)("[Pool] (%s) Cleaning pool..", pool->name);
/* Free all blocks */
- for (i = 0; i < pool->current_blocks; i++)
+ for (i = 0; i < pool->current_blocks; i++) {
+ if (pool->clean_block_proc != NULL) {
+ pool->clean_block_proc(i * (1 << pool->block_size_bits), (i + 1) * (1 << pool->block_size_bits) - 1);
+ }
free(pool->blocks[i]);
+ }
/* Free the block itself */
free(pool->blocks);