1
0

heap_new_free_block.c 885 B

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