clang-format

pull/4203/head
Craig Tiller 9 years ago
parent 22d11e1a76
commit 3328a5828f
  1. 2
      include/grpc/support/avl.h
  2. 14
      src/core/support/avl.c

@ -77,7 +77,7 @@ gpr_avl gpr_avl_ref(gpr_avl avl);
are no references left */
void gpr_avl_unref(gpr_avl avl);
/** return a new tree with (key, value) added to avl.
implicitly unrefs avl to allow easy chaining.
implicitly unrefs avl to allow easy chaining.
if key exists in avl, the new tree's key entry updated
(i.e. a duplicate is not created) */
gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value);

@ -206,9 +206,9 @@ static gpr_avl_node *add(const gpr_avl_vtable *vtable, gpr_avl_node *node,
if (cmp == 0) {
return new_node(key, value, ref_node(node->left), ref_node(node->right));
} else if (cmp > 0) {
return rebalance(vtable, vtable->copy_key(node->key),
vtable->copy_value(node->value),
add(vtable, node->left, key, value), ref_node(node->right));
return rebalance(
vtable, vtable->copy_key(node->key), vtable->copy_value(node->value),
add(vtable, node->left, key, value), ref_node(node->right));
} else {
return rebalance(vtable, vtable->copy_key(node->key),
vtable->copy_value(node->value), ref_node(node->left),
@ -253,11 +253,13 @@ static gpr_avl_node *remove(const gpr_avl_vtable *vtable, gpr_avl_node *node,
} else if (node->left->height < node->right->height) {
gpr_avl_node *h = in_order_head(node->right);
return rebalance(vtable, vtable->copy_key(h->key),
vtable->copy_value(h->value), ref_node(node->left), remove(vtable, node->right, h->key));
vtable->copy_value(h->value), ref_node(node->left),
remove(vtable, node->right, h->key));
} else {
gpr_avl_node *h = in_order_tail(node->left);
return rebalance(vtable, vtable->copy_key(h->key),
vtable->copy_value(h->value), remove(vtable, node->left, h->key), ref_node(node->right));
return rebalance(
vtable, vtable->copy_key(h->key), vtable->copy_value(h->value),
remove(vtable, node->left, h->key), ref_node(node->right));
}
} else if (cmp > 0) {
return rebalance(vtable, vtable->copy_key(node->key),

Loading…
Cancel
Save