Browse Source

Fixed debug print

Thomas Johnson 5 months ago
parent
commit
8ca9ddcdd7
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      tree_alloc.c

+ 3
- 2
tree_alloc.c View File

@@ -23,10 +23,11 @@ void debug_print_tree(int indent, void *p) {
23 23
 					node->parent->color == COLOR_RED));
24 24
 		debug_print_tree(indent + 1, node->left);
25 25
 		for (int ii = 0; ii < indent; ii++) { printf("  "); }
26
-		if (node->color == COLOR_RED) { printf(bad ? "\e[30m]" : "\e[31m"); }
26
+		if (node->color == COLOR_RED) { printf("\e[31m"); }
27
+    else if (bad) { printf("\e[30m]"); }
27 28
 		if (bad) { printf("\e[43m"); }
28 29
 		printf("%p %lu\n", node, node->size);
29
-		if (node->color == COLOR_RED) { printf("\e[37m"); }
30
+		printf("\e[37m");
30 31
 		if (bad) { printf("\e[40m"); }
31 32
 		debug_print_tree(indent + 1, node->right);
32 33
 	}

Loading…
Cancel
Save