From 120d9b4eba575cc48f7245cc82f04a8fd75490b5 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 4 May 2020 13:32:19 +0100 Subject: [PATCH] Initial design --- include/etl/message_pool.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/include/etl/message_pool.h b/include/etl/message_pool.h index e1c19b3f..f5a46f84 100644 --- a/include/etl/message_pool.h +++ b/include/etl/message_pool.h @@ -126,6 +126,10 @@ namespace etl { ::new(p) TMessage(); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -149,6 +153,10 @@ namespace etl { ::new(p) TMessage(t1); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -172,6 +180,10 @@ namespace etl { ::new(p) TMessage(t1, t2); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -195,6 +207,10 @@ namespace etl { ::new(p) TMessage(t1, t2, t3); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p); @@ -218,6 +234,10 @@ namespace etl { ::new(p) TMessage(t1, t2, t3, t4); } + else + { + ETL_ALWAYS_ASSERT(ETL_ERROR(etl::message_pool_allocation_failure)); + } } return reinterpret_cast(p) @@ -229,8 +249,11 @@ namespace etl //************************************************************************* void destroy(const etl::imessage* const pmsg) { - pmsg->~imessage(); - memory_block_pool.release_memory_block(pmsg); + if (pmsg != ETL_NULLPTR) + { + pmsg->~imessage(); + memory_block_pool.release_memory_block(pmsg); + } } //*************************************************************************