summaryrefslogtreecommitdiffstats
path: root/src/AllocationPool.h
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-06-14 18:57:21 +0200
committerTycho <work.tycho+git@gmail.com>2014-06-14 18:57:21 +0200
commit8bf37f3dd7ff017eedaac427b9291a9335d61efc (patch)
treef3ce368c042c0c2a1f26b5e49b8b09204fa3d341 /src/AllocationPool.h
parentAdded logging (diff)
downloadcuberite-8bf37f3dd7ff017eedaac427b9291a9335d61efc.tar
cuberite-8bf37f3dd7ff017eedaac427b9291a9335d61efc.tar.gz
cuberite-8bf37f3dd7ff017eedaac427b9291a9335d61efc.tar.bz2
cuberite-8bf37f3dd7ff017eedaac427b9291a9335d61efc.tar.lz
cuberite-8bf37f3dd7ff017eedaac427b9291a9335d61efc.tar.xz
cuberite-8bf37f3dd7ff017eedaac427b9291a9335d61efc.tar.zst
cuberite-8bf37f3dd7ff017eedaac427b9291a9335d61efc.zip
Diffstat (limited to '')
-rw-r--r--src/AllocationPool.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index 643b44a6d..b8862e7df 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -3,7 +3,7 @@
#include <memory>
-template<class T, size_t BufferSize>
+template<class T, size_t NumElementsInReserve>
class cAllocationPool {
public:
@@ -32,14 +32,14 @@ class cAllocationPool {
T* Allocate()
{
- if (m_FreeList.size() <= BufferSize)
+ if (m_FreeList.size() <= NumElementsInReserve)
{
void * space = malloc(sizeof(T));
if (space != NULL)
{
return new(space) T;
}
- else if (m_FreeList.size() == BufferSize)
+ else if (m_FreeList.size() == NumElementsInReserve)
{
m_Callbacks->OnStartingUsingBuffer();
}
@@ -64,7 +64,7 @@ class cAllocationPool {
// placement destruct.
ptr->~T();
m_FreeList.push_front(ptr);
- if (m_FreeList.size() == BufferSize)
+ if (m_FreeList.size() == NumElementsInReserve)
{
m_Callbacks->OnStopUsingBuffer();
}