summaryrefslogtreecommitdiff
path: root/mysys/tree.c
diff options
context:
space:
mode:
authorserg@serg.mysql.com <>2001-07-10 20:23:37 +0200
committerserg@serg.mysql.com <>2001-07-10 20:23:37 +0200
commitdb4a86020313514c181eab47efd1270cef934f15 (patch)
tree37fd4c550aa7b25316589a6520541c7a7c840264 /mysys/tree.c
parent1e6fe8f10e27b76e1bb55013e13c27b656b0491c (diff)
downloadmariadb-git-db4a86020313514c181eab47efd1270cef934f15.tar.gz
cleanups
Diffstat (limited to 'mysys/tree.c')
-rw-r--r--mysys/tree.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/mysys/tree.c b/mysys/tree.c
index e02033ff413..cf9ce0caafa 100644
--- a/mysys/tree.c
+++ b/mysys/tree.c
@@ -63,31 +63,7 @@ static void rb_delete_fixup(TREE *tree,TREE_ELEMENT ***parent);
/* The actuall code for handling binary trees */
#ifndef DBUG_OFF
-
- /* Test that the proporties for a red-black tree holds */
-
-static int test_rb_tree(TREE_ELEMENT *element)
-{
- int count_l,count_r;
-
- if (!element->left)
- return 0; /* Found end of tree */
- if (element->colour == RED &&
- (element->left->colour == RED || element->right->colour == RED))
- {
- printf("Wrong tree: Found two red in a row\n");
- return -1;
- }
- count_l=test_rb_tree(element->left);
- count_r=test_rb_tree(element->right);
- if (count_l >= 0 && count_r >= 0)
- {
- if (count_l == count_r)
- return count_l+(element->colour == BLACK);
- printf("Wrong tree: Incorrect black-count: %d - %d\n",count_l,count_r);
- }
- return -1;
-}
+static int test_rb_tree(TREE_ELEMENT *element);
#endif
void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
@@ -546,3 +522,31 @@ static void rb_delete_fixup(TREE *tree, TREE_ELEMENT ***parent)
}
x->colour=BLACK;
}
+
+#ifndef DBUG_OFF
+
+ /* Test that the proporties for a red-black tree holds */
+
+static int test_rb_tree(TREE_ELEMENT *element)
+{
+ int count_l,count_r;
+
+ if (!element->left)
+ return 0; /* Found end of tree */
+ if (element->colour == RED &&
+ (element->left->colour == RED || element->right->colour == RED))
+ {
+ printf("Wrong tree: Found two red in a row\n");
+ return -1;
+ }
+ count_l=test_rb_tree(element->left);
+ count_r=test_rb_tree(element->right);
+ if (count_l >= 0 && count_r >= 0)
+ {
+ if (count_l == count_r)
+ return count_l+(element->colour == BLACK);
+ printf("Wrong tree: Incorrect black-count: %d - %d\n",count_l,count_r);
+ }
+ return -1;
+}
+#endif