[poincare] TreePool: createTreeNode takes a size as parameters (node can

have variable sizes - integer)
This commit is contained in:
Émilie Feral
2018-07-27 14:10:44 +02:00
parent 67e9405b8c
commit 0677f4935f

View File

@@ -19,13 +19,13 @@ public:
TreeNode * last() const { return reinterpret_cast<TreeNode *>(const_cast<char *>(m_cursor)); }
template <typename T>
TreeNode * createTreeNode() {
TreeNode * createTreeNode(size_t size = sizeof(T)) {
int nodeIdentifier = generateIdentifier();
if (nodeIdentifier == -1) {
T::FailedAllocationStaticNode()->retain();
return T::FailedAllocationStaticNode();
}
void * ptr = alloc(sizeof(T));
void * ptr = alloc(size);
if (ptr == nullptr) {
T::FailedAllocationStaticNode()->retain();
return T::FailedAllocationStaticNode();