diff options
author | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
commit | f35ed4bbc2b05f1b83476b60948d64375f77f1b4 (patch) | |
tree | 1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/oldpool.cpp | |
parent | a332d10fd938f345fff18e5f4a662a58f692f734 (diff) | |
download | openttd-f35ed4bbc2b05f1b83476b60948d64375f77f1b4.tar.xz |
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/oldpool.cpp')
-rw-r--r-- | src/oldpool.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/oldpool.cpp b/src/oldpool.cpp index 2b2d188e8..d19aa684e 100644 --- a/src/oldpool.cpp +++ b/src/oldpool.cpp @@ -5,6 +5,7 @@ #include "debug.h" #include "functions.h" #include "oldpool.h" +#include "helpers.hpp" /** * Clean a pool in a safe way (does free all blocks) @@ -49,11 +50,11 @@ bool AddBlockToPool(OldMemoryPool *pool) DEBUG(misc, 4, "[Pool] (%s) increasing size of pool to %d items (%d bytes)", pool->name, pool->total_items, pool->total_items * pool->item_size); /* Increase the poolsize */ - pool->blocks = realloc(pool->blocks, sizeof(pool->blocks[0]) * (pool->current_blocks + 1)); + ReallocT(&pool->blocks, pool->current_blocks + 1); if (pool->blocks == NULL) error("Pool: (%s) could not allocate memory for blocks", pool->name); /* Allocate memory to the new block item */ - pool->blocks[pool->current_blocks] = malloc(pool->item_size * (1 << pool->block_size_bits)); + MallocT(&pool->blocks[pool->current_blocks], pool->item_size * (1 << pool->block_size_bits)); if (pool->blocks[pool->current_blocks] == NULL) error("Pool: (%s) could not allocate memory for blocks", pool->name); |