summaryrefslogtreecommitdiff
path: root/src/core/pool_type.hpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-20 17:57:56 +0000
committertruebrain <truebrain@openttd.org>2011-12-20 17:57:56 +0000
commit1c9bec19993417b1f3b240f2bdb0745aa26c0cb3 (patch)
treed09407cc962ee87ac1bbbbc60951cad74c6b1db7 /src/core/pool_type.hpp
parent7a38642a1c83531a65907ae784bc03a82d35132a (diff)
downloadopenttd-1c9bec19993417b1f3b240f2bdb0745aa26c0cb3.tar.xz
(svn r23640) -Fix: stop using FORCEINLINE (1/3rd of the instances were, the others were still regular inline), but make sure inline is always a 'forced' inline (I am looking at you MSVC)
Diffstat (limited to 'src/core/pool_type.hpp')
-rw-r--r--src/core/pool_type.hpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/core/pool_type.hpp b/src/core/pool_type.hpp
index f9b1e8230..f4b155842 100644
--- a/src/core/pool_type.hpp
+++ b/src/core/pool_type.hpp
@@ -98,7 +98,7 @@ struct Pool : PoolBase {
* @return pointer to Titem
* @pre index < this->first_unused
*/
- FORCEINLINE Titem *Get(size_t index)
+ inline Titem *Get(size_t index)
{
assert(index < this->first_unused);
return this->data[index];
@@ -109,7 +109,7 @@ struct Pool : PoolBase {
* @param index index to examine
* @return true if PoolItem::Get(index) will return non-NULL pointer
*/
- FORCEINLINE bool IsValidID(size_t index)
+ inline bool IsValidID(size_t index)
{
return index < this->first_unused && this->Get(index) != NULL;
}
@@ -119,7 +119,7 @@ struct Pool : PoolBase {
* @param n number of items we want to allocate
* @return true if 'n' items can be allocated
*/
- FORCEINLINE bool CanAllocate(size_t n = 1)
+ inline bool CanAllocate(size_t n = 1)
{
bool ret = this->items <= Tmax_size - n;
#ifdef OTTD_ASSERT
@@ -142,7 +142,7 @@ struct Pool : PoolBase {
* @return pointer to allocated memory
* @note can never fail (return NULL), use CanAllocate() to check first!
*/
- FORCEINLINE void *operator new(size_t size)
+ inline void *operator new(size_t size)
{
return Tpool->GetNew(size);
}
@@ -152,7 +152,7 @@ struct Pool : PoolBase {
* @param p memory to free
* @note the item has to be allocated in the pool!
*/
- FORCEINLINE void operator delete(void *p)
+ inline void operator delete(void *p)
{
Titem *pn = (Titem *)p;
assert(pn == Tpool->Get(pn->index));
@@ -167,7 +167,7 @@ struct Pool : PoolBase {
* @note can never fail (return NULL), use CanAllocate() to check first!
* @pre index has to be unused! Else it will crash
*/
- FORCEINLINE void *operator new(size_t size, size_t index)
+ inline void *operator new(size_t size, size_t index)
{
return Tpool->GetNew(size, index);
}
@@ -180,7 +180,7 @@ struct Pool : PoolBase {
* @note use of this is strongly discouraged
* @pre the memory must not be allocated in the Pool!
*/
- FORCEINLINE void *operator new(size_t size, void *ptr)
+ inline void *operator new(size_t size, void *ptr)
{
for (size_t i = 0; i < Tpool->first_unused; i++) {
/* Don't allow creating new objects over existing.
@@ -202,7 +202,7 @@ struct Pool : PoolBase {
* @param n number of items we want to allocate
* @return true if 'n' items can be allocated
*/
- static FORCEINLINE bool CanAllocateItem(size_t n = 1)
+ static inline bool CanAllocateItem(size_t n = 1)
{
return Tpool->CanAllocate(n);
}
@@ -211,7 +211,7 @@ struct Pool : PoolBase {
* Returns current state of pool cleaning - yes or no
* @return true iff we are cleaning the pool now
*/
- static FORCEINLINE bool CleaningPool()
+ static inline bool CleaningPool()
{
return Tpool->cleaning;
}
@@ -221,7 +221,7 @@ struct Pool : PoolBase {
* @param index index to examine
* @return true if PoolItem::Get(index) will return non-NULL pointer
*/
- static FORCEINLINE bool IsValidID(size_t index)
+ static inline bool IsValidID(size_t index)
{
return Tpool->IsValidID(index);
}
@@ -232,7 +232,7 @@ struct Pool : PoolBase {
* @return pointer to Titem
* @pre index < this->first_unused
*/
- static FORCEINLINE Titem *Get(size_t index)
+ static inline Titem *Get(size_t index)
{
return Tpool->Get(index);
}
@@ -243,7 +243,7 @@ struct Pool : PoolBase {
* @return pointer to Titem
* @note returns NULL for invalid index
*/
- static FORCEINLINE Titem *GetIfValid(size_t index)
+ static inline Titem *GetIfValid(size_t index)
{
return index < Tpool->first_unused ? Tpool->Get(index) : NULL;
}
@@ -253,7 +253,7 @@ struct Pool : PoolBase {
* all pool items.
* @return first unused index
*/
- static FORCEINLINE size_t GetPoolSize()
+ static inline size_t GetPoolSize()
{
return Tpool->first_unused;
}
@@ -262,7 +262,7 @@ struct Pool : PoolBase {
* Returns number of valid items in the pool
* @return number of valid items in the pool
*/
- static FORCEINLINE size_t GetNumItems()
+ static inline size_t GetNumItems()
{
return Tpool->items;
}
@@ -274,7 +274,7 @@ struct Pool : PoolBase {
* @note when this function is called, PoolItem::Get(index) == NULL.
* @note it's called only when !CleaningPool()
*/
- static FORCEINLINE void PostDestructor(size_t index) { }
+ static inline void PostDestructor(size_t index) { }
};
private: