static void print_tree(AOFF_RBTree_t* root) { fprintf(stderr, " --- AOFF tree begin ---\r\n"); print_tree_aux(root, 0); fprintf(stderr, " --- AOFF tree end ---\r\n"); }
static void print_tree_aux(AOFF_RBTree_t *x, int indent) { int i; if (x) { print_tree_aux(x->right, indent + INDENT_STEP); for (i = 0; i < indent; i++) { putc(' ', stderr); } fprintf(stderr, "%s: sz=%lu addr=0x%lx max_size=%u\r\n", IS_BLACK(x) ? "BLACK" : "RED", AOFF_BLK_SZ(x), (Uint)x, (unsigned)x->max_sz); print_tree_aux(x->left, indent + INDENT_STEP); } }
static void print_tree(RBTree_t *root, int ao) { char *type = ao ? "Size-Adress" : "Size"; fprintf(stderr, " --- %s tree begin ---\r\n", type); print_tree_aux(root, 0); fprintf(stderr, " --- %s tree end ---\r\n", type); }
static void print_tree_aux(RBTree_t *x, int indent) { int i; if (!x) { for (i = 0; i < indent; i++) { putc(' ', stderr); } fprintf(stderr, "BLACK: nil\r\n"); } else { print_tree_aux(x->right, indent + INDENT_STEP); for (i = 0; i < indent; i++) { putc(' ', stderr); } fprintf(stderr, "%s: sz=%lu addr=0x%lx\r\n", IS_BLACK(x) ? "BLACK" : "RED", BF_BLK_SZ(x), (Uint) x); print_tree_aux(x->left, indent + INDENT_STEP); } }