Skip to content
Snippets Groups Projects
Commit 9c721ff3 authored by Craig Tiller's avatar Craig Tiller
Browse files

faster asserts

parent a3c03e68
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,6 @@ static long calculate_height(gpr_avl_node *node) { ...@@ -76,7 +76,6 @@ static long calculate_height(gpr_avl_node *node) {
return node == NULL ? 0 : 1 + GPR_MAX(calculate_height(node->left), return node == NULL ? 0 : 1 + GPR_MAX(calculate_height(node->left),
calculate_height(node->right)); calculate_height(node->right));
} }
#endif
static gpr_avl_node *assert_invariants(gpr_avl_node *n) { static gpr_avl_node *assert_invariants(gpr_avl_node *n) {
if (n == NULL) return NULL; if (n == NULL) return NULL;
...@@ -86,6 +85,11 @@ static gpr_avl_node *assert_invariants(gpr_avl_node *n) { ...@@ -86,6 +85,11 @@ static gpr_avl_node *assert_invariants(gpr_avl_node *n) {
assert(labs(node_height(n->left) - node_height(n->right)) <= 1); assert(labs(node_height(n->left) - node_height(n->right)) <= 1);
return n; return n;
} }
#else
static gpr_avl_node *assert_invariants(gpr_avl_node *n) {
return n;
}
#endif
gpr_avl_node *new_node(void *key, void *value, gpr_avl_node *left, gpr_avl_node *new_node(void *key, void *value, gpr_avl_node *left,
gpr_avl_node *right) { gpr_avl_node *right) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment