aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/support
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-05-07 22:11:37 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-05-07 22:11:37 -0700
commit965eab3aa2eb56cfa5df068390c71d513b1655e3 (patch)
tree0622f9e8675755890ff0de0a46378cb6b4386ffd /src/core/lib/support
parent71d28ad3b50068a677254e01c514eb0f7290063c (diff)
Fix refcounting
Diffstat (limited to 'src/core/lib/support')
-rw-r--r--src/core/lib/support/avl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c
index ceded9d266..acf8fd5a55 100644
--- a/src/core/lib/support/avl.c
+++ b/src/core/lib/support/avl.c
@@ -124,6 +124,15 @@ void *gpr_avl_get(gpr_avl avl, void *key) {
return node ? node->value : NULL;
}
+int gpr_avl_maybe_get(gpr_avl avl, void *key, void **value) {
+ gpr_avl_node *node = get(avl.vtable, avl.root, key);
+ if (node != NULL) {
+ *value = node->value;
+ return 1;
+ }
+ return 0;
+}
+
static gpr_avl_node *rotate_left(const gpr_avl_vtable *vtable, void *key,
void *value, gpr_avl_node *left,
gpr_avl_node *right) {