bintree_dump.c 709 B

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