diff options
author | smatz <smatz@openttd.org> | 2009-05-16 23:44:36 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-16 23:44:36 +0000 |
commit | ed1e54bd84074412ea9f273b7cd86aed42d844ce (patch) | |
tree | 4a5ab5dbd304f9a53f8f0065bc6965b1680ded78 /src/oldpool.h | |
parent | 6221d74644922ea4bbba3ed9cd8bbec42398f77b (diff) | |
download | openttd-ed1e54bd84074412ea9f273b7cd86aed42d844ce.tar.xz |
(svn r16326) -Codechange: replace GetPoolItemPoolSize() by PoolItem::GetPoolSize()
Diffstat (limited to 'src/oldpool.h')
-rw-r--r-- | src/oldpool.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/oldpool.h b/src/oldpool.h index 14e31a1bd..50bbdfe6e 100644 --- a/src/oldpool.h +++ b/src/oldpool.h @@ -279,12 +279,21 @@ struct PoolItem { /** * Get item with given index + * @param index item to get */ static FORCEINLINE T *Get(uint index) { return Tpool->Get(index); } + /** + * Returns size of the pool (in number of items) + */ + static FORCEINLINE uint GetPoolSize() + { + return Tpool->GetSize(); + } + private: static T *AllocateSafeRaw(uint &first); @@ -333,14 +342,9 @@ public: }; -#define OLD_POOL_ACCESSORS(name, type) \ - static inline uint Get##name##PoolSize() { return _##name##_pool.GetSize(); } - - #define DECLARE_OLD_POOL(name, type, block_size_bits, max_blocks) \ OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \ - extern OldMemoryPool<type> _##name##_pool; \ - OLD_POOL_ACCESSORS(name, type) + extern OldMemoryPool<type> _##name##_pool; #define DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \ @@ -359,7 +363,7 @@ public: #define STATIC_OLD_POOL(name, type, block_size_bits, max_blocks, new_block_proc, clean_block_proc) \ OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \ static DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \ - OLD_POOL_ACCESSORS(name, type) \ - static inline type *Get##name(uint index) { return _##name##_pool.Get(index); } + static inline type *Get##name(uint index) { return _##name##_pool.Get(index); } \ + static inline uint Get##name##PoolSize() { return _##name##_pool.GetSize(); } #endif /* OLDPOOL_H */ |