heap_new_free_block.c 688 B

123456789101112131415161718192021222324252627
  1. #include <assert.h>
  2. #include "private.h"
  3. /*--------------------------------------------------------- */
  4. lub_heap_status_t
  5. lub_heap_new_free_block(lub_heap_t * this, lub_heap_block_t * block)
  6. {
  7. lub_heap_status_t result = LUB_HEAP_OK;
  8. bool_t seg_start, seg_end;
  9. lub_heap_tag_t *tail;
  10. assert(0 == block->alloc.tag.free);
  11. /* get the segment details from the current block */
  12. seg_start = block->alloc.tag.segment;
  13. tail = lub_heap_block__get_tail(block);
  14. seg_end = tail->segment;
  15. /* now set up the free block */
  16. lub_heap_init_free_block(this,
  17. block, (tail->words << 2), seg_start, seg_end);
  18. return result;
  19. }
  20. /*--------------------------------------------------------- */