heap_foreach_segment.c 639 B

12345678910111213141516171819202122232425
  1. /*
  2. * heap_foreach_segment.c
  3. */
  4. #include "private.h"
  5. /*--------------------------------------------------------- */
  6. void
  7. lub_heap_foreach_segment(lub_heap_t *this,
  8. lub_heap_foreach_fn *fn,
  9. void *arg)
  10. {
  11. lub_heap_segment_t *segment;
  12. unsigned int i = 1;
  13. for(segment = &this->first_segment;
  14. segment;
  15. segment = segment->next)
  16. {
  17. /* call the client function */
  18. fn(segment,
  19. i++,
  20. (segment->words << 2),
  21. arg);
  22. }
  23. }
  24. /*--------------------------------------------------------- */