bintree_dump.c 743 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * bintree_dump.c
  3. */
  4. #include <stdio.h>
  5. #include "private.h"
  6. /*--------------------------------------------------------- */
  7. void
  8. _lub_bintree_dump(lub_bintree_t *this,
  9. lub_bintree_node_t *node)
  10. {
  11. if(node->left)
  12. {
  13. _lub_bintree_dump(this,node->left);
  14. }
  15. printf(" %s%p",
  16. (this->root == node) ? "(R)" : "",
  17. lub_bintree_getclientnode(this,node));
  18. if(node->right)
  19. {
  20. _lub_bintree_dump(this,node->right);
  21. }
  22. }
  23. /*--------------------------------------------------------- */
  24. void
  25. lub_bintree_dump(lub_bintree_t *this)
  26. {
  27. if(this->root)
  28. {
  29. _lub_bintree_dump(this, this->root);
  30. }
  31. }
  32. /*--------------------------------------------------------- */