From 0677f4935fd693a667cd016c65d8b47eaa2970a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 27 Jul 2018 14:10:44 +0200 Subject: [PATCH] [poincare] TreePool: createTreeNode takes a size as parameters (node can have variable sizes - integer) --- poincare/include/poincare/tree_pool.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poincare/include/poincare/tree_pool.h b/poincare/include/poincare/tree_pool.h index 7d54e5fb4..c700bd74c 100644 --- a/poincare/include/poincare/tree_pool.h +++ b/poincare/include/poincare/tree_pool.h @@ -19,13 +19,13 @@ public: TreeNode * last() const { return reinterpret_cast(const_cast(m_cursor)); } template - 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();