diff --git a/include/etl/object_pool.h b/include/etl/object_pool.h index 9d7539c9..261f30db 100644 --- a/include/etl/object_pool.h +++ b/include/etl/object_pool.h @@ -71,7 +71,7 @@ namespace etl //************************************************************************* /// //************************************************************************* - template + template void release(T&& object) { release_block(reinterpret_cast(&object)); @@ -126,7 +126,7 @@ namespace etl } //******************************* - size_t size() const + size_t data_size() const { return size_t(reinterpret_cast(next) - data()); } @@ -216,58 +216,6 @@ namespace etl return nullptr; } - //************************************************************************* - /// - //************************************************************************* - void release_block(char* ptr) - { - header* block; - header* p; - - // acquire pointer to block header - block = reinterpret_cast(ptr) - 1; - - // Find the correct place to place the block in (the free list is sorted by - // address, increasing order) - // - for (p = head; !(block > p && block < p->next); p = p->next) - { - // Since the free list is circular, there is one link where a - // higher-addressed block points to a lower-addressed block. - // This condition checks if the block should be actually - // inserted between them - // - if (p >= p->next && (block > p || block < p->next)) - break; - } - - // Try to combine with the higher neighbor - // - if (block + block->size() == p->next) - { - block->size += p->next->size; - block->next = p->next->next; - } - else - { - block->next = p->next; - } - - // Try to combine with the lower neighbor - // - if (p + p->size == block) - { - p->size += block->size; - p->next = block->next; - } - else - { - p->next = block; - } - - free_p = p; - } - char* pbuffer; size_t buffer_size; header* head;